Linux
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
Search for a specific pattern in a file with grep:
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:
Note: Some commands are not recommended to use. Learn about them in our list of dangerous Linux commands.
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:
Copy the contents of one file to another file:
Recursively copy the contents of one file to a second file:
Rename [file_name1]
to [file_name2]
with the command:
Create a symbolic link to a file:
Create a new file using touch:
Show the contents of a file:
or use the cat
command:
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:
Note: For a more comprehensive overview of how to use tar
refer to our guide tar Command in Linux With Examples.
File Transfer
Copy a file to a server directory securely:
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
List all installed packages with yum
:
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 a package using the APT 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:
See kernel release 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:
See disk usage for all files and directory:
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:
Last updated