Linux Cheat Sheet

LINUX Commands Cheat Sheet

Linux operating systems (OS) are frequently used by cybersecurity professionals.  However, working in a Linux environment can be daunting for beginners.  Most Linux OSs rely heavily on the terminal, which is the equivalent of a Window’s OS command line.  Memorizing terminal commands and the various options that go with them is challenging.  We here at Cyberkraft have developed a Linux cheat sheet to serve as a quick reference guide. 

What Certifications Require Knowledge of Linux Commands?

Many CompTIA certifications require knowledge of Linux.  The CompTIA A+, Network+, Security+, CySA+, PenTest+, and CASP+ all require proficiency with Linux terminal commands.  The level of proficiency required for the exam depends on the certification.  The A+ certification would require only a basic understanding of Linux commands, while CASP+ would require near mastery.  Learning Linux commands is a great way to score easy points in these exams. 

How Can I Use This Linux Cheat Sheet if I Don’t Have a Linux Device?

The most practical way of practicing Linux commands is to work with a Linux OS, also referred to as a Linux distribution.  Most Linux distributions are open source, which means they are available for free.  Once you download a Linux distribution, you can either install it on a standalone computer, or, you could deploy it within a virtual machine (VM).  We’ve listed the most popular and easily accessible Linux distributions below.

If you are unfamiliar with using VMs or installing a distribution, consider taking our course on “How to Build a Cybersecurity Home Lab”.  This course will teach you everything you need to create Virtual Machine and install a Linux distribution within a VM.  The course also includes all of the software needed to install a Linux distribution and much more for only $5.  Learn more by clicking here. 

Popular Linux Distributions

Kali Linux: Kali is specially designed open source Linux distribution for professional penetration testers and cybersecurity professionals. Kali Linux includes numerous cybersecurity and penetration testing tools.  Kali Linux is the best choice if you are seeking to use Linux for penetration testing, ethical hacking, or cybersecurity.  Click here to download the latest version of Kali Linux.

Debian: Debian is an excellent Linux operating system.  It is the foundation of other OS, such as Ubuntu.  Debian is ideal for servers and Debian supports many PC architectures and each version of it can be used for a long time. Debian is used extensively by government, non-profit organizations and commercial businesses. Click here to download a Debian distribution.

Ubuntu: This Linux distribution is based on Debain and mainly composed of free and open source software.  Ubuntu includes built-in firewall and antivirus software, which  makes Ubuntu the most widely used open-source OS for the development and deployment of code. Download Ubuntu here.

Linux Cheat Sheet - Linux Distributions

Linux Cheat Sheet

We’ve organized the Linux cheat sheet by command category for easy reference. You can also download the full cheat sheet as a PDF. The commands are categorized as file commands, search commands, networking commands, process commands, and Visual Display Editor (VDI) editing commands.

Basic Linux Cheat Sheet – Common Commands

lsListLists the current directory and files
ls -RList sub directoriesLists files in sub directories also
ls -aList hidden filesLists the current directory including hidden files
ls -alList detailsIncludes details: file size, permissions, owner
Cd locationChange directoryChanges directory to a specified location
cd ..Move up one levelNavigates to the parent directory
cd ~ or cdHomeNavigates to the home directory
cd /Root directoryNavigates to the root directory
touch filenameCreate fileCreates a file with the designated filename
cat filenameDisplay file contentsDisplays the content of the designated file
cat file1 file2 > file3Combine filesCombines two files (files 1 and 2) into one file (file 3)
mv file “new file path”Move fileMoves a file to the designated file path
mv filename new_file_nameMove and rename fileMoves a file and renames it
sudoSuperuser doExecute any command with superuser privileges
rm filenameDelete fileDeletes the designated file
manHelpShows the help text for a command
historyCommand historyDisplays previously used commands
clearClear terminalClears all inputs from the terminal
mkdir directorynameMake directoryCreates a new directory
Rmdir directorynameDelete directoryDeletes a directory
mvRename directoryRenames a directory
pr -xDivide fileDivides the file into x columns
lpr filenamePrint filePrints a file
lp -# filenameNumber of copiesPrints multiple copies of a file
lp –P printernameSpecify printerPrints to a specific printer
apt-get filenameInstallInstalls the specified file using the advanced packaging tool (APT)

