Useful command for Linux
Published in
1 min readJun 10, 2018
When I have to connect to my server on VPS or AWS EC2, I forgot some command I have to googling every time, then I decided to notes it and put it to ONE place. That’s why I wrote this post.
SFTP Command
Connect with SFTP
sftp -i /path/to/pem-file user@ip-address
# with option port=xxx
sftp -i /path/to/pem-file -o "port=xxxx" user@ip-address
Download a file/folder from server
# download a file from server
get myfile.txt
# download a folder
get -r myawesomeFolder
Upload a file/folder to server
# upload a file
put myfile.txt
# upload folder
put -r myFolder
Change / list directory
# display local directory (aka ls for local)
lls# change directory for local machine
lcd# display directory (on server)
ls# change directory for server machine
cd
File System
Display free disk space with
df -h
Display total size of directory
du -hs /path/to/directory# total size of current directory
du -hs .
Find largest directories (10 items)
du -hs * | sort -rh | head -10
Happy Coding ❤️