New
Top 20 Most-Used Linux Commands That Any Developer Should Know

Top 20 Most-Used Linux Commands That Any Developer Should Know

Linux is one of the fundamental skills for any IT-related job. Linux is a must-have skill. even though you are not an IT professional, you should be comfortable using a Linux computer or at least know the basic Linux commands. 

Why is Linux so important?  

The easy response to that is Linux is everywhere.  Even though Windows still holds its dominance in personal computers, Linux is the backbone of large enterprise servers and applications. Linux is in laptops, desktop computers, tablets, smartwatches, phones, smart appliances, IoT devices, and more.  

I am pretty sure you have at least one device in your house, even several that are powered by Linux. Another reason that makes Linux great. It’s because it’s open-source and widely available for free. Anybody can see and download the source course. 

They can modify and customize it to meet their own specifications from something simple as a smart light bulb to more complex infrastructure such as cloud computing.  In this article, I am going to go over 20 Linux commands you need to know to comfortably use a Linux computer even though you do not have an IT background.  

There are several Linux flavors or distributions with desktop applications with graphical interfaces to choose from but the true power of Linux remains in the command line. 

The command line is a text-based application that allows the user to interact with the Linux operating system using commands.  You can learn about Linux operating systems here

A command is basically a program or a script that runs and executes one or several functions. 

Anatomy of a Linux command.

First, you enter the name of the command you want to execute. Next, you enter the options and at the end, you should specify the target location. Where the command should perform the desired actions. It looks something like this:

In this example, we want to list all files and folders in the Documents directory. 

Now you know what a Linux command is and how to enter them in the command line(terminal). Let’s start exploring the list of the commands. 

Here the list of the Linux command is man

The first command I want to show you is the man command.  It is one of the most important commands in Linux and it will become very handy when working on the command line. Man stands for manual. It allows access to the manual page or document for a specific command right in the command line.  All you have to do is type man followed by the command you need help with.  And just like that, you have access to the manual page or documentation to that command in the command line. 

1-man

As you can see the man page has different sections containing different types of information.  For example ;

  • Name: Name of the command and its purpose. 
  • Synopsis: for command usage
  • Description: commande description
  • Option: list of different options available 

The man command is very useful because we cannot remember everything.  You can just run the man command to get info quickly in the command line. For the coming command feel free to use it to get more information about each one of them. 

2– whatis.

This is another useful and quick way to get information about a Linux command.  It just provides a brief summary of the command and what it’s used for in one or two lines.  

3- pwd.

That brings us to the third command which is pwd.  It stands for Print Working Directory.   In Linux, a directory is just a folder in comparison with windows.  pwd will alway print the current folder that you are currently working on. Knowing your current working directory is very important in Linux.   Here is a look of Linux’s files system. 

Everything starts from the root directory.  pwd will help determine where you are currently working in the file system. 

As you can see, I am currently working in the real_coder_linux directory or folder. 

4-ls

short for list. This command will list every  (files and folders) in the entered directory.   If no directory is entered, it will list everything in the current working directory.  For example:

If you want more information you can pass arguments to the ls command for example ls -l  for a long listing or ls-la to show hidden files and directories. 

5-cd

Cd stands for change directory. From time to time you would want to move from one directory to another.  In Linux, you can easily do that by using the cd command.   All you have to do is enter cd followed by the target directory.  Let’s say you are in the root directory and you want to get the Document folder and print its content. It can be done like this.

6-touch

The touch command is used to create new files.  You can enter touch followed by the target working directory and the file name. If not, a directory is provided. The file will be created in the current working directory. 

If I want to create a new file in Downloads from my current directory, i can do it like this

7-Clear

After working for quit. The termination becomes clouded. You want to clear everything and give yourself some space to work.  In Linux you can easily do that by running the clear command. 

8- cp

cp is used to copy and rename files.  You enter cp followed by fille location and name after you provide the destination and the new file name. 

In this example, I want to copy a file ‘log.txt’  from Documents to my current directory. 

9-rm

Rm stands for remove. It is used to remove or delete files.  Enter rm followed by the file name if it is in the same working directory or provide the file locate + plus the file name. 

In the example, we are going to remove the log.txt file

10-rmdir

rmdir is to remove or delete empty directories or folders. If the directory is not empty, you will get an error. In this case, you need to use rm -rf instead. 

File Manipulation

11-Cat

short form of concatenate. Sometimes you need to print the content of a file on the terminal.  Cat command is used to print the content of a file on the command line.   In the example, I want to print the content of the main.py file.

12- head

When working with a large file, sometimes you want to have an idea about the content of the file.  But you do not want to print the entire file in the terminal.  That the head command comes in handy.  You can use the head command to print the first few lines of the file. 

13-History

History is another useful command. Sometimes you want to print the history of the command you already entered. Maybe you want to rerun some of them. You can do that by using the history command. 

14- Tail

You can use the tail command to print the last few lines of the file.

15- less

The less command is used to print one page of the file on the terminal at the time.  Less is very useful when working with a large file with a lot of pages.

16-Sudo

Sudo is known as the “Super User DO” command in Linux. It is a very special command. It allows a user to execute tasks with admin privileges. Sudo allows a regular user to execute commands as the root user. By default, Linux does not allow regular users to execute certain tasks.  In order to do this, you need to use sudo or login as the root user.

17-Whoami 

Short for ‘who am i’  this command will print the current user username on the terminal 

18-passwd

If you ever want to change a user password, you can use the passwd command. Only root users can change passwords or you need to have sudo privilege and use the sudo command. 

19-wc

Short for word count. This command is very useful to count words in files.  You just enter wc followed by the name of the file.  It will output the number of lines, number of words, and number of characters

20-Grep

This Linux command is very useful for searching for specific patterns in files or directories. It will print all lines that match the patterns. Let’s say we are looking for the word ‘’Lorem”  in the text.txt file. 

There are a lot more Linux commands. We just go over the basics here.  But by mastering these commands you will be comfortable using any Linux computer.   Welcome to the Linux world. Learn more

1 Comment

  1. […] Top 20 Most-Used Linux Commands That Any Developer Should Know […]

    Reply

Leave A Reply

Your email address will not be published. Required fields are marked *