Search Commands


locate fileSearchSearches the index for a specified file
grep pattern filesPattern searchSearches for a specified pattern in designated files
grep -rRecursive searchSearches the current directory and all subdirectories
grep -iCase insensitive searchFinds files regardless of the case used to search
find /directory/  -name nameFind files in a directoryLocates specified files in a specific directory

File Permission Commands


ls -lList permissionsLists current permissions r=read w=write x=execute -=no permissions
Chown userChange ownerChanges ownership of the file or directory to the inputted user
Chown user:group filenameChange owner and groupChanges the user as well as the group for a file or directory

Networking Commands


SSH username@ip-address or hostnamePerform remote login using SSHSecure Shell (SSH) is an encrypted means of remotely accessing a device
put fileFile uploadUploads a file to a remote computer using SSH
get fileFile downloadDownload a file from a remote computer using SSH
quitLogoutLogs out of the SSH session
ping hostname or ping ipaddressPing a deviceUses Internet Control Messaging Protocol (ICMP) pings to assess network connectivity
ip aList IP informationLists current internet protocol information such as ipv4 and ipv6 address, ethernet adapter used, and MAC addresses.  Color coded for fun!
ifconfigList IP informationTraditional way to list IP address information

Process Commands


bgBackgroundSends a current process to the background
fgForegroundBrings a background process to the foreground
topList processesList details on all active processes
psProcess statusLists the status of the current process including the process identification (PID), which is a typically a five digit number.
kill PIDKills a processKills a process by targeting the PID
nice processPriority startStarts a process with priority
renice –n processSet priorityChanges the priority level of an already running process.  Useful is running multiple applications.
dfList free disk spaceLists the amount of free disk space on your machine
freeList RAM usageShows the amount of RAM in-use and available

Visual Display Editor (VI) Editing Commands


iInsertInsert characters at the cursor’s location
aInsert after cursorWrite characters after the cursor’s location
AInsert at endInserts characters at the end of the line
ESCExit inset modeTerminates insert mode
uUndoUndos the last change.  Very useful!
UUndo allUndo all changes to the entire line
oOpen new lineOpens a new line and enters insert mode
ddDelete lineDeletes an entire line
3ddDelete 3 linesDeletes the 3 previous lines
DDelete after cursorDelete contents of the line after the cursor
CDelete and insertSimilar to D but also enters insert mode
dwDelete wordDelete a word at the cursor’s location
4dwDelete 4 wordsDeletes four words.  Why 4?  Why not!
cwChange wordChanges a word
xDelete characterDeletes a character at the cursor
rReplace characterReplaces a single character at the cursor
ROverwriteOverwrite characters from cursor onward
sSubstitute characterSubstitutes one character under the cursor then enters insert mode
SSubstitute lineSubstitutes an entire line and begins to insert at the beginning of the next line
~Change caseChanges the case of a single character


Download a Free Copy of Our Linux Commands Cheat Sheet

Download your free copy of this cheat sheet here.

Save this PDF as a quick reference guide.

Cyberkraft Course “How to Build a Cybersecurity Home Lab”

If you’re interested in learning Linux but you don’t know how to get started, consider taking our course on “How to Build a Cybersecurity Home Lab”. This course will teach you how to download and install your own Linux distribution using a virtual machine. This way, you’ll be able to learn Linux for free anytime. The course can even teach you how to set up your own virtual network.

The course is only $5, so take a moment to check it out by clicking this link.

Become a Linux Expert With Our CompTIA Linux+ Course

The CompTIA Linux+ Certification is the World’s Premier Linux certification. It teaches the core competencies demanded by the industry’s hiring managers. Linux+ certified professionals are expected to earn an average yearly salary of $79,000 per year according to

Our Linux+ Course teaches you everything you need to ace your Linux+ exam on the first attempt. Plus, we’ll help you get hired with our career assistance program.

Linux Cheat Sheet Breakdown

Related Articles