Getting Started With Basic Linux Commands

Linux operating system (OS) comes with lots of different commands that you can apply using a command line interface (CLI). These commands will greatly help you in managing your work effectively, and you can save time. Several useful commands can be used to gain more control over your system, unlike other OS like Windows.

Now we’ll start with a detailed explanation of the above and will show you the top 20 Commands to get you kickstarted in Linux.

Top 20 Commands to Help You Get Started with Linux

In this section, we’d list the top 15 most used commands that will help users through their journey in the Linux world. Let’s get started with the first command:

1. The sudo Command

sudo stands for “superuser do”, which is the same as an administrator in Windows, and it gives you the rights to do the tasks that a normal user can’t do. It is used like this:

$ sudo whoami

As you can see in the above example, we’ve used the same command, “whoami” one with sudo and one without it; what difference is there? The “itslinux” user can only do basic level commands, while root can do anything in the system.

Note: You’d be asked to enter the current user’s password after executing a command with sudo.

2. The ls Command

The ls command is used to view a list of directories (folders) and files, so you don’t need to worry about a file or folder being lost somewhere in the system. You can use it by executing this command.

$ ls

Here, the blue color shows the directories while the white is a simple text file, and the red is for the archive file.

3. The mkdir Command

To create a new directory/folder in Linux, the most widely used method is to execute the mkdir command, but it doesn’t overwrite the previous file with the same name; it is used like this.

$ mkdir Testa

In the above command, a new directory will be created with the name of “Test”.

4. The cd Command

While working in Terminal, you’d often feel stranded in one directory known as “Home” and cannot move into other directories. To do that, users must use the cd command to navigate the system freely. For example, we will navigate to “Documents” using the cd command like this.

$ cd Documents

Users can replace Documents with any directory they wish to navigate. Additionally, cd can be used with an absolute path.

5. The cat Command

The cat command is generally used to read the content of either single or multiple files by following the syntax mentioned below.

$ cat test1
$ cat test1 test2 test3

As seen in the above image, we’ve concatenated the contents of three files in the terminal using the cat command.

6. The rm Command

The rm command is used to delete the specified files and directory as shown below:

$ rm test3

Now, to delete the folders/directories, there is a slight change in the syntax with the addition of “-r” in the command like this.

$ rm -r Test

As seen in the above image, after executing the rm command with “-r”, we’ve deleted a directory named “Test.”

7. The touch Command

The touch Command of Linux is used to create a new text file in the current directory, and its syntax is as follows.

$ touch newfile

The above image shows how a touch command works to create a new text file which can later be edited for further use.

8. The gzip Command

The gzip is more like a command-line tool used to zip (archive) larger files into a single compressed file with a much smaller size, saving disk space and bandwidth if you want to send it. To compress the file(s), use this format of gzip Command of Linux.

$ gzip 1 2 3

In the above example, we’ve compressed three files with the names “1, 2, 3” and mentioned the newly created compressed files.

9. The grep Command

To filter out the text files based on different options, the grep command is widely used to view only the required text, as seen below. However this may look a bit difficult, but once you get a hold of it, there’s no stopping you from filtering the required text to be read.

$ grep -v “it” test

And here are the original contents of the file we’ve just filtered.

$ cat test

In the above two images, we’ve shown every line that doesn’t have the “it” in it, and only one line stood out. It will filter out every word that has the “it” in it, including the “website” which is seen.

10. The sort Command

To view the unsorted text file(s) as sorted, Linux has a sort command that can sort the data in the terminal but doesn’t manipulate the file’s original contents. Although there is an option to create a new sorted file which we’ll do here in this syntax:

$ sort -o sort test

As we did in the above image using the sort command, every line of the text is sorted.

11. The ifconfig Command

In Linux, a command known as ifconfig allows the users to view the information regarding the network they’re currently connected to, including IP address, MAC address, and much more. It is used like this.

$ ifconfig

