20 Basic Ubuntu Commands For Beginners

If you are a Windows user who wants to learn Linux, Ubuntu is a good choice as it is one of the best Linux distro for beginners. Your initial experience on Ubuntu won’t be very strange. But, if you want to feel the true power of Linux, you’ll have to learn about how to make use of its command line interface. Initially, you will have some difficulties mastering lots of commands. As much as using the commands won’t turn you into a genius, it will help you execute some basic and core actions. To help you have a smooth start, here are the 20 basic Ubuntu commands for beginners.

Basic Ubuntu commands

Note: Each command has its own additional parameters to extend its functionality but in this article, we won’t go into that much detail. Consider it to be a basic introduction to the basic Ubuntu commands.

1. mkdir (Make Directory)

One of the common actions that you may want to take is to create a new folder or even go a step further to create a subfolder. To perform these functions, you will have to use the mkdir command and type the name of the folder after it.


root@server:/# mkdir test

This command will create test directory at the root directory of your server.

2. ls (List)

ls command stands for list. You will use it whenever you want to see everything that is in your directory. It will display all the files and folders that exist in the current directory that you have opened. To use it, just type the directory name then follow it up with the ls.


root@server:~# ls

This command will list all the files and folders that are in the server’s root directory

sys/ test/ tmp/ usr/ var/

3. cd (Change Directory)

cd is a command for changing a directory in the terminal. It is one of the basic Ubuntu commands that you cannot avoid, no matter what. To use it, you simply need to type the name of the folder that you want to move to.


root@server:~# cd /test

now you’re inside test directory


Basic commands to remember:

  • root@server:~# cd / this will open the root directory.
  • root@server:~# cd .. open one level up directory.
  • root@server:~# cd - will open the home directory

4. cp (Copy)

This is the most obvious command, whether you are a newbie or not. It stands for copy-and-paste. It will come handy when you want to organize your files on the computer. To use it, you need to know the file name and the target destination where you will paste it. If the file that you want to copy and paste requires permission from the root, then you will have to use the des command.


root@server:/test# cp t1/* t2

This command will copy all the files from t1 folder into folder t2.

Also, Read: Important Advanced Linux Commands for Programmers

5. sudo (SuperUserDo)

This command stands for SuperUserDo. It is also a basic and an essential command for the Ubuntu newbies. You will always use it when typing other commands that require to gain permission from the root (if you are not a root user). You simply need to place this command before the command that you want to execute with root permission.


vicky@server:~$ sudo service apache2 restart

This command will let you restart the web server with root permission. However, you’ll have to enter your password for once.

6. rm (Remove)

The rm command is used for removing files and directories from their current location. You should use -f if the file requires permission from the root and -r if you want to perform a recursive removal of the folder.


root@server:/test# rm -rf t2

This command will delete the t2 directory and all its content from the test directory.

7. find (find)

Sometimes you may need to use a file but you can’t find its exact location or remember its path, use the find command. It will help you to find that file with ease. You only need to type this command then add some keywords about the file.


root@server:/test# find t1

As you can see it found everything related to t2 in the test directory

8. poweroff (Poweroff computer)

This command lets you switch the computer using the Ubuntu terminal. It is an ideal option for turning a computer off without using the mechanical method. if you are not a root user, you should type sudo command before typing poweroff.


root@server:/test# poweroff

and the system will shut down

9. Cat (concatenate)

One of the common things that you may intend to do is to inspect texts and codes in your script. The cat command is used for viewing those texts and even codes that are in a particular file that you have opened.


root@server:/test/t1# cat hello.txt

Hi, This is for testing only

The above command is showing the text that was inside the hello.txt file.

10. Pwd

When using Ubuntu, it is always prudent to the current directory that you are working on. This will help you to know where you will go next. pwd is the best command for doing this job. It will print your current directory.


root@server:/test/t1# pwd

the above command is showing the directory in which you are right now.

11. mv (Move/rename)

You will need this command whenever you want to move your file to a different location or give it a different name. When it comes to renaming, you need to type both the old and the new name. Remember to start with the des command for files that require permission from the root.


root@server:/test# mv t1/* t2
root@server:/test# mv t2 test2
root@server:/test# ls
t1 test2

In the above example first command will move all the files from t1 to t2 and the next command will change the name of t2 folder to test2

