Top 25 Linux commands – You must know

1) cd (Change Directory)

This command is used to navigate through directories. 

Example: cd softwares/

Output:

2) pwd (Print Working Directory)

This command is used to print current working directory. It will print the full system path of the current working directory to standard output.

3) ls (short for list)

This command is used to list files and folders of the current directory in which you are working on. The ls command is probably one of the most widely used commands in the Unix world.

4) chmod (Change mode)

This command is used to change the access permission (read, write and access) of a file according to mode. Mode describes the permissions to modify and can be specified with octal numbers or with letters. We can use the ls -l command to check file permissions.

Example:

chmod {PERMISSION} {FILE}

chmod 400 sample.txt 

chmod 200 sample.txt

5) chown (Change owner)

This command is used to change the user and/or group ownership of a given file, directory, or symbolic link.

Example:

chown {USER} {FILE}

chown john sample.txt samples

chown USER:GROUP FILE

chown john:john sample.txt

6) echo

This command is used to display line of text/string that are passed as an argument. This command is mostly used in shell scripts and batch files to print text to the screen or a file at certain point.

7) exit

This command is used to log out of a virtual console. If your shell window has multiple tabs then this command will close that tab where it is executed.

8) top

This command is used to monitor currently running processes and the system resources they are using. It provides a dynamic real-time view of the running process of your system.

Note: Press ‘q’ to exit from the top command.

9) touch

This command is used to create new empty files. You can create multiple directories at once using a single command by adding space between directory names.

10) mkdir(Make directory)

This command is used to create or make new directories. You can create multiple directories at once using single command by adding space between directory names. 

11) tar(Tape archive)

This command is used to create an archive of multiple files and folders into a single archive file commonly called tarball or tar, gzip and bzip in Linux. 

Command: tar -cvf {new file name.tar} {folder name}

12) tail

This command is used to print the last few numbers of lines of a certain file. 

13) sudo (Superuser Do)

The sudo command is designed to allow users to run programs with the security privileges of another user, by default the root user. That means, it is used to execute a command with elevated privileges (usually as root).

Command: sudo {command}

Example:

sudo touch sample.txt

sudo apt-get install nano

14) find

This command is used to search and locate the list of files and directories based on criterias you specify. Find can be used in a variety of conditions like you can find files by permissions, users, groups, file type, date, size, and other possible criterias.

Command: find [where to start searching from]

 [expression determines what to find] [-options] [what to find]

Example: 

15) history

This command is used to see all typed commands in terminal. You can use UP and DOWN arrow keys of your keyboard to walkthrough towards backward and forward commands respectively that you have used.

Command: history

16) kill

This command is used to terminate processes manually. While working on a Linux machine, you’ll see that an application sometimes becomes unresponsive. Then in those cases, terminating manually is the only way out. 

Example:

kill -9 {process id}

kill -9 3213

17) man (Manual)

This command is used to display the user manual of any command that we can run on the terminal. man displays the data using a pager, a type of program that shows files on text-based terminals one screen at a time.

Command: man {command name}

Example:

18) shutdown

This command is used to shutdown a system in a secure way. You can shutdown the machine immediately or schedule a shutdown using 24 hour format. When the shutdown is initiated, all logged-in users and processes are notified that the system is going down, and no further logins are allowed.

Command: shutdown -h {time in minutes}

Example: shutdown -h now

Command: shutdown -h 1

19) mv (move)

This command is used to move one or more files or directories from one place to another. If both filenames are on the same path, this results in a simple file rename; otherwise the file content is copied to the new location and the old file is removed.

Example: Here, I am moving sample.txt from /home/john/softwares to /home/john.

20) passwd

This command is used to change the password of a user account. A normal user may only change the password for their own account, while the superuser may change the password for any account.

Command: sudo passwd {username}

Example: 

21) ping (Packet Internet Groper)

This command is used to to test the reachability of a host on an internet protocol network. It also helps you assess the time it takes to send and receive a response from the network.

Example: ping google.com

22) cp (Copy)

This command is used to copy files and directory from one destination to another directory.

Command to copy file: cp {filename} {destination path}

Command to copy folder: cp -r {folder name} {destination path} 

23) locate

This command is used to find the files by name. The locate command is the quickest and simplest way to search for files and directories by their names.

24) netstat (Network Statistics)

netstat is a command-line network utility that displays network connections for Transmission Control Protocol, routing tables, and a number of network interface and network protocol statistics. netstat is powerful and can be a handy tool to troubleshoot network-related issues and verify connection statistics.

25) service

This command is used to start or stop a service by running an initialization script.

Command: service {app name} {command} 

Note: Press ‘q’ to exit from the top command.

Did you enjoy this tutorial? Please like and share this post with your friends and colleagues. It will help and motivate us to post articles with quality content.

You May Also Like

About the Author: softwaretrickadmin

I am a professional software developer and founder of softwaretricks.net. I have a passion for troubleshooting and solving software problems on Windows and Linux. I love to write articles for installation steps and troubleshooting software problems. I am always ready to accept challenges!!