Created
October 9, 2024 15:00
-
-
Save vprasadreddy/4bed0ab0c47a2425cd4d83b78f43464d to your computer and use it in GitHub Desktop.
basic linux commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //to generate public & private keys | |
| ssh-keygen -t rsa -b 4096 | |
| //Login to Linux VM | |
| ssh -i C:\Users\Varaprasad.Reddy\Downloads\vm-loadbalancer1-dev_key.pem azureuser@ip_address | |
| //to get current machine ip address | |
| curl ifconfig.me | |
| //to change user to root user | |
| sudo su - | |
| //to get the updates of packages | |
| sudo apt update | |
| //to install the updates of packages | |
| sudo apt upgrade | |
| //install a package | |
| sudo apt-get install nginx | |
| //check the status of a service | |
| sudo systemctl status nginx | |
| //to restart a service | |
| sudo systemctl restart nginx | |
| systemctl reload nginx | |
| //firewall commands in Linux | |
| sudo ufw status | |
| sudo ufw enable | |
| sudo ufw allow 'Nginx HTTP' | |
| sudo ufw allow ssh or sudo ufw allow 22/tcp | |
| sudo ufw allow 8080 | |
| sudo ufw reload | |
| # to get nginx default html page location & config location | |
| nginx -V | |
| # to get nginx default html page location | |
| cd /etc/nginx/sites-enabled | |
| cd /var/www/html | |
| change the content of the html file and save it | |
| # reload and restart the nginx server to reflect the changes. | |
| systemctl reload nginx | |
| sudo systemctl restart nginx | |
| //to ping a URL | |
| curl http://52.226.200.153/api/HttpExample?name=prasad | |
| to copy a file from local machine to remote machine | |
| scp -i C:\Users\Varaprasad.Reddy\Downloads\ansible-server_key.pem C:\Users\Varaprasad.Reddy\Downloads\vsts-agent-linux-x64-3.232.3.tar.gz adminuser@40.71.64.116:/home/adminuser/Downloads | |
| ssh-copy-id -i ~/pem_keys/jenkins-server-key.pem azureuser@20.231.92.54 | |
| sudo service --status-all | |
| sudo service docker status | |
| ps -aux | grep docker |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment