Super Essential Ubuntu Terminal Commands

Super Essential Ubuntu Terminal Commands

Recently I started setting up Jenkins server in Ubuntu 16.04.3 machine. Check out this article if you are interested in the Ubuntu Jenkins master setup. I will start with the Ubuntu terminal commands that I found super essential.

Folders and files manipulation

man Display help for any command. Example: man ls

lsLists current folder contents.

cd /var/lib/jenkins Change the current directory to /var/lib/jenkins. I found it very confusing initially that in Windows the paths are with back slash \, but in Ubuntu the paths are with forward slash /.

cp -a /foldertocopyfrom/file /foldertocopyto Copy files or folders. You should have permission for the destination folder.

sudo rm -f jenkins.logDelete the file jenkins.log.

sudo chown -R jenkins:jenkins /var/lib/jenkinsChange the owner of the directory /var/lib/jenkins to user jenkins and group jenkins. R option will change the owner recursively for all folders and files that are inside the specified one. Useful when you receive Access Denied error.

sudo chmod -R 644 /var/foldername 777 code would mean that you give access to everyone to read and write in the folder, which is generally a very bad security practice. You can read more about permission codes here.

stat /var/lib/jenkinsDisplay infomation about the owner and permissions for the file or folder.


sudo apt-get install jenkinsInstalls the package jenkins.

sudo apt-get install jenkins=2.89.3 Just put your preferred version in the place of 2.89.3.

sudo apt-get update Updates all packages.

sudo apt-get upgrade Upgrades all packages.

sudo apt-get upgrade jenkins=2.89.3 Upgrades package to a specified version.

jenkins --versionSee the Jenkins server version.

lsb_release -a Display the Ubuntu version.

whereis gitDisplay git location

Jenkins Service

sudo service jenkins start Starts Jenkins service.

sudo service jenkins stopStops Jenkins service.

sudo service jenkins restartRestarts Jenkins service.

sudo service jenkins status Shows Jenkins service status.


watch -n 5 free -mSee used and free RAM memory.

df -hSee hard disk usage.

sudo du -hxd 1 / 2>/dev/null | sort -hrDisplay hard disk usage sorted by folders size.

timedatectlCheck date and time and if there the time is not correct use:

sudo timedatectl set-timezone EET Put your time zone in the place of EET.

sudo rebootWhen you see message “System restart required”, it is time to reboot your machine.


If you receive unexpected error when you are entering commands in the terminal, you could remember case sensitivity could be the issue. For many of the commands you may need root access. If this is the case put sudo (SuperUserDo) before the command.

I presented you Ubuntu terminal commands that I find most essential and useful. They are a great start for your Linux Ubuntu journey.