You are currently viewing 30 Basic Ubuntu Commands You Must Know

30 Basic Ubuntu Commands You Must Know

Are you a beginner and just installed Ubuntu to learn command line Arguments? If yes, you might be searching for Ubuntu basic commands. Here I am sharing some common commands that every beginner learner must try.

About Ubuntu

Ubuntu is a Linux distribution based on Debian. It is open-source software initially released in 2004. Canonical Ltd. developed and maintained it. There are several releases of Ubuntu, such as stable release, unstable and Long Term Support (LTS).  Ubuntu supports both Command Line Interface (CLI) and Graphical User Interface (GUI) to perform various tasks on the OS. In this article, we will demonstrate the use of 30 basic commands of Ubuntu using CLI. You can download ubuntu from here.

30 Basic Commands of Ubuntu

We will explain all the basic ubuntu commands one by one.

Let’s get started!

Open the terminal by pressing “Ctrl+Alt+t” from your keyboard.

Command 1: date

The date command is used to print the current date on the terminal. The command of date is written below along with the result of that command.

ubuntu date command

We can also display past and future dates by using the –date option. Below is the representation of this command.

date tomorrow cmd

Command 2: cal

The cal command is used to show the calendar of the current year but you can face the below error.

cal error
cal error

 

To fix this error you need to install a new package ” ncal “. And to install this package you have to give the administrator authority by writing “sudo” before the package. here is the implementation of the package.

Now you can use the “cal” command on your terminal.

cal also provides the functionality to get the calendar of any year just by specifying the year.

e.g: cal 2030

e.g: cal 2050

 

Command 3: pwd

This command refers to the present working directory in which you are operating. It shows your current terminal directory. To check PWD, execute the pwd keyword in your terminal and hit enter; the command of PWD is written below along with the result of that command.

 

Command 4: dir

This command is used to print all the available directories in the present working directory. The dir command can be executed as shown below:

ubuntu dir command

 

Command 5: ls

This command is used to list down all the directories and files inside the current working directory; the ls command can be executed as shown below:

ls command

The ls command supports various flags to show more detail related to directories. You can explore them by yourself.

Command 6: cd

The “cd” command is one of the most used commands of Ubuntu; you can change the directories in the terminal using this command. For example, the following command will change the current dir to Download.

cd ubuntu command

 

We can use his command to change the present directory to root or home. To change directory to root. For instance, we are in the Download directory and want to switch to the root directory:

cd change to root

 

Command 7: touch

The touch basic ubuntu command is used to create a new file or to change the timestamp. The command given below will create a new python file :

touch ubuntu command

 

If the file is already present then the touch command will change the timestamp to the current time. Here is the execution of the command:

 

touch change timestamp ubuntu

 

Command 8: cat

The cat command is used to show the content of any file: For instance, the following command will display the content inside “PythonFile.py”:

 

ubuntu cat command

 

Command 9: mkdir

The mkdir ubuntu command is used to make a new directory in pwd (Working directory). For instance, the following command will make a new dir “mkdir OS”:

mkdir ubuntu command

 

Command 10: rm

The rm command is used to remove the specific file from the directory. For instance, the below-mentioned command would remove the “PythonFile.py” file from the pwd:

rm ubuntu command

 

Or you can remove the empty directory, as the command given below will remove the “OS” directory:

 

remove dir command

 

Command 11: cp

The cp command will help you to copy any file or folder to any directory;

To copy a file1.txt to TextDirectory:

cp ubuntu command

 

if you want to copy the complete folder then use option “–r”

copy folder using cmd

 

Command 12: mv

You can use this command to move files around the computer or rename the file: the command given below will move the “Testfile.txt” to “TestDirectory”:

mv command
If the file is already present in any directory then it will rename the file;
mv ubuntu commands

Command 13: head

The head command in ubuntu helps you to get the first ten lines of a text file; for instance, the following command will help to get the first ten lines of the “Test. text” file:

 

