- Linux Commands Cheat Sheet: With Examples
- Linux Commands Cheat Sheet PDF
- Linux Commands List
- Hardware Information
- Searching
- File Commands
- Directory Navigation
- File Compression
- File Transfer
- Users
- Package Installation
- Process Related
- System Information
- Disk Usage
- SSH Login
- File Permission
- Network
- Linux Keyboard Shortcuts
Linux Commands Cheat Sheet: With Examples
Home » SysAdmin » Linux Commands Cheat Sheet: With Examples
Linux commands may seem intimidating at first glance if you are not used to using the terminal. There are many commands for performing operations and processes on your Linux system.
No matter whether you are new to Linux or an experienced user, having a list of common commands close at hand is helpful.
In this tutorial, you will find commonly used Linux commands as well as a downloadable cheat sheet with syntax and examples.
Important: Depending on your system setup, some of the commands below may require invoking sudo to be executed.
Linux Commands Cheat Sheet PDF
If you prefer having all the commands on a one-page reference sheet, we created a helpful Linux command line cheat sheet. You can save the list of linux commands in PDF format by clicking the Download Linux Cheat Sheet button below.
Linux Commands List
The commands found in the downloadable cheat sheet are listed below.
Hardware Information
Show bootup messages:
See CPU information:
Display free and used memory with:
List hardware configuration information:
See information about block devices:
Show PCI devices in a tree-like diagram:
Display USB devices in a tree-like diagram:
Show hardware information from the BIOS:
Display disk data information:
Conduct a read-speed test on device/disk:
Test for unreadable blocks on device/disk:
Searching
Recursively search for a pattern in a directory:
Find all files and directories related to a particular name:
List names that begin with a specified character [a] in a specified location [/folder/location] by using the find command:
See files larger than a specified size [+100M] in a folder:
File Commands
List files in the directory:
List all files (shows hidden files):
Show directory you are currently working in:
Remove a directory recursively:
Recursively remove a directory without requiring confirmation:
Recursively copy the contents of one file to a second file:
Rename [file_name1] to [file_name2] with the command:
Create a new file:
Show the contents of a file:
Append file contents to another file:
Display the first 10 lines of a file with:
Show the last 10 lines of a file:
Encrypt a file:
Decrypt a file:
Show the number of words, lines, and bytes in a file:
Note: Want to read more about file creation? Check out an article about how to create a file in Linux using the command line.
Directory Navigation
Move up one level in the directory tree structure:
Change directory to $HOME :
Change location to a specified directory:
File Compression
Archive an existing file:
Create a gzip compressed tar file by running:
Compress a file with the .gz extension:
File Transfer
Synchronize the contents of a directory with a backup directory using the rsync command:
Users
See details about the active users:
Show last system logins:
Display who is currently logged into the system with the who command:
Show which users are logged in and their activity:
Add a new group by typing:
Add a new user:
Add a user to a group:
Temporarily elevate user privileges to superuser or root using the sudo command:
Delete a user:
Modify user information with:
Note: If you want to learn more about users and groups, take a look at our article on how to add a user to a group in Linux.
Package Installation
Find a package by a related keyword:
Show package information and summary:
Install a package using the YUM package manager:
Install a package using the DNF package manager:
Install an .rpm package from a local file:
Remove an .rpm package:
Install software from source code:
Process Related
See a snapshot of active processes:
Show processes in a tree-like diagram:
Display a memory usage map of processes:
See all running processes:
Terminate a Linux process under a given ID:
Terminate a process under a specific name:
Terminate all processes labelled “proc”:
List and resume stopped jobs in the background:
Bring the most recently suspended job to the foreground:
Bring a particular job to the foreground:
List files opened by running processes:
Note: If you want to learn more about shell jobs, how to terminate jobs or keep them running after you log off, check out our article on how to use disown command.
System Information
Show system information:
Display how long the system has been running, including load average:
See system hostname:
Show the IP address of the system:
List system reboot history:
See current time and date:
Query and change the system clock with:
Show current calendar (month and day):
List logged in users:
See which user you are using:
Show information about a particular user:
Disk Usage
You can use the df and du commands to check disk space in Linux.
See free and used space on mounted systems:
Show free inodes on mounted filesystems:
Display disk partitions, sizes, and types with the command:
Show disk usage of the directory you are currently in:
Display target mount point for all filesystem:
Mount a device:
SSH Login
Connect to host as user:
Securely connect to host via SSH default port 22:
Connect to host using a particular port:
Connect to host via telnet default port 23:
Note: For a detailed explanation of SSH Linux Commands, refer to our 19 Common SSH Commands in Linux tutorial.
File Permission
Chown command in Linux changes file and directory ownership.
Assign read, write, and execute permission to everyone:
Give read, write, and execute permission to owner, and read and execute permission to group and others:
Assign full permission to owner, and read and write permission to group and others:
Change the ownership of a file:
Change the owner and group ownership of a file:
Note: To learn more about how to check and change permissions, refer to our Linux File Permission Tutorial.
Network
List IP addresses and network interfaces:
Assign an IP address to interface eth0:
Display IP addresses of all network interfaces with:
See active (listening) ports with the netstat command:
Show tcp and udp ports and their programs:
Display more information about a domain:
Show DNS information about a domain using the dig command:
Do a reverse lookup on domain:
Do reverse lookup of an IP address:
Perform an IP lookup for a domain:
Show the local IP address:
Download a file from a domain using the wget command:
Linux Keyboard Shortcuts
Kill process running in the terminal:
Stop current process:
The process can be resumed in the foreground with fg or in the background with bg .
Cut one word before the cursor and add it to clipboard:
Cut part of the line before the cursor and add it to clipboard:
Cut part of the line after the cursor and add it to clipboard:
Paste from clipboard:
Recall last command that matches the provided characters:
Run the previously recalled command:
Exit command history without running a command:
Run the last command again:
Log out of current session:
The more you use Linux commands, the better you will get at remembering them. Do not stress about memorizing their syntax; use our cheat sheet.
Whenever in doubt, refer to this helpful guide for the most common Linux commands.
Источник