The Linux Commands Reference Cheat Sheet
Whatsapp Pinterest
Advertisement

The Linux command line, also known as the terminal, can be an intimidating place. But it can also be your most effective tool.

Unlock the "Essential Linux Commands" cheat sheet now!

This will sign you up to our newsletter

Enter your Email

Text commands often work regardless of which Linux-based operating system you use, and the results are often faster than what a graphical desktop interface can offer.

Yet even for long-time users, there are too many commands to commit to memory. That’s why we’ve prepared this handy cheat sheet of Linux commands. And if you want to run several of them, check out how to multitask on the Linux terminal with Screen.

The Linux Command Line Cheat Sheet

Terminal
clearClear the terminal screen.
historyDisplay recently used commands. You can also view these commands via the Up and Down keys.
!Repeat a recently used command. You can use !n to repeat the n-th command in history or !-n to repeat what happened n commands ago.
manDisplay the manual for a terminal program.
whatisDisplay a brief description of a terminal program. A simpler alternative to the man command.
aliasCreate a shortcut to a command or, when combined with the cd command, directory.
exitExit or close the terminal.
Navigation & File Management
cdChange directory. Used to navigate between folders.
pwdDisplay current directory.
cdChange current directory.
lsDisplay a list of files in the current directory.
cpMakes a copy of a file. Defaults to the current directory unless you specify a specific one.
mvMove a file from one directory to another.
rmRemove a file or set of files.
statDisplay when a file was last accessed, modified, or changed.
touchChange the date accessed or date modified time of a given file to right now.
rmdirDelete a file or files.
mkdirCreate a directory. Defaults to the current directory, but you can also specify one.
rmdirDelete a directory. Defaults to the current directory, but you can also specify one. The target directory must be completely empty.
renameChange the name of a file or set of files.
findSearch a specific directory (or your entire PC) to find files that match designated criteria.
locateSearch for files or directories. Faster than the find command, but has fewer options.
grepSearch a specific file or set of files to see if a string of text exists and where.
mountAttach a separate filesystem (such as an external hard drive or USB stick) to your system's main filesystem.
umountDetach a separate filesystem from your system's main filesystem.
catDisplay the contents of a text file. Also works with multiple files.
chmodModify the read, write, and execute permissions of a file.
chownChange the user or group that owns a file.
Users
suSwitch user. Unless you desigate a specific user, this command will attempt to sign in as the root user (which you can think of as the system administrator).
whoamiDisplays the current user name.
idDisplay current user and group.
passwdCreate or update a user's password.
System Administration
unameDisplays core system information such as kernel version, hardware, and operating system.
sudoEnter before a command to perform the command as a system administrator. User must have administrator priveleges for this to work.
apt/dnf/pacmanPrograms for installing software and updates. Which one to use depends on your Linux-based operating system. Each requires administrator rights and additional instructions, such as sudo apt install program-name .
jobsDisplay the status of all current jobs. A job is a representation of a running process or group of processes.
bgSend a job to the background.
fgSend a job to the foreground.
killEnd a process according to its process ID (which you can get using the ps command.
killallEnd all processes whose names match your query.
psDisplay a list of running processes. Defaults to processes started by the current user.
topDisplays a list of running processes, sorted by how much CPU each uses. Unlike ps, the command updates in real-time.
uptimeDisplays time since last boot.
whereisFinds the executable file for a program.
dfDisplays how much disk space is used and free on your system.
freeDisplays how much RAM is used and free on your system.
Network Management
ipDisplays you IP address, network interfaces, bandwidth usage, and more.
pingSend or receive data from another computer on a network. Often used to test whether a network connection is established and the speed of that connection.
digLook up a domain's DNS address
wgetDownload a file.
sshSecure Shell. Connect and login to a remote network location.
Miscellaneous
echoDisplay a line of text. Often used in programs and scripts to relay information to users.
factorDisplays possible factors of a decimal number.
exprSolve math equations.
lookLook up a word in the dictionary.

More Linux Terminal Commands

As comprehensive as this Linux commands cheat sheet may be, the list is only scratching the surface. There is far more you can do in the terminal than we could ever hope to fit on one page. Plus many commands change depending on your Linux-based operating system or require installing additional programs. The commands above are likely to work out-of-the-box on most Linux machines.

All the items in this cheat sheet are useful, but there are other Linux commands that are just plain fun 9 Quirky Linux Commands You Need to Know (And Will Love) 9 Quirky Linux Commands You Need to Know (And Will Love) Make ASCII art, talk to your computer and play text adventures. Your Linux command line isn't just for work: it can be weirdly entertaining, if you know the right commands. Read More . If you’re a beginner, you should know how to check your Linux version 10 Ways to Check Which Linux Version You're Running 10 Ways to Check Which Linux Version You're Running Need to check what version of Linux you're using or the Linux kernel for your distro? Here's how to check your Linux version. Read More too.

Explore more about: Cheat Sheet, Keyboard, Linux Commands, Terminal.

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

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

  1. Daniel Escasa
    February 15, 2019 at 4:57 am

    The following should make the commands clearer:

    1. cd — changes to the directory in the argument, or to the home directory if there is none

    2. grep does not simply “[s]earch a specific file or set of files to see if a string of text exists and where,” but it searches for a regular expression, i.e., a string that contains wildcards

    3. “ sudo Enter before a command to perform the command as a system administrator. User must have administrator priveleges for this to work.”
    Admin privs not necessary, although the sudo command does temporarily confer them for the command following the sudo. All a user needs to sudo is an entry in the sudoers file

    Including all the arguments to the commands above would be a full reproduction of the online manual man, so I would've provided them for at least the cd command

  2. Fred
    January 22, 2019 at 7:45 pm

    Is it supposed to be a downloadable pdf document as well?

    Thanks

  3. sanj
    April 1, 2015 at 12:10 pm

    thanks bro