In this cheat sheet tutorial I have consolidated a list of Linux commands with examples and man page link to give you an overview on Linux day to day usage. We know Linux is one of the preferred choice for most of the IT domains so having basic knowledge of Linux is mandatory for everyone. I have divided the Linux commands into different section so you can choose to only concentrate on the commands which suits your domain.
I will keep adding and updating this article from time to time to add more commands.
Environment Variables
Variables are local, which means they are specific to a process. Local means local to a process. For example, when you log in on a terminal or open a terminal emulator, you start a process that runs a shell and create this variable TEST with value as deepak
TEST=deepakVerify the content of this variable
echo $TEST
deepakNow you open another terminal of the same Linux server and try to access this variable,
echo $TESTThe output would be empty, so our variable is only accessible in the terminal where we created.
Recommended Read:
- How to find the path of any command in Linux
- How to set environment (PATH) variable permanently in Linux
- Find the path of the commands in linux
| Command | Example / Syntax | Comments | For more details |
|---|---|---|---|
printenv | printenv | Displays environment variables or a specific variable value | man page |
env | env | Runs a program with a modified environment | man page for env |
export | export TEST=deepak env | grep TEST | Sets environment variables for the shell session | man page |
set | TEST=deepak set | grep TEST | Displays all shell and environment variables | man page |
File Management
The commands under this section are very basic commands and must be known to every system administrator. This is definitely not the complete list of Linux commands for file management but can give you a kickstart and can cover most of the basic to complex scenarios.
Recommended Read:
- Linux copy directory and contents from remote to local & vice versa
- 5 commands to copy file from one server to another in Linux or Unix
- How to transfer files over SSH with SSHFS in Linux & Windows
- Securely transfer files between two hosts using HTTPS in Linux
- 10+ practical examples to create symbolic link in Linux
| Command | Example / Syntax | Purpose | More details |
|---|---|---|---|
ls | ls, ls -l, ls -la, ls -ltr | List files (basic, long, hidden, sorted by time) | man page |
cat | cat FILENAME | Print file content to terminal | man page |
less | less FILENAME | View large files with navigation and scrolling | man page |
more | more FILENAME | View file page by page (limited navigation) | man page |
head | head -n 5 FILE | Show first lines of file (default 10) | man page |
tail | tail -n 5 FILE, tail -f /var/log/messages | Show last lines or monitor file in real time | man page |
sort | sort FILE | Sort file content (supports -n, -u) | man page |
uniq | uniq FILE | Remove adjacent duplicate lines | man page |
file | file FILE, file data.txt | Identify file type | man page |
cp | cp SRC DEST, cp /root/file /tmp/ | Copy files or directories | man page |
mv | mv old new, mv /root/file /tmp/ | Move or rename files | man page |
grep | grep STRING FILE, grep ssh /etc/services | Search text in files | man page |
mkdir | mkdir DIR | Create directory | man page |
touch | touch FILE | Create empty file | man page |
pwd | pwd | Show current directory | man page |
Finding files and directories
Most of the time we will end up using find command to find files and directories. But I also like which command as it gives is the path of the binary which is required at multiple events when we are required to execute a binary with complete PATH.
Recommended Read:
- 10 find exec multiple commands examples in Linux/Unix
- How to find and remove duplicate files using shell script in Linux
- 10+ practical examples to create symbolic link in Linux
| Command | Example / Syntax | Purpose | More details |
|---|---|---|---|
which | which cmd, which useradd | Show full path of executable from $PATH | man page |
whereis | whereis cmd, whereis sshd | Locate binary, source, and man pages | man page |
locate | locate file, locate sshd | Fast search using indexed database | man page |
find | find / -name file, find / -type f -name sshd | Search files in real-time with filters | examples |
Check User Information
Recommended Read:
- How to check last login time for users in Linux
- How to keep a track of all the commands run by any user in Linux
- How to check the lock status of any user account in Linux
- How to auto logout(timeout) a normal user and root user in Linux?
These are some of the commands which we use to check the last logged in user information and some other commands to get more details on existing user.
| Command | Example / Syntax | Purpose | More details |
|---|---|---|---|
who | who -u | Show logged-in users with session details | man page |
users | users | List usernames currently logged in | man page |
last | last -a | Show login/logout history from /var/log/wtmp | man page |
finger | finger | Display user information (if installed) | man page |
whoami | whoami | Show current logged-in user | man page |
id | id | Display UID, GID, and groups | man page |
w | w | Show logged-in users and their activity | — |
Check System Information
As a sytem and Linux administrator you must be familiar with these
commands. These will help you determine the type of server you are
working on, such as load, cpu model, hardware model, hardware type etc.
Some of the commands may be distribution specific such as hwinfo is
only available in SuSE Linux while others are expected to be found on
almost all distros.
Recommended Read:
- 5 commands to check if server is physical or virtual in Linux or Unix
- How to check if Hyper Threading (HT) is enabled or disabled on my Linux server
- How to get the hardware model information in Linux
| Command | Example/Syntax | Comments | For more details |
|---|---|---|---|
| uptime | uptime | The uptime utility displays the current time, system uptime, number of logged-in users, and load averages (1, 5, and 15 minutes). | man page |
| free | free -m | The free utility shows total, used, and free physical (RAM) and swap memory, including kernel buffers. | Linux Memory Management |
| dmidecode | dmidecode -t system | dmidecode displays hardware information such as system serial numbers, BIOS details, and firmware information including
BIOS revision. | man page |
| lshw | lshw | lshw extracts detailed hardware configuration including memory, firmware, CPU, cache, and bus speed. | man page |
| hwinfo | hwinfo | hwinfo probes system hardware and generates detailed reports (commonly available on SUSE systems). | man page |
| lscpu | lscpu | lscpu gathers CPU architecture information from sysfs, /proc/cpuinfo, and architecture-specific libraries. | man page |
| lspci | lspci | lspci displays information about PCI buses and connected devices. | man page |
| /proc/cpuinfo | cat /proc/cpuinfo | Provides detailed CPU information such as model, architecture, and processor details. This file is also used by lscpu. | man page |
| uname | uname [OPTIONS] | Prints system information such as kernel name, version, and architecture. | man page |
Manage System Processes
These Linux commands will help you manage the Linux processes, and will help you troubleshoot any server resource related issues. You can use these commands to monitor your server's resource such as Memory, CPU, disk IO etc.
Recommended Read:
- Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
- How to check memory usage of an individual process or application/program in Linux
- Tutorial: Beginners guide on linux memory management
| Command | Example / Syntax | Purpose | More details |
|---|---|---|---|
ps | ps, ps aux | Display running processes | man page |
nice | nice -n 10 command | Start process with adjusted priority | example |
renice | renice -n 15 PID | Change priority of running process | example |
top | top | Real-time system and process monitoring | examples |
pgrep | pgrep process | Find process IDs by name | man page |
pkill | pkill process | Kill processes by name | man page |
kill | kill PID, kill -9 PID | Send signal to process (terminate/force kill) | man page |
sar | sar -u 1 5 | Monitor system performance over time | examples |
vmstat | vmstat 1 | Show memory, CPU, and process stats | man page |
iostat | iostat -x | Monitor disk I/O performance | man page |
crond | crontab -e | Schedule jobs using cron daemon | examples |
Managing Users and Groups
These are some of the basic Linux commands to perform user management such as create, modify, delete user or groups.
Recommended Read:
- How to add user to sudoers with best practices & examples
- 4 easy methods to check sudo access for user in Linux
- 10 practical examples to add or remove user from group in Linux
- How to prevent user from using old password (or re-using) again in Linux
| Command | Example / Syntax | Purpose | More details |
|---|---|---|---|
useradd | useradd USER | Create a new user account with default settings | examples |
usermod | usermod OPTIONS USER, usermod -G admin deepak | Modify user account (e.g. add to group) | man page |
userdel | userdel USER | Delete a user account | man page |
passwd | passwd USER | Set or update user password, lock/unlock account | examples |
groupadd | groupadd GROUP | Create a new group | examples |
groupdel | groupdel GROUP | Delete a group | examples |
groupmod | groupmod OPTIONS GROUP, groupmod -n administrator admin | Modify group (e.g. rename group) | examples |
sudo | $ sudo COMMAND, $ sudo systemctl network restart | Run commands with elevated privileges | guide |
Managing Permissions
Linux permission is a very vast topic and here I have only covered the basic commands which we use to assign/modify/remove permissions to files and directories.
Recommended Read:
- Understanding special permission Sticky Bit in Linux with examples
- Understanding special permission SUID in Linux with examples
- Understanding special permission SGID in Linux with examples
- chmod recursive usage guide for absolute beginners
| Command | Example / Syntax | Purpose | More details |
|---|---|---|---|
chown | chown USER:GROUP FILE, chown deepak:admin /tmp/file | Change file owner and group | man page |
chmod | chmod PERM PATH, chmod 755 /tmp/dir1 | Change file permissions (symbolic or octal) | man page |
chgrp | chgrp GROUP FILE, chgrp admin /tmp/file | Change group ownership | man page |
groups | groups USER, groups deepak | Show groups of a user | man page |
newgrp | $ newgrp GROUP, $ id | Change current primary group | man page |
setfacl | setfacl -m u:user:perm FILE, setfacl -m u:deepak:rx /tmp/file | Set ACL permissions for users/groups | examples |
getfacl | getfacl FILE, getfacl /tmp/file | View ACL permissions | examples |
chattr | chattr +i FILE, chattr +i /tmp/file | Change file attributes (e.g. immutable) | examples |
lsattr | lsattr FILE, lsattr /tmp/file | View file attributes set by chattr | examples |
Configure and Troubleshoot Network
This section will help Network engineers who are new to Linux environment. I have tried to place the most used commands for network troubleshooting, we also have tcpdump, iperf, netperf and many other networking tools which are used for troubleshooting network related issues but they can get complicated hence those are not mentioned in this list.
Recommended Read:
- How to monitor network bandwidth in Linux using netperf
- How to use iperf3 tool to monitor network bandwidth in Linux
- 27 nmcli command examples (cheatsheet), compare nm-settings with if-cfg file
| Command | Example / Syntax | Purpose | More details |
|---|---|---|---|
ifconfig | ifconfig | Legacy tool to display network interfaces (use ip addr instead) | man page |
ip | ip addr, ip link show | Modern tool to manage IP, interfaces, and network settings | examples |
route | route | Legacy routing tool (use ip route) | ip route |
ip route | ip route, ip route show | View and manage routing table | examples |
ethtool | ethtool DEVICE, ethtool -i eth0 | Display and modify NIC settings | man page |
ping | ping HOST, ping 192.168.0.100 | Test network connectivity | man page |
traceroute | traceroute HOST, traceroute 192.168.0.100 | Trace route to destination host | man page |
nmap | nmap HOST | Scan open ports and services | man page |
netstat | netstat, netstat -tunlp | Show network connections and ports (legacy, use ss) | man page |
nmcli | nmcli | Command-line tool for NetworkManager | examples |
nmtui | nmtui | Text-based UI for NetworkManager | examples |
ss | ss, ss -tunlp | Display socket statistics (modern replacement for netstat) | man page |
Managing Partitions and Logical Volumes
One of the primary roles of system administrator would be to configure partitions, storage layouts in the Linux server. Here you can get the list of most used Linux commands for managing partitions and file systems.
Recommended Read:
- Step-by-Step Tutorial: Configure software Linear RAID 0 in Linux
- Step-by-Step Tutorial: Configure Software RAID 0 in Linux
- Step-by-Step Tutorial: Configure Software RAID 1 in Linux
- Step-by-Step Tutorial: Configure Software RAID 4 in Linux
- Step-by-Step Tutorial: Configure Software RAID 5 in Linux
- Step-by-Step Tutorial: Configure Hybrid Software RAID 10 in Linux
| Command | Example / Syntax | Purpose | More details |
|---|---|---|---|
df | df | Show disk space usage of mounted filesystems | man page |
fdisk | fdisk DEVICE | Manage disk partitions (MBR/GPT) | example |
cfdisk | cfdisk DEVICE | Interactive partition table editor | man page |
parted | parted | Advanced partition management tool (GPT/MS-DOS) | example |
pvcreate | pvcreate DEVICE, pvcreate /dev/sda | Create LVM physical volume | example |
pvdisplay | pvdisplay DEVICE | Show physical volume details | man page |
pvs | pvs | Display summary of physical volumes | man page |
vgcreate | vgcreate VG PV, vgcreate test_vg /dev/sda | Create volume group | example |
vgdisplay | vgdisplay | Show volume group details | man page |
vgs | vgs | Display summary of volume groups | man page |
lvcreate | lvcreate OPTIONS, lvcreate -L 1G -n lv vg | Create logical volume | example |
lvdisplay | lvdisplay | Show logical volume details | man page |
lvs | lvs | Display summary of logical volumes | man page |
pvscan | pvscan | Scan and detect physical volumes | example |
vgscan | vgscan | Scan and detect volume groups | man page |
lvscan | lvscan | Scan and detect logical volumes | man page |
vgchange | vgchange -ay | Activate/deactivate volume groups | example |
e2fsck | e2fsck DEVICE | Check and repair ext filesystems | example |
tune2fs | tune2fs DEVICE | Modify filesystem parameters | example |
dumpe2fs | dumpe2fs DEVICE | Show filesystem metadata and superblock | man page |
mkfs | mkfs.ext4, mkfs.xfs | Create filesystem on device | example |
lvextend | lvextend OPTIONS | Extend logical volume size | example |
vgextend | vgextend VG PV | Add physical volume to volume group | example |
resize2fs | resize2fs DEVICE | Resize ext filesystem | example |
lsscsi | lsscsi | List SCSI devices | man page |
lsblk | lsblk | Show block devices and hierarchy | man page |
blkid | blkid | Display UUID of block devices | man page |
Managing RPM and Software Repositories
With package manager such as yum, dnf, apt-get, the life of a system administrator becomes very easy. You can easily install, update, remove packages, upgrade server operating system and much more using these commands.
Recommended Read:
- Step-by-Step: YUM install specific version of Package
- Install old rpm or downgrade rpm to specific version using yum in Linux
- Create local offline yum repository in Linux
| Command | Example / Syntax | Purpose | More details |
|---|---|---|---|
rpm | rpm -ivh pkg.rpm, rpm -qa | Install, query, and manage RPM packages | man page |
yum | yum install pkg | Legacy package manager for RPM systems (replaced by dnf) | examples |
dnf | dnf install pkg | Modern package manager for RPM-based systems | examples |
yumdownloader | yumdownloader pkg | Download RPM packages without installing | examples |
zypper | zypper install pkg | Package manager for SUSE-based systems | examples |
apt-get | apt-get install pkg | Package manager for Debian/Ubuntu systems | man page |
apt-cache | apt-cache search pkg | Search packages from local cache | man page |
dpkg | dpkg -i pkg.deb | Install and manage Debian packages | man page |
dpkg-scanpackages | dpkg-scanpackages dir | Create repository metadata from .deb files | man page |
createrepo | createrepo /repo | Create YUM/DNF repository metadata | examples |
repoquery | repoquery pkg | Query package info from repositories | examples |
repotrack | repotrack pkg | Download package with dependencies | examples |
reposync | reposync | Sync remote repository locally | examples |
subscription-manager | subscription-manager status | Manage RHEL subscriptions and repositories | examples |
Manage logging
Now you know about most of the Linux commands to manager different areas of Linux server but you must be familiar of how logging works in Linux? This may vary based on different distribution, with old distros we used syslog-ng for logging but now almost all major distros have moved to rsyslog solution.
Recommended Read:
- Understanding systemd-journald and how logging works with Journal in RHEL 7
- Journalctl cheat sheet with 10+ commands to filter systemd logs
- How to enable persistent logging in systemd-journald without reboot
| Command | Example / Syntax | Purpose | More details |
|---|---|---|---|
logger | logger "message" | Write messages to system logs | examples |
logrotate | logrotate -f /etc/logrotate.conf | Rotate and manage log files to prevent growth | examples |
journalctl | journalctl, journalctl -xe | View and filter systemd journal logs | examples |
Conclusion
In this cheat sheet tutorial I have tried to consolidate most used Linux commands by different types of experts across IT domains. I am yet to add commands for many other scenarios such as Managing Linux services, archiving, firewall etc but that would just make this tutorial infinite long. I may write another article based on the response I get on this one, even writers need motivation. So that I know people are reading and loving this cheat sheet then I may decide to spend some more time to write about the remaining Linux commands in another tutorial.
Looking forward for your feedback in the comment section.