head command ubuntu
head command ubuntu

 

Command 14: tail

The tail command in ubuntu helps you to get the last ten lines of a text file; for instance, the following command will help to get the first ten lines of the “Test. text” file:

 

tail command ubuntu
tail command ubuntu

 

Command 15: uname

The uname command is used to get the release number, version of Linux, and much more. The “-a” flag is used to get detailed information.

 

uname command

 

Command 16: wget

The wget command is used to download anything from the internet. For example, wget and then paste the download link.

Command 17: history

The history command shows the list of all command that you previously executed.

history ubuntu command

And you can execute any of the listed commands. For instance, if you want to execute the 282 command (which is uname), then you have to write “!282” to get the result of that command:

history command

 

Command 18: apt

The “apt ubuntu command” is one of the most important and most used Ubuntu command that works with Ubuntu Advanced Packaging Tool (APT); you can use this “-apt-get” or “-apt” to install or remove packages. The “apt” requires sudo privileges to successfully execute the command.

Below is the syntax of  installing vlc media pyaler command:

sudo apt command

And to delete vlc player package :

apt remove command

 

Command 19: grep

With the help of grep, you can search for a pattern in which a specific word lies; for instance, the command given below will print all the lines that contain “10” from “test.txt

grep command ubuntu

 

Command 20: man

The man command of ubuntu will help you to get the complete user manual of any specific command; for instance, the following command will list down the detailed usage of the “date” command:

man command in ubuntu

 

 

Command 21: ps

Using the -ps ubuntu command, you will be able to get the list of processes.

ps command line

 

Command 22: zip and unzip

You can convert your files to zip archive with the help of “gzip” command; moreover, a zipped file can be unzipped by the “gunzip” command:

gzip ubuntu command

You can unzip the “test.txt” as shown below:

unzip command
unzip command

 

Command 23: hostname

This ubuntu command will print your hostname on the terminal:

ubuntu hostname command
ubuntu hostname command

 

Command 24: iwconfig

The iwconfig command is used to set the parameters of the network interface which are specific to the wireless operation (eg. frequency, SSID). You need to use external wifi adapter to see all the details.

ubuntu iwconfig command

 

Command 25: ping

You can use the ping command to check the connectivity to your server; for example, the command below will ping to Google and also prints the response time:

google ping ubuntu command

 

Command 26: w

This ubuntu “w” command will display the user details that are currently logged into the system.

w ubuntu command

 

Command 26: Ctrl+c

Sometime you are installing any package and it is taking a lot of time then you can abort/stop the process by pressing “Ctrl+c” from the keyboard.

ctr+c command

 

Command 26: useradd

Ubuntu supports multiuser access; if you want to add another user to your system, execute the following command to do so:

useradd commend in ubuntu

Or you can delete the user also;

userdel command

 

Command 27: passwd

You can change the password of your Ubuntu user with this command line. You need to pass the username to passwd command to change its password.

passwd command in ubuntu

 

Command 28: cmatrix

You might have seen the Hollywood movie ‘matrix‘ and would be fascinated with the power, Neo was provided with. You can do this jut by following below commands;

After installing this package type “cmatrix” and boom !

Command 29: exit

The exit command in ubuntu and linux is used to close the terminal.

exit command in ubuntu

 

Command 30: reboot

You can reboot your device with reboot command in ubuntu. The “reboot” requires sudo privileges to successfully execute the command.

Conclusion:

I hoep this guide helped you to learn some basic ubuntu commands. These command were the most commonly used everywhere.Command-line interface (CLI) is the basic utility of any machine; you can use it to perform multiple tasks in daily life. CLI can be used to operate the entire OS without GUI.

If you still have doubts, I will be here to assist you 😉. You can contact me on my facebook and Linked In too.

I loved command #28 and which one is your favouite; let me know in the comment box !

This Post Has 2 Comments

  1. Molvi

    Very informative

Leave a Reply