You can achieve virtually anything on a Linux operating system using a Linux command. Whether you want to send a file to the printer, set up your system firewall, or edit a file without even opening it, you can do it all directly from the terminal. Thus, using Linux for business can be an advantage if you're a startup. We created this Linux cheat sheet to help you.
There are thousands of basic Linux commands available on any Linux system and more handed to you whenever you install new software or packages. It's a common misconception amongst beginners that you have to cram all of these commands in order to be considered an expert, but in reality, you only need to know a small subset of commands to become a proficient Linux administrator like using the grep command in Linux.
In this article, we'll be sharing 100+ such commands across different categories along with a downloadable Linux commands cheat sheet.
Show all files and directories present in the working directory
ls -l
Show all files and directories along with details like ownership, size, and when they were last modified
ls -t
Sort the output of ls by last modified date
pwd
List the path of the current working directory
cd directory
Switch to a different working directory
cd ..
Move up one directory level
cd /
Switch to the root directory
clear
Wipe out all the text from the terminal screen
history
Print out all the previously executed commands in the current session
touch filename
Create a new file
vi filename
Open a file for editing
cat filename
Display the contents of a file
hostnamectl
List system information, including kernel, release, architecture, and virtualization
ifconfig
Show the network interfaces, IP addresses, and MAC address of the system. On newer distributions ifconfig is deprecated and may not be installed; use ip a instead
date
Print the current system date and time
top
List all the running processes on the system
free -m
Show memory usage stats
head filename
Display the first 10 lines of a file
tail filename
Display the last 10 lines of a file
mv file /new/file/path
Move the file to a different location
mv filename new_filename
Rename a file
cp filename new_filename
Copy a file
man command_name
List helpful information regarding a command
rm filename
Delete a file
rm -rf directory_name
Remove a directory and its contents
sudo
Let a regular user run a command with elevated privileges
mkdir directory_name
Create a new directory
kill pid
Kill a process using its process ID
reboot
Restart the system
shutdown -h now
Turn off the system
Networking Commands
Command
Description
dig domain_name
Show the DNS-related information of the given domain name
dig -x ip
Perform a reverse DNS lookup for an IP address
host domain_name
Perform DNS lookup of the given domain name which prints out the IP address
whois domain_name
Look up the registration information of a domain
ping ip
Check the connectivity between your host and the given IP address
ssh username@ip
Securely log in as the specified user on another server
wget file
Download a file
wget -c file
Continue a stopped download
traceroute domain_name
Trace the route a packet will take when travelling from your machine to a host
telnet domain_name port
Connect to a remote host on a specific port
netstat -pnltu
Display all currently listening ports
route
Display the routing table for your machine
arp
View the contents of the ARP (address resolution protocol) table
cat /etc/resolv.conf
See the DNS servers that your machine is currently using
tcpdump -i eth1 'port 80'
Log and monitor all incoming traffic on port 80
nmap ip
Network discovery of the given IP. Find out whether the host is up, which ports are open, and so on
Search Commands
Command
Description
locate keyword
Search for a file or directory in a pre-compiled cache. Much faster than find but may not show all results
find / -name keyword
Search for a file or directory in the real system. Much slower than locate but always up to date
find /home -name *.ext
Search for the given extension in the /home directory and all its subdirectories
find / -type f ! -perm xxx
List all files that don't have the specified permission
find / -perm /u=r
Display all files that the owner has read permission on
grep keyword filename
Search for the specified keyword/pattern in the given file
grep keyword *
Search for the specified keyword/pattern across all files in the current directory
grep -i keyword *
Ignore case while searching
grep -r keyword *
Perform a recursive search, i.e. include the subdirectories in the search
grep -x 'what to match' *
Print only the lines that match the whole pattern exactly
grep -c keyword *
Count the number of matches
Permissions Commands
Command
Description
chmod xxx filename
Assign the specified permissions to a file
chmod -R xxx directory
Assign the specified permissions to a directory and all its subdirectories
chmod -x filename
Remove the execution permissions from a file
chown username filename
Change the ownership of the specified file
chown username:groupname filename
Change the ownership and the group ownership of a file
If you found this Linux commands cheat sheet useful, these related beginner guides can help you practise file navigation, log reading, grep, and other everyday command-line tasks:
Ashwin is a content specialist at HostAfrica, where he's been crafting clear, authoritative copy since 2021. With a background in digital marketing and a passion for impactful storytelling, he turns complex ideas into trustworthy, engaging content. Ashwin writing helps our audience navigate web hosting and cloud solutions with confidence.
Run your projects on a Linux VPS
Full root access, fast SSD storage, and instant setup on Linux.
We use cookies to run this site, to measure how visitors use it, and to show relevant offers. Necessary cookies always run. You choose the rest, and you can change your choice at any time from the footer.
NecessaryAlways active
These cookies keep the site secure and make core features work. The site cannot run without them, so they always stay on.
These cookies remember choices that improve your visit. They also enable the partner review badge.
These cookies count visits and show us which pages help people. The data tells us what to improve.
These cookies measure which adverts bring visitors. They also let our partners show you relevant offers.