- 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
- The Linux Command Line
- by William Shotts
- What Readers Are Saying About The Linux Command Line!
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.
Источник
The Linux Command Line
by William Shotts
Fifth Internet Edition Available Now!
Designed for the new command line user, this 555-page volume covers the same material as LinuxCommand.org but in much greater detail. In addition to the basics of command line use and shell scripting, The Linux Command Line includes chapters on many common programs used on the command line, as well as more advanced topics.
Released under a Creative Commons license, this book is available for free download in PDF format. Download it here.
The book is available in printed form, published by No Starch Press. Copies may be purchased wherever fine books are sold. No Starch Press also offers electronic formats for popular e-readers.
In addition to English, the printed book is also available in the following languages:
- Korean: available from BJ PUBLIC
- Serbian: available from Mikro Knjiga
- Chinese (Traditional): available from GOTOP
- Chinese (Simplified): available from PT Press
- Russian: available from Piter
- Polish: available from Helion
Find The Linux Command Line at your local library.
Want to translate the Creative Commons version of The Linux Command Line? Please see the Community Translation Policy for details.
The following community translations are now available:
- ArabicTranslation by Abd Allatif Eymsh
- Spanish (in progress). Translation by Adriano Sánchez
- Portuguese (in progress). Translation by Matheus Sales
- Italian (in progress). Translation by Francesco Cargiuli
- Romanian (in progress). Translation by Vlad Paval
- Turkish (in progress). Translation by Herkes için Linux
What Readers Are Saying About The Linux Command Line!
«I have been using Linux for a little over a year. Read as much as I could including Rute, and many others. I have learned more in the first 93 pages of your book than any others. «
«What a great help your book has been for me! I was looking for a book like yours, but I never was able to find one that really walks the reader through the Linux command line in a general sort of way. Do you know of any others? If I recall, there are a lot of books dedicated to shell scripting, but none that are geared to regular command-line use.»
«Fantastic book!! I have recently switched from the legacy OS to Linux and I have been trying to find a distro that mimics this legacy OS in fear of using the terminal. I ran across this book and opened the terminal for the first time. This book teaches you everything you need to know about the shell and does it with ease. It starts by giving you a solid foundation and builds from there. Its simplicity and informative structure is ideal for all new beginners switching to Linux. I am now always on the terminal even for the simplest things. Not only does this build love, but I also get to practice my shell scripting. Great book!!»
«I’ve been enjoying reading the book and have learned a lot from every chapter. Your writing is very clear, and I’ve enjoyed following along with your examples. I’ve skimmed a couple of Linux books before, but never had enough time to really get into them. From those experiences however, I think your book is much clearer and approachable for beginners.»
«WOW! What a great book. It will clearly provide a stepping stone for many people who want to wean themselves off of their GUI habit, or perhaps just «Make the difficult possible.»
«I think one of the greatest assets of the book that most others about Linux don’t have is the conversational tone. I feel like in almost every chapter, there are parts where you lead the reader to ask questions of the material that aren’t necessarily covered.»
© 2000-2021, William E. Shotts, Jr. Verbatim copying and distribution of this entire article is permitted in any medium, provided this copyright notice is preserved.
Linux® is a registered trademark of Linus Torvalds.
Источник