Easy to Recall Linux Commands Cheat Sheet

Harsh S.
By
Harsh S.
Hello, I'm Harsh, I hold a degree in Masters of Computer Applications. I have worked in different IT companies as a development lead on many large-scale...
12 Min Read

If you are a new Linux user, this ultimate Linux commands cheat sheet has everything you need to master the command line. It covers all the most commonly used commands, from file basics (listing, copying, viewing, searching, and setting permissions) to creating and deleting folders, file compression, networking, processes, systems, and file transfer operations.

Why Need The Linux Commands Cheat Sheet?

Whether you’re a Linux expert or just starting, save this cheat sheet for future reference. We packed it with practical commands to help you tackle any task, big or small.

Our Linux Commands Cheat Sheet is a great resource for users of all levels, providing quick and easy access to a range of commands. It can help you learn them, making you a more efficient Linux user.

List of Linux Commands for New Users

Let’s now dive into finding out the most commonly used Linux commands. To help you, we have divided them into different groups. To explain, we have added short examples so that you can easily grasp the usage.

File Operations Commands

Below is the Linux commands cheat list covering the day-to-day file operations. It lists down almost every command you would most likely need to run.

Linux CommandDescription
lsList files and directories with detailed information.
ls -lDisplay in long format with file permissions, owner, size, and modification date.
ls -aShow hidden files as well.
ls -lhDisplay human-readable sizes.
ls *.txtList all text files in the current directory.
ls -R /path/to/directoryRecursively list all files and directories in the specified path.
mkdirCreate a new directory to organize files.
mkdir -m 777 shared_folderCreate a directory with specific permissions (e.g., 777 for read, write, and execute).
mkdir -v project1 project2Create multiple directories and show the progress for each.
mkdir -p /path/to/nested/directoryCreate nested directories with parents if they don’t exist.
Linux commands cheat sheet for listing files / creating directories

File Manipulation Commands

Here is a list of file manipulation commands to help you in your routine tasks. Also, learn to manage your files more efficiently than ever.

