Updated September 20, 2023
Introduction to Cheat Sheet Linux
Cheat sheet commands are quick and short reference guides that provide helpful tricks and tips to perform various tasks on a computer within a particular program or software. The cheat sheet consists of a list of commands used to perform everyday actions effectively. Hundreds of Linux commands are available; remembering each command is impossible for us, so it is better to remember daily use commands. In Linux, multiple commands are available to perform processes and operations on the Linux system. These cheat sheets can help you quickly recall commands and syntax when working with a tool or language.
Best List Linux Command Cheat Sheet
In a Linux cheat sheet, we can add all the daily used commands in a single sheet; it is straightforward to read and maintain. This cheat sheet will contain all the required Linux commands. One commonly used Linux command is mkdir, which creates a new directory in the file system. A directory is a storage unit that contains multiple files and sub-directories. We can perform various operations on the created directory.
Basic Linux commands
The basic Linux commands used in the cheat sheet are listed below. Below we have defined all basic commands.
Sr. No | Command | Description |
1 | date | This command displays the current date and time of a system. |
2 | hostname | This command is used to display the system hostname. |
3 | w | This command is used to display the currently logged-in user. |
4 | free -m | This command displays the accessible and usable memory of the Linux system. |
5
6 |
ls
cd |
This command displays all files and directories from the current directory.
This command is used to change the directory into the home directory. |
7 | ls -la | This command is used to display all files that include hidden files. |
8 | df -h | This command displays all the drive and their usage on a system. |
9 | mkdir | This command is used to create the directory. |
10 | clear | This command is used to clear all the sessions. |
11 | hostnamectl | This command is used to get system information that includes OS, release, and kernel versions. |
12 | ifconfig | This is used to display the MAC and IP address of the system. |
13 | cat filename | This command displays the content of the specified file. |
14 | cat f1 f2 > f3 | This command combines two files and store output in the third file. |
15 | tail filename | It displays the last ten lines of the file. |
16 | head filename | It displays the first ten lines of the file. |
17 | mv old_file new_file | This command is used to rename the existing file with the new name. |
18 | rm –rf dirname | This command is used to remove the directory. |
19 | reboot | We can reboot our system by executing the reboot command. |
20 | history | We can reboot our system by executing the reboot command. |
File System Navigation
Below are the file system navigation commands. We have described every command of file system navigation as follows.
Sr. No | Command | Description |
1 | cd /path | We can navigate to the specific path by using this command. |
2 | cd .. | This command is used to navigate to the parent directory. |
3 | cd ~ | This command is used to navigate to the home directory. |
4 | ls | This command lists the file and directories from the current directory. |
5 | ls -l | List the directories and file in an extended format. |
6 | pwd | We can print the working directory using this command. |
7 | mkdir dirname | We can create a new directory using this command. |
8 | mkdir /path/dirname | We can create a directory into the specified path by using this command. |
9 | rm dirname | We can remove the directory using this command. |
10 | rm /path/dirname | We can remove the directory into the specified path by using this command. |
11 | cp | This command is used to copy a file from one location to another. |
12 | mv | This command is used to move a file from one place to another. |
File and Directory Management
Below are the file and directory management commands. We have described every command of file and directory management as follows.
Sr. No | Command | Description |
1 | mkdir dirname | Used to create a new directory. |
2 | ls | list the directory contents. |
3 | touch | Used to create a new file or update the timestamp using this command. |
4 | chmod 777 filename | Assign full permission to everyone on the specified file. |
5 | chmod –R 777 dirname | Assign full permission to the specified directory and sub-directory. |
6 | chmod –x filename | Remove the execution permission. |
7 | chown user_name file_name | Change the file ownership. |
8 | chown user_name:group_name file_name | Change the owner and group ownership of a file. |
9 | chown –R user_name:group_name dir_name | Change the owner and group ownership of specified directories and sub-directories. |
File Permissions
Below are the file permissions commands. We have described every command of file permissions as follows.
Sr. No | Command | Description |
1 | ls –l file_name | This command is used to check the current permission of the file. |
2 | chmod 777 file_name | This command is used to assign full permission on the specified file. |
3 | chown user_name file_name | This command is used to change the ownership of the file. |
4 | chmod –x file_name | This command is used to remove the execution permission from the file. |
5 | chown user_name:group_name file_name | This command is used to change the group and owner permission of the file. |
6 | chmod 744 filename | The command to provide full permission to the owner and read permission to the group and other users is chmod. |
User and Group Management
Below are the user and group management commands. We have described every command of user and group management as follows.
Sr. No | Command | Description |
1 | w | This command is used to display all the login users. |
2 | useradd username | This command is used to add a user account. |
3 | userdel –r user_name | This command is used to delete the user account. |
4 | usermod [opt] user_name | This command accounts for information like group, home, shell, and expiration date. |
5 | usermod –aG group_name user_name | This command is used to add a user to the specified group. |
6 | groupadd group_name | This command is used to add a new group account. |
7 | groupdel group_name | This command is used to delete a group account. |
8 | last | This command is used to display the last login user information. |
9 | id | This command is used to display the GID and UIS of the current user. |
Process Management
Below are the process management commands. We have described every command of process management as follows.
Sr. No | Command | Description |
1 | ps | It is used to display all the active processes. |
2 | ps -ef | grep process_name | It is used to display information about a specific process. |
3 | top | It is used to manage and display all the processes in real-time. |
4 | pstree | It shows processes in the tree diagram. |
5 | lsof | It is used to list all files that are opened from running processes. |
6 | kill pid | This command is used to kill the specified process. |
7 | bg | This is used to display the background and stopped jobs. |
8 | pidof process_name | It is used to get the PID of any process. |
Package Management
Below are the package management commands. We have described every command of package management as follows.
Sr. No | Command | Description |
1 | apt-get install package_name | Install the package on the Ubuntu system. |
2 | apt-get remove package_name | Remove the package from the Ubuntu system. |
3 | dpkg –l | grep –I installed | Get the list of installed packages from the Ubuntu system. |
4 | dpkg –i package_name.deb | This is used to install the deb package. |
5 | apt-get update | This is used to update the repository in the Ubuntu system. |
6 | apt-get upgrade package_name | This is used to upgrade the existing package on the Ubuntu system. |
7 | apt-get autoremove | This is used to remove unwanted packages on Debian-based systems. |
8 | yum install package_name | This is used to install the package on RPM-based distributions. |
9 | yum remove package_name | This is used to remove the package from RPM-based distributions. |
10 | yum update | This is used to update all the packages from RPM-based distributions. |
11 | yum list –installed | This is used to display all the installed packages from RPM-based distributions. |
Text Editors
Below are the text editor’s commands. We have described every command of text editors as follows.
Sr. No | Command | Description |
1 | nano file_name | We can open and edit the file by using this editor. After adding the data to the file, we can edit and save the file. |
2 | vi file_name | This is also an editor that is used to edit the file. |
3 | vim file_name | It is also a text editor used to edit the text file. |
4 | emacs file_name | It is another powerful text editor. It contains a steep learning curve like Vim but will offer more features and customizations. |
Networking
Below are the networking commands. We have described every command of networking as follows.
Sr. No | Command | Description |
1 | ifconfig or ip addr show | It is used to display network interfaces and IP addresses. |
2 | netstat –ntulp | This is used to display all the opening ports. |
3 | ip aadr add IP-Address dev eth1 | It is used to add a temporary address to the eth1 interface. |
4 | whois domain_name | Display descriptive information about the domain. |
5 | dig domain_name | It is used to display the DNS information of any domain. |
6 | host domain_name | It is used to perform IP lookup for a specified domain. |
7 | dig –x IP-Address | It is used to perform a reverse lookup of the specified IP address. |
8 | dig –x domain_name | It is used to perform IP lookup for a specified domain. |
9 | ping host-ip | It is used to check the connectivity between two hosts. |
System Monitoring and Management
Below are the system monitoring and management commands. We have described every command of system monitoring and management as follows.
Sr. No | Command | Description |
1 | free -m | This command displays the accessible and usable memory of the Linux system. |
2 | df -h | This command displays all the drive and their usage on a system. |
3 | top | You can use it to manage and display all processes in real-time. |
4 | du -h | It is used to display the disk usage of files and directories. |
5 | systemctl | This is used to manage the system services. |
6 | journalctl | This is used to view the system logs. |
7 | netstat | It is used to view the information on network connections. |
8 | htop | It is similar to the top command used to manage and display the running processes. |
9 | iptables | This is used to configure the Linux firewall. |
10 | kill pid | This is used to kill the active process. |
Miscellaneous Commands and Utilities
Below are the miscellaneous commands and utilities. We have described every various command and utility as follows.
Sr. No | Command | Description |
1 | pwd –P | This command prints the current working directory. |
2 | bc | It is a high-precision calculator. |
3 | expr | It is used to evaluate the expression. |
4 | cal | The command cal is used to print the calendar. |
5 | export | You can use this command to assign or remove environment variables. |
6 | date -d | Users can use it to print the formatted date. |
7 | uptime | It will display the system uptime and load average. |
Advantages of Using Linux
The benefits are listed below:
- Linux is a highly reliable and secure operating system, plus it is under constant construction to enhance its security features.
- Linux’s security and reliability features make it a popular choice for servers used by companies such as Amazon and Google.
- Linux has a wide variety of programs or applications to choose from, and many of them are free to use.
As Linux is freely available, many attempts to hack the system exist. Due to this, many organizations keep their systems private; on the other hand, many others customize their version and make them publicly available to use by everyone. People refer to these variations of Linux operating systems as distributions. Each Linux distribution is purpose-built to meet the requirements of its target users.
Free Tips and Tricks while Using Cheat Sheet Linux Commands
Below are some free tips and tricks for using Linux commands.
- Cheat Sheet Linux commands are case-sensitive. Therefore, it is essential to consider syntax when writing carefully.
- Hidden files in Linux begin with “.” Symbol.
- Bash Shell Terminal is a silent type. It will never give a “Command Successfully Executed” message. But it gives the error message for any error that has occurred.
- The cat command can combine files, but only test files can be mixed and displayed using this command.
- Every file in Linux has three types of Users.
-
-
- User: It is the default type. The system assigns the user group to the person who creates the file.
- Group: Has multiple users. All users in this group have the same permissions on the file.
- Other: Any user who did not create the file or does not belong to any group assigned to it can access the file.
-
- Linux divides file permissions into reading, write, and execute, denoted by r, w, and x.
- Read and writing permission on a directory means you can list the directory’s contents and add, remove, and rename files stored in a directory.
- You can change the assigned permissions using the “chmod” command, which has two types: Absolute and Symbolic.
- “Pipes” send the output of one command as input of another command.
- The “grep” command searches for strings and values in a text document.
- The Less, pg, and More commands allow users to view long files by breaking them into manageable segments.
- You can install Linux on your system through the following methods:
-
- USB stick
- Live CD
- Virtual installation
-
- Communication between cheat sheet Linux and other computers, networks, and remote users as possible.
- FTP is the preferred protocol for sending and receiving large files. You can establish an FTP connection to a remote host and then use commands for uploading, downloading, checking, and browsing files.
- Tenet utility helps to establish a connection between remote Linux computers.
- Linux uses NICE as the priority index for a process. The default value is 0, which varies between 20 and -19. The priority given to a task increases as the Niceness index decreases.
Conclusion
Many primary and advanced Linux commands can help you navigate the file system, work with files and directories, and perform a wide range of tasks on your system. Using the command line interface in Linux can make your work more efficient and productive. As you become more familiar with the Linux command line, you can learn more advanced commands and techniques to improve your productivity and efficiency.
In Linux, there are multiple commands available. As per working, it will be segregated into various formats. There are numerous miscellaneous as well as basic commands available in Linux. We can install the Linux package using the apt-get command in Ubuntu and the yum command in RPM-based systems.
Recommended Articles
We hope that this EDUCBA information on “cheat sheet linux” was beneficial to you. You can view EDUCBA’s recommended articles for more information.