Before going into the list of commands, let’s talk a little about Linux Shell.
What is Shell?
A shell is a command-line interpreter that takes commands from the user and provides an interface between the user and the operating system. It can directly invoke the Operating System Level APIs.
Shell is a programming language itself. It has its own capabilities of loops, conditionals, functions, arrays, etc.
Some of the popular shell examples are:
- Tcsh, etc
I personally use Zsh. It has many plugins like oh-my-zsh, zsh-spaceship, etc which makes it more powerful.
Most Commonly used Commands
Note that Linux commands are ASCII case sensitive. If you type
cd, the shell will throw error.
1. man command
It is used to read the documentation of tools. Whenever you need help, this command becomes such a handy tool.
For e.g. to see the manual of vim hit
$ man vim
2. vim command
vim is a terminal-based text editor. You can use it as your code editor.
3. chown command
chown the command allows you to change the user or group ownership of the file, directory, or symbolic link.
chown [OPTIONS] USER[:GROUP] FILE(s)
In the above example, cloudyfox is the owner of config.php. There are lots of other options you can pass into the chown command.
4. chmod command
In Unix-like operating systems, the chmod command is used to change the access mode of a file.
For e.g to make a file executable hit
chmod +x <filename>
5. ls command
ls to list the files and folder in the current working directory.
In the above example, the
ls command listed all the files and folder located inside ~/Documents.
6. pwd command
pwd to check which working directory you are in.
7. mkdir command
mkdir <directory name> to make a new directory or folder.
8. rmdir command
rmdir <directory name> to remove the specified directory. It won’t delete the directory if it is not empty.
9. touch command
touch <filename> to make a new file. For example, if you need
index.html a file then hit
10. cd command
cd <path to the location> change working directory.
11. cp command
cp <file> <path to destination> copy files from one location to another.
12. mv command
mv <file> <path you want to move move files or folder
13. cat command
cat <file> to display the content of files.
14. grep command
Grep is an acronym that stands for Global Regular Expression Print. Grep is a Linux / Unix command-line tool used to search for a string of characters in a specified file.
In this example, I searched for word editors in sample.txt and it is highlighted in red.
You can use these commands with many other options.
15. tar command
The tar command on Linux is often used to create .tar.gz or .tgz archive files, also called “tarballs.”
tar -czvf name-of-archive.tar.gz /path/to/directory-or-file
16. du command
du command, short for disk usage, is used to estimate file space usage.
In the example, it shows the disk usage of the directory Ebooks.
17. df command
The df command (short for disk free), is used to display information related to file systems about total space and available space.
kill command is used to kill the specified process in the Linux system.
$ kill pid
You can pass any options to kill command.
That’s it. These are the frequently used commands of daily Linux user. I use these commands almost every day in my job. And it really depends on what job you are doing. If you do an administrative kind of job, then there are so many command based tools like htop, top, netstat, ping, ifconfig, etc.