12. rmdir (Remove directory)

Apart from removing files, you may also need to remove a directory. This is the command for doing this job. If you want to remove a directory named t1, just type “rmdir t1”.


root@server:/test# ls
t1 test2
root@server:/test# rmdir t1
root@server:/test# ls

The command rmdir t1 successfully deleted the directory t1 from test directory.

13. touch (Create blank file)

The touch command is used for creating blank files in the Ubuntu terminal. It can be compared to the mkdir command for directories. You can use it to create a file in any directory that you want.


root@server:/test/test2# touch empty.txt
root@server:/test/test2# ls
empty.txt hello.txt

The above command has created an empty text file named empty.txt under test2 directory.

14. apt-get (Download, install, and update software)

You will need this command when you are trying to install a software that you want to run in your Ubuntu PC. Apart from the installation, you will need this tool when upgrading and uninstalling your software. Since most of these actions will require to get permission from the root, you will always have to start by typing the sudo command.


root@server:/# apt-get install apache2

This command will install apache web server on your ubuntu os. you can also use apt-get command to update the system.

root@server:/# apt-get update

15. free (check free ram)

You can use this command to check the amount of free and used RAM in your computer.


root@server:/test/test2# free
total  used  free shared buff/cache available
2097152 598076 1417768 232288 81308 1424127

The above command showing how much ram is being used and available.

16. df (Disk space)

As a normal computer user, it is prudent to check the disk space that is available in your operating system. df is the command for checking disk usage in your Ubuntu. It is usually used along the -h parameter.


root@server:/test# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/simfs 95G  2.3G  93G  3%   /
devtmpfs   1.0G 0     1.0G 0%   /dev
tmpfs      1.0G 0     1.0G 0%  /dev/shm
tmpfs      1.0G 99M   926M 10%  /run
tmpfs      5.0M  0    5.0M 0%  /run/lock
tmpfs      1.0G  0    1.0G 0%  /sys/fs/cgroup
none       1.0G  0    1.0G 0% /run/shm

The above command shows which file system is having how much disk space, how much is available and where it is mounted.

17. Chmod (Change Permission)

chmod is an important command that you can use to change file and directory permissions. These permissions include read, write and execute. You need to type chmod, followed by the specific permission then the filename or folder.


root@server:/test# chmod 755 test2

This command will grant Read + write + execute permission to the User and read +  execute permission to the group and everyone else. Learn more about file permissions here.

18. du (Directory usage)

du command displays the size of a directory and all of its subdirectories.


root@server:/test# du
8  ./test2
12 .

19. service (Run System V init scripts)

Service command is very useful command for running, stopping or restarting System V init scripts that are stored inside/etc/init.d directory.


root@server:~# service apache2 restart

This command will successfully restart your apache server.

20. <command name> -–help

This command will provide you all the details about the command you are running and the parameters associated with it


root@server:/test# mv --help
Usage: mv [OPTION]... [-T] SOURCE DEST
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.

This above commands explain the working of mv command and list all the parameters associated with it.


Mastering all these basic Ubuntu commands may be hectic to a newbie. It is important that you start practising them daily. Once you are able to use these basic commands, you will have a smooth time graduating to the advanced Ubuntu commands.

4 thoughts on “20 Basic Ubuntu Commands For Beginners”

  1. The command “cd -” opens the home directory. The same as “cd ~”
    The command “cd ..” opens the directory above the current directory

  2. It is not even “Commands” but applications. Every time you name an app, a binary object is started, gets a “Pid”, stdin, stdout and stderr assigned, and well object /bin/ls” is started. This can be replace by a shell “alias” – but get things correct now: “bash” is a shell – not a command, and the Bash shell is what you run on a Terminal emulator, that is “fork -ed” off a Launcher – X/windows manager. – “wdm”. Now when you start the bash shell, this will set a number of “variables” and allow you to make your own variants. These will be used when you type something replace replace whatever you typed to what the variable expand this to e.g. make “ll” to “ls -l” – use a shell alias of string substitution or both. Then you have some “predefined” variables, like HOME that should contain your home directory, “path” tells the shell where to look – e.g include “./” and it will search current directory for your variant of “ls” and use this. Otherwise, current directory os not searched for binaries. Please learn the difference between “shell” and Windows CLI. Make script files and show how to use the shell!


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.