Are you an enthusiastic Linux user? Well, if you are, then I think you can make use of this Linux Cheat Sheet. Linux is well known for its terminal and commands. Sometimes, memorizing them becomes a little tricky. So, here you can find best Linux Cheat Sheet for 2023.

This cheat sheet has multiple sections organized by topics. It includes most popular bash commands, displaying hardware information or just working with files. It's simplicity make it perfect for everyday Linux users.

Bash Commands

Basic bash commands
uname -a
Show system and kernel
head -n1 /etc/issue
Show distri­bution
List mounted filesy­stems
df -aTh
Show Mounted Hard Drives Partition
Show system date
Show uptime
Show your username
man cat
Show manual for command

Bash Shortcuts

Bash Keyboard Shortcuts
Exit from commands - man
Stop current command
Sleep program
CTRL-a (Home)
Moves the cursor to the start of a line
CTRL-e (End)
Moves the cursor to the end of a line
Delete from start of line
Delete to end of line
Search history ( write string and press CTRL-r again to search)
Repeat last command
Run last command starting with cat
Print last command starting with cat
All arguments of previous command

Bash Variables

A variable in bash can contain a number, a character, a string of characters
Display all enviro­nment variables
echo $NAME
Show value of $DISPLAY variable
export NAME=value
Set $NAME to value
Executable search path
Home directory
Current shell

Process Management

Commands for Process Management in Linux
Show snapshot of processes
Show real time processes (typing capital E for memory units (KiB, MiB, GiB, etc.,)
Display all processes ( install by sudo apt-get install htop )
kill pid
Kill process with id pid
pkill name
Kill process with name name
killall name
Kill all processes with names beginning name
kill -9 pid
Effectively kill process
pkill -U user .
Kill all process to a given user

Directory Operations

Working with files and directories in Linux
Show current directory
mkdir dir
Create new directory temp
cd dir
Move to directory temp
cd ..
Go up one directory
List files
cd ~
Go to home ( ~ - home directory)
ls .
List current folder ( . - current directory )

ls command

The ls command is used to show the list of a folder.
Show all (including hidden)
Recursive list
Reverse order
Sort by last modified
Sort by file size
Long listing format
One file per line
Comma-­sep­arated output

Search Files

Find, locate and search by patterns - files In Linux from the command line
grep 'word' filename
Search for pattern in files
grep -i
Case insens­itive search
grep -r
Recursive search
grep -v
Inverted search
grep -o
Show matched part of file only
find . -name 'yo*'
Find files starting with name in current dir
find temp -name 'yo*'
Find files starting with name in folder temp
find /dir/ -user name
Find files owned by name in dir
find /dir/ -mmin num
Find files modifed less than num minutes ago in dir
whereis cat
Locate command
which cat
Locate command
locate some_file.txt
Find file based on system index

Nano Shortcuts

Most used Nano Text editor commands
Save current file
Offer to write file (Save as)
Close buffer, exit from nano
Insert a file into current one
Turn the mark on/off (text selection)
Cut marked text or line
Paste text
End of file (Alt+\ - start)
To start of line
To end of line
Show line number
Go to line number
Start forward search
Find next occurrence forward
Search to replace

File Permis­sions

The permissions on a file can be changed by 'chmod' command. The 'chown' command can change the ownership of a file/directory
chmod 775 file.txt
Change permissions of file to 775
chmod -R 777 temp
Recurs­ively chmod folder temp to 777
chown user:group file
Change file owner and group
sudo chown -R user:user ./content
Change file owner and group recursively of folder
find ./ ! -path './content/*' -type f -exec chmod 664 {} \;
Search and change permissions of files

File Permission codes

List of all permission types used in Linux
No Permission
Execute + Write
Read + Execute
Read + Write
Read + Write + Execute

Chain & Pipe commands

Linux command chaining is a technique of merging several commands
cmd1 ; cmd2
Run cmd1 then cmd2
cmd1 && cmd2
Run cmd2 if cmd1 is successful
cmd1 || cmd2
Run cmd2 if cmd1 is not successful
cmd &
Run cmd in a subshell
cmd1 | cmd2
Pipe two commands (stdout of cmd1 to cmd2)
cmd1 |& cmd2
stderr of cmd1 to cmd2
(echo zz; echo aa; echo kk) | sort
Pipe multiple commands

File Operations

Most used file operations commands in Linux
touch file.txt
Create new file file.txt
cat file1.txt file2.txt
Concatenate two files
less file.txt
Display and paginate file1 ( escape - q )
file file.txt
Get file type
cp file.txt new_file.txt
copy file.txt to new_file.txt
cp ./temp/file.txt ./new_folder
copy file to new folder
mv file1.txt file2.txt
Move file1.txt to file2.txt
rm file1.txt
Delete file
head file1.txt
Show first 10 lines of file1.txt
tail file1.txt
Show last 10 lines of file1
tail -F file1.txt
Output last lines of file1 as it changes
tail -n 15 -F logfile.txt
Last 15 lines of file when it changes

IO Redire­ction

Most used file operations commands in Linux
cmd < file
Input of cmd from file
cmd > file
Standard output (stdout) of cmd to file
cmd > /dev/null
Discard stdout of cmd
cmd >> file
Append stdout to file
cmd 2> file
Error output (stderr) of cmd to file


Best commands to check hardware information on Linux
sudo lshw
Hardware info
sudo lshw | less
Short version of lshw
Hardware info in human way
lspci -nnk | grep VGA -A1
lspci -v | grep -A7 -i 'audio'
lspci -nnk | grep net -A2
inxi -Fxxxrz
System information tool
free -g
Show free RAM in GB
df –h
Check free disk space

Update & Clean

Update, Upgrade, Clean and Remove in Linux
sudo apt-get update
Show all availble updates
sudo apt-get upgrade
Download and install available updates
sudo apt-get upgrade -y
Confirmation for updates
sudo apt-get autoclean
Removes all stored archives in your cache for packages
sudo apt-get autoremove
Clean up unused dependencies
sudo apt-get autoclean && sudo apt-get autoremove
Clean cache & dependencies