7 Important Linux Commands for Every Linux User

 


Linux might sound scary for first-time Linux users, but actually, it isn’t. Linux is a bunch of open-source Unix operating systems based on Linux Kernel. These operating systems are called Linux distributions, such as Fedora, Debian, Ubuntu, and Mint.

Since its inception in 1991, Linux has garnered popularity for being open-source. People can modify and redistribute Linux under their own brand. When using a Linux OS, you need a shell to access the services provided. Also, it’s recommended to run your Linux OS through a CLI or command-line interface. CLI makes time-consuming processes quicker.

This article presents a guide to 7 important Linux commands for every Linux user to know. So, let’s begin.

cat Command

cat is the shortened form of “concatenate”. It’s a frequently used multi-purpose Linux command. This command is used to create, display, and copy a file content on the standard output.

Syntax

cat [OPTION]... [FILE]..

To create a file, type:

cat > <file name>  

// Enter file content

To save the file created, press Ctrl+D. And to display the file content, execute:

cat <file name>

cd Command

The cd command is used to navigate through the directories and files in Linux. It needs either the entire path or the directory name depending on the current directory.

Syntax

cd [Options] [Directory]

Suppose you’re in /home/username/Documents. You want to navigate to a subdirectory of Documents which is Photos. To do that, execute:

cd Photos

To move to an entirely different directory, type cd and then the directory’s absolute path.

cd /home/username/Movies

The above command will switch to /home/username/Movies. Apart from this, the commands, cd.., cd, and cd- are used to move one directory up, to go to the home folder, and to go to the previous directory respectively.

Reminder: Linux’s shell is case-sensitive. So, make sure you type the name’s directory as it is.

echo Command

The echo command displays a line of text or string passed as an argument. It’s used for the purpose of debugging shell programs in the Linux terminal.

Syntax

echo [Option] [String]

Other examples of the echo command are:

  • echo "String": This displays the string within the quotes.

  • echo -e "Learn \nBy \nDoing": Here the ‘-e’ tag allows the echo command to understand the backslash escape sequences in the argument.

sudo Command

sudo stands for “SuperUser Do”. The sudo command helps you perform tasks that require root or administrative privileges. 

Reminder: It’s not advisable to use this command daily because an error might occur if you did something wrong.

Syntax

sudo [command]

The sudo command can be used with -h, -V, -v, -l, or -k options used to help, version, validate, list, or kill respectively. 

Another example is, suppose you want to edit viz.alsa-base.conf file that needs root privileges. For this the command would be:

– sudo nano alsa-base.conf 

To enter the root command-line, type:

sudo bash

Then enter your user password. 

history Command

After using Linux for some time, you’ll notice that it’s pretty easy to run hundreds of commands every day. The history command shows all the previously used commands within the bash terminal. With history, you can review the commands you have entered earlier.

Syntax

history

Now try running history and check all the Linux commands you have entered so far.

ping Command

The ping command helps check if your connection to a server is well established. Ping is a computer administration software utility that checks the host reachability on an IP (Internet Protocol).

Syntax

ping [option] [hostname] or [IP address]

Suppose, you want to test if you can connect to the Google server and come back. For this, simply type:

ping google.com

If the above command pings the Google server, you can be sure that the internet connection is fine.

Reminder: Use Ctrl+C to stop pinging. Otherwise, it will continue sending packets.

locate Command

The locate command helps to search a file by its name. Its functions are very similar to the find command. The only difference is that, the locate command searches the file within the database; whereas, the find searches it in the file system. Also, locate works faster than find. Keep your database updated to apply the locate command on it. 

Syntax

locate <file name>  

Conclusion

In this article, you have learned about 7 important Linux commands. Hope my article helps you execute your tasks quickly and efficiently.

Suparna is a freelance writer who writes about Linux including tips, tricks, and how-tos.

Next Post Previous Post
No Comment
Add Comment
comment url