- Using username and password
ssh user@hostname ssh user@ip
- Using a key file
ssh -i /path/to/key/file.pem user@ip_or_hostname
- Print currenct directory
pwd
- Change to specific directory
cd /path/to/directory
- List all the files in a directory
ls -l
- List the files including hidden
ls -la
- List the files based on creation time
ls -lt
- Creating a directory
mkdir name-of-dir
- Deleting a directory ( works only when the directory is empty )
rmdir name-of-dir
- Delete the contents of a directory recursively ( Please use this with caution )
rm -rf directory/
- Opening a file
vi filename
- Editing a file
Press <i> to start insert mode
- Saving a file
:w
- Exiting the editor by ignoring the changes
:q!
- Quit the editor
:q
- Continously tail a log file
tail -f filename
- View the last n lines from the file
tail -n <number-of-lines> filename
- View the current processes, cpu and memory
top
- View the current free and available memory
free -m
- View the current mounts and free space
df
- View the size of the files and folders
du -sh *
- Simple GET request
curl -X GET "http://server:port/api/endpoint"
- GET with headers
curl -H "Authorization:Basic xxxx" -X GET "http://server:port/api/endpoint"
- POST call with params
curl -H "Authorization: Basic xxx" -H "Content-Type: application/x-www-form-urlencoded" --data "grant_type=password&username=test&password=secret&client_id=trustedService" -X POST http://localhost:50002/oauth/token
watch command
ipconfig
lsof -i:portnumber
- Using process id ( gracefully )
kill -9 processid
- Kill by process name
killall processname
You can get more details on the above commands at the following link