The ifconfig command, as mentioned above, displayed almost every presentable detail on the network we’re connected to.

12. The top Command

The “top” command of Linux shows the live statistics of the processes of your CPU, including memory usage, User, and much more. It is like a CLI version of the task manager from Windows and can be opened using this command.

$ top

Using the “top” command, users can see which process consumes how many resources a process is using and view the free and available memory, as seen in the above image.

13. The ping Command

A ping command in Linux is used to check if a server is reachable quickly, as well as troubleshoot connectivity issues. For example, we’d see whether Google’s server is reachable using this command.

$ ping

See the output and check if there are bytes received from the server. If they are above zero, it is reachable. Otherwise, it isn’t.

14. The chmod Command

The chmod command of Linux is used to change permissions of a file required in scripting so if you are into creating scripts, use this command on your files.

$ sudo chmod 774

In the above image, we’ve changed the permissions of “” which is a script file, and 774 means 744 read, write, and execute.

15. The cp Command

Using the cp command, Linux users can copy a file or a directory from one location to another; although it is easier in the GUI method, some users like to stick with the command line. To move a file, we’d use this command.

$ cp Downloads

In the above image, there isn’t any message shown, which in most cases of Linux means work is done successfully, and we’ve copied a file named ‘’ into the Downloads. Now using the following command, you can copy one directory along with all its contents to another directory.

$ cp -r Music Videos

Using the above command, we’ve copied the Music directory and all its contents to the Videos directory, and you need to change the names of the files/directories as per your requirements.

16. The mv Command

The mv command of Linux is used in two ways which include

  • Renaming a file or folder
  • Moving file(s) to other directories

First, let’s discuss the renaming part where we’d rename a file called ‘’ to ‘’, and here’s the command it uses.

$ mv

As seen above, we’ve renamed the file ‘’ to ‘’, which is then confirmed using the ls command. Now let’s move a directory with its contents to another directory using this command.

$ mv Folder Music

The above image shows the execution of the move command using which we’ve moved ‘Folder’ to ‘Music’ and then using the ls command; we’ve checked the contents of Music to confirm.

17. The systemctl Command

The systemctl Command of Linux is used to manage the services, which is one of the fundamental operations of a system administrator. Using this, you can start, stop, restart, or check the status of a service in Linux. Here’s how it works.

$ sudo systemctl start apache2.service

In the above image, you can see that we’ve executed two commands, one for starting the apache2 service and the other for checking the status of the service. Now if you want to stop this service, use this command.

$ sudo systemctl stop apache2.service

As seen above, we’ve stopped and checked the status of the apache2 service, and it turned out to be stopped.

18. The curl Command

The curl command of Linux comes in handy when the users want to transfer data between the server(s) and client(s) by means of many supported protocols and check the contents of a webpage. This tool is used for automation as it has the ability to work without user interaction because it can transfer a large amount of data through multiple files at once.

For example, we’d see the contents of; the following command is to be executed.

$ curl

Similarly, any website content can be retrieved using this utility.

19. The wget Command

The wget is quite useful and is used as a non-interactive command-line tool to download files from the internet that can even work in the background. Let’s download a file using the wget command by executing this command.

$ wget

The file will be downloaded with all the files packaged with it.

20. The chown Command

The chown command of Linux is used to change ownership of a file or a directory, and this is useful for the administrators to manage their company’s resources regarding the assets and databases. Here’s an example of us changing the directory ownership of a directory called ‘new1’ to the user ‘testu’ using this command.

$ sudo chown -R testu new1

As seen above, the original owner is ‘itslinux’, and using the chown command, we’ve changed the ownership to the user ‘testu’.

These commands will make a novel Linux user a head start.


Specific commands are needed to be learned to operate the Linux system, and for new users, it is highly recommended to get through them at least once before working around them, as it’ll be beneficial. This guide teaches about those 20 commands to get started in Linux.