Linux Commands Cheat Sheet 2022

Linux is the home to open-source Unix operating systems based on the Linux Kernel. They include Ubuntu, Fedora, Debian, OpenSUSE, and Red Hat. Using Linux to manage a Virtual Private Server (VPS) is common practice.

What do you mean by Linux Commands?

A Linux command is a program that runs on the CLI(a console that interacts with the system via texts and processes). It’s similar to the Command Prompt application in Windows.

Linux commands are executed on a Linux terminal by pressing Enter at the end of the command, we can run the commands to perform various tasks.

Syntax: CommandName [option(s)] [parameter(s)]

Here, we are listing some basic Linux commands:

1. sudo commandThis command performs tasks that require administrative or root permissions.
2. pwd commandThis command is used for printing the current working directory.
3. cd commandThe cd command in Linux is known as the change directory command
4. ls commandThe ls command is used to list files. “ls” on its own lists all files in the current directory except for hidden files.
5. cat commandThe cat command is used to create single or multiple files, view the content of a file, concatenate files and redirect output in the terminal or files.
6. cp commandThe cp command  used for copying files from one location to another. 
7. mv commandThe mv command moves files and directories from one directory to another or renames a file or directory.
8. mkdir commandThis mkdir command in Linux allows the user to create directories. This command can create multiple directories at once as well as set the permissions for the directories.
type “mkdir <dir name> in the terminal, in place of <dir name> type the name of the new directory which you want to create and then press enter.
9. rmdir commandThe rmdir command is used to remove empty directories from the filesystem in Linux. 
10. rm commandFor removing a directory and all its contents, including any subdirectories and files, use the rm command with the recursive option, -r. Directories that are removed with the rmdir command cannot be recovered, nor can directories and their contents be removed with the rm -r command.
11. touch commandIt is mainly used to create empty files, and change the timestamps of files or folders. 
Syntax: touch -a <filename>
12. locate commandThe locate command finds files in Linux using the file name. 
13. grep commandThe Grep for “global regular expression print”, is a command used in searching and matching text files contained in the regular expressions.
14. df commandThe df command (short for disk free), is used to display information related to file systems about total space and available space. 
15. du commandThe du command displays the number of blocks used for files. 
16. set –eThis option allows the terminal to throw an exception when it finds the error and then the code stop execution
17. head commandAs the name implies, the head command will output the first part of the file
18. tail commandthe tail command will print the last part of the file
19. diff commandWe know that diff stands for the difference. This command is used to display the differences in the files by comparing the files line by line.
20. tar commandThe tar command is used to compress a group of files into an archive. This command of Linux is also used to extract, maintain, or modify tar archives. Tar archives merge multiple files and/or directories together into a single file.
tar [options] [archive-file] [file or directory to be archived]
21. chmod commandIt refers to ‘change Mode’ and is used for changing a file’s mode to whatever mode you want to use
22. chown commandit refers to ‘change owner’, which is used to change the file Owner or group. Whenever we want to change ownership we can use chown command.
23. jobs commandThis is a very useful command it is used to list out all jobs in the system (active, stopped, or otherwise) that are running in the background and in the foreground.
24. kill command kil is a shell bulletin for two reasons it allows job IDs to be used instead of process IDs and allows process to be killed if the limit on the process that you can create is reached.
25. ping commandThe ping command is a general utility that is used for checking whether any network is present or not and if a host is active or not.
26. wget command wget stands for ‘web get’. It is the non-interactive network downloader used for downloading files from the server even when the user has not logged on to the system and it can work in the background without interfering with the current process.
27. uname commandSimply we can say it is used for displaying system information or Uname is a command-line tool in Linux-based operating systems that prints information about the kernel, system architecture, hardware, version, and other information, and more.
28. top commandThe top command is commonly used for displaying system-performance information. It dynamically shows administrators which processes are consuming processor and memory resources like the task manager of windows OS.
29. history commandThe history command is used to view the previously executed command
30. man commandThe man command is a built-in manual for using Linux commands. It allows users to view the reference manuals of command runs in the terminal. The man page (which stands for the manual page) includes a command illustration, suitable options, flags, examples, and other informative sections.
31. echo commandThe echo command is used to display a line of text that is given in as an argument
32. zip, unzip commandsThe zip command is used to compress any file and folder (if you do want to compress any folder then you need to use -r for recursive zipping)
Unzip command is the opposite of the zip command it is used to extract the file
33. useradd, userdel commandsThe useradd command is used to create new accounts in Linux.
userdel command is used to delete the local accounts in Linux.
34. alias, unalias commands An alias is defined for each name whose value is given a trailing space in value causing the next word to be checked for a light substitution when the alias is expended
35. su commandsu refers to ‘switch user’.  By using this command You are primarily switching to a particular user and also you need the password for the user you are switching to.

Leave a Reply

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