How to Ubuntu server terminal console

This post contains only some Ubuntu server console commands, important ones when working with files. No C Panel needed or w/e which is super useful if for some reason you don't have access to your server via (S)FTP, or you just want to use commands.


At this moment I live in Vietnam. We have apartment with internet access which runs trough another router and is complicated. Anyway I can’t use FileZilla or similar software to work on my server which doesn’t have any control panels. Therefore I have to use console commands.

After login become a root user: sudo su
navigate to a folder: cd /foldername
– if you want to go deeper then use: cd foldername
make a folder: sudo mkdir /parentfolder/foldername
– or if you want to make a folder in current directory: sudo mkdir foldername
change permission: sudo chmod 775 yourdirectory
delete a folder and everything in it: rm -rf foldername
delete everything in the folder, but not the folder itself:rm -rf /path/*
look at the file contents with: sudo ls -lha /path/
to just rename a file or directory type thismv /home/user/oldname /home/user/newname
move a file: mv file_name ~/destination
move a folder: mv -R directory_name ~/destination
create zip file by running: zip -r foldername
decompress ZIP file: unzip -d destination_folder
copy a directory or a file: cp -r /home/USER/folder /media/usb_stick/backup/folder
Restart services: sudo service SERVICENAME restart
– if you are on Serverpilot (like me) then the service names are nginx-sp, apache-sp, and phpX.Y-fpm-sp, where X.Y is the PHP version
Use unzip to extract a zip file and tar xzf file.tar.gz to extract a tar.gz file.


Please enter your comment!
Please enter your name here