The Essential Linux Commands Every User Should Know

Mastering Essential Linux Commands

Linux is a powerful operating system that can be operated through the command line interface (CLI). In this document, we will explore some of the most commonly used Linux commands with examples.

Basic Commands

pwd

pwd stands for print working directory. It is used to print the current working directory.

Example:

$ pwd
/home/user

ls

ls stands for list. It is used to list the contents of a directory.

Example:

$ ls
Documents Downloads Music Pictures Videos

cd

cd stands for change directory. It is used to change the current working directory.

Example:

$ cd Documents
$ pwd
/home/user/Documents

mkdir

mkdir stands for make directory. It is used to create a new directory.

Example:

$ mkdir work

rmdir

rmdir stands for remove directory. It is used to remove an empty directory.

Example:

$ rmdir work

touch

touch is used to create a new empty file.

Example:

$ touch index.html

rm

rm stands for remove. It is used to remove a file or directory.

Example:

$ rm index.html

File Manipulation

cat

cat is used to display the contents of a file.

Example:

$ cat file.txt
This is the content of the file.

cp

cp stands for copy. It is used to copy a file from one location to another.

Example:

$ cp file.txt /home/user/Documents/

mv

mv stands for move. It is used to move a file from one location to another.

Example:

$ mv file.txt /home/user/Documents/

grep

grep is used to search for a specific pattern in a file.

Example:

$ grep "hello" file.txt
Hello, how are you?

wc

wc stands for word count. It is used to count the number of lines, words, and characters in a file.

Example:

$ wc file.txt
3 8 32 file.txt

System Information

uname

uname is used to display system information.

Example:

$ uname -a
Linux ubuntu 4.15.0-76-generic #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

top

top is used to display the system's resource usage.

Example:

$ top

ps

ps is used to display information about the running processes.

Example:

$ ps
  PID TTY          TIME CMD
  1234 pts/0    00:00:00 bash
  2345 pts/0    00:00:00 ps

Conclusion

These are just some of the most commonly used Linux commands. There are many more commands available, each with its own set of options and arguments. With practice, you can become proficient in using Linux commands to manage your files, directories, and system.