Linux CommandDescription
cpCopy files or directories to a specified location.
cp -i file.txt /backup/Prompt before overwriting an existing file in the ‘/backup/’ directory.
cp -u /source/* /destination/Copy only newer files from ‘source’ to ‘destination’.
mvMove or rename files and directories.
mv -i old.txt new.txtPrompt before overwriting an existing file while renaming.
mv *.txt /backup/Move all text files to the ‘/backup/’ directory.
Linux commands cheat sheet for copying and moving files

File View Commands

Debugging and log analysis are some of the common operations, we have to do regularly. The below Linux commands cheat list will make your life easier.

Linux CommandDescription
catDisplay the content of a file.
cat -n file.txtDisplay line numbers with the content.
cat file1.txt file2.txt >merged.txt Concatenate and merge multiple files into ‘merged.txt’.
headView the beginning lines of a file.
head -n 10 file.txtDisplay the first 10 lines of ‘file.txt’.
head -c 1M file.txtView the first 1 MB of ‘file.txt’.
tailView the last lines of a file.
tail -n 20 file.txtDisplay the last 20 lines of ‘file.txt’.
tail -f /var/log/syslogContinuously display new log entries in 'syslog'.
Linux commands cheat sheet for viewing files

File Permission Commands

The below Linux commands will help you set up file permissions and groups.

Linux CommandDescription
chmodChange file permissions for users and groups.
chmod g+s shared_folderSet the group ID on execution (newly created files inherit the group of the parent directory).
chmod -R o-rwx /confidential_dataRecursively remove read, write, and execute permissions for others in ‘confidential_data’.
chownChange file ownership.
sudo chown -R root:admin /protected_folderChange ownership of ‘protected_folder’ to ‘root’ user and ‘admin’ group recursively.
Linux command cheat sheet to change file permissions

File Search Commands

The below Linux commands cheat list will make your search faster and increase productivity.

Linux CommandDescription
grepSearch for a pattern in files.
grep -n "error" logfile.txtDisplay line numbers with matching results.
grep -r "function()" src/ --include=*.jsSearch for the occurrence of “function()” in JavaScript files only.
findFind files and directories based on various criteria.
find / -type f -iname "*.jpg" -size +1MFind JPEG files larger than 1 MB case-insensitively from the root directory.
Linux commands cheat sheet for searching text in files

Compression Commands

Working with large data and files, here is a list of Linux commands to organize your data quickly.

Linux CommandDescription
tarCreate or extract tar archives.
tar -czvf archive.tar.gz folder/Create a compressed tar archive of ‘folder/’.
tar -xzvf archive.tar.gz --wildcards '*.txt'Extract only ‘.txt’ files from ‘archive.tar.gz’.
zipCompress files into a zip archive.
zip -r archive.zip folder/ -x "*.txt"Compress ‘folder/’ excluding ‘.txt’ files.
Linux commands cheat sheet to create a tar or zip of files or folders

Networking Commands

Are you experiencing network failures but unable to troubleshoot the issue? Check the below Linux commands cheat list to trace the network problem.

Linux CommandDescription
pingCheck network connectivity.
ping -c 4 google.comSend 4 packets while pinging.
ping -i 2 google.comSet a time-interval of 2 seconds between packets.
ifconfigDisplay network interface information.
ifconfig eth0 upEnable the ‘eth0’ network interface.
ifconfig eth0 downDisable the ‘eth0’ network interface.
Linux commands cheat sheet for checking network status

Process Management

Do you want to know what processes are running on your system? Or Did any process get hanged? The below commands will help you manage the running processes.

Linux CommandDescription
psShow running processes.
ps -ef | grep sshdFilter and display processes with "sshd" string in the output.
ps -eo pid,ppid,cmd,%mem,%cpuCustomize the output to display process ID, parent process ID, command, memory, and CPU usage.
killTerminate a process.
kill -9 1234Forcefully terminate the process with PID 1234.
killall -r 'myapp.*'Kill all processes whose names match the regular expression 'myapp.*'.
Linux commands cheat sheet for process management

System Info Commands

Do you want to check the OS info like kernel version, and its release versions, or want to know the available space on the disk? Here are the commands you need to know.

Linux CommandDescription
unameDisplay system information.
uname -mShow the machine hardware name.
uname -oDisplay the operating system name.
dfShow disk space usage.
df -ThDisplay disk space usage with human-readable sizes and file system types.
df -i /dev/sda1Show inode information for the ‘/dev/sda1’ partition.
Linux commands cheat sheet for checking system info

Package Management Commands

Sometimes you need something more than a usual command. Here are the Linux Apt commands you should be using then.

Linux CommandDescription
aptPackage tool for Debian-based systems.
apt-get install package-name Install a package.
apt updateUpdate package lists.
apt search keywordSearch for packages related to a specific keyword.
apt-cache show package-nameShow detailed information about a package.
yumPackage manager for RPM-based systems.
yum update package-nameUpdate a specific package.
yum list installed | grep package-nameCheck if a package is installed.
A must-know set of commands to install or update packages.

File Deletion Commands

Want to get rid of trash / unwanted files or folders? Check out the following Linux commands.

Linux CommandDescription
rmRemove files or directories.
rm -f large_file.binForcefully remove ‘large_file.bin’ without prompting.
rm -i *.txtInteractively remove all ‘.txt’ files with confirmation.
rmdirDelete an empty directory.
rmdir emptydirDelete 'emptydir' if it’s empty.
A simple Linux cheat sheet for file deletion commands

File Transfer Commands

Check these Linux commands to send data from one machine to another, even if the data is too large to handle. The below commands will help you.

Linux CommandDescription
scpSecurely copy files between hosts.
scp file.txt user@remotehost:/path/to/destinationCopy ‘file.txt’ to ‘remotehost’.
scp -r remotehost:/path/to/source/destination/Copy files and directories from the 'remotehost' to the current directory.
rsyncSynchronize files and directories.
rsync -av source/ destination/Synchronize ‘source/’ to ‘destination/’.
rsync -e ssh file.txt user@remotehost:/path/to/destination/Synchronize using SSH and copy ‘file.txt’ to ‘remote host’.
A smart Linux commands cheat sheet for newbies

File Permissions (Extended)

Finally, this is the end of this tutorial. Here are some of the advanced examples of the chmod command.

Linux CommandDescription
chmodChange file permissions with symbolic notation.
chmod g+s shared_folderSet the group ID on execution (newly created files inherit the group of the parent directory).
chmod -R o-rwx /confidential_dataRecursively remove read, write, and execute permissions for others in ‘confidential_data’.
chmodChange file permissions using octal values.
chmod 644 file.txtSet the read and write permissions for the owner and read-only for the group and others.
Some lesser-known Linux commands for new users

Related Guide – Basic Linux Commands for Beginners With Examples

Before You Leave

In conclusion, you must have realized that the above Linux commands cheat sheet is your key to mastering the command-line interface. You can refer to it to solve your day-to-day problems and harness the full power of Linux commands.

So what are you waiting for? Save this Linux commands cheat sheet today and take its help. Lastly, our site needs your support to remain free. Share this post on social media (Linkedin/Twitter) if you gained some knowledge from this tutorial.

Enjoy learning,
TechBeamers.

Share This Article
Leave a Comment

Leave a Reply

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