Hitesh Mankar
📑 Table of Contents
1. 📁 File and Directory Management – Page 1
2. 🔐 Filesystem Permissions and Security – Page 2
3. 👤 User and Group Management – Page 3
4. 💽 Disk Management – Page 4
5. ⚙️ Process Management – Page 5
6. 🌐 Network Management – Page 6
7. 📊 System Information and Monitoring – Page 7
8. 📦 Package Management – Page 8
9. 🛠️ System Services and Daemon Management – Page 9
10. 🗜️ Archiving and Compression – Page 10
11. 📝 Text Processing – Page 11
12. 🔄 System Shutdown and Reboot – Page 12
13. 🧪 System Diagnostics and Troubleshooting – Page 13
14. 📡 Networking & Remote Management – Page 14
15. ⏰ Task Scheduling – Page 15
16. 💾 System Backup and Restore – Page 16
Author: Hitesh Mankar
Hitesh Mankar
1. File and Directory Management
ls : Lists the contents of a directory
cp : Copies files and directories
mv : Moves or renames files and directories
rm : Removes (deletes) files or directories
touch : Creates a new empty file or update file timestamps
nano : Text editor (terminal-based)
vim / vi : Advanced text editors
cat : Concatenates and displays file content
tac : Concatenate and display file content in reverse
less : Displays file content one screen at a time, allowing for scrolling
more : Displays file content one screen at a time, but with less functionality than less
head : Displays the beginning of a file
tail : Displays the end of a file
diff : Compares two files line by line
grep : Searches for patterns within files
find : Searches for files and directories in a directory hierarchy
file : Determines file type
chmod : Changes file permissions
chown : Changes file owner
chgrp : Changes file group ownership
ln : Creates links (hard or symbolic) between files
locate : Find files by name
stat : Display file or file system status
sed : Stream editor for filtering and transforming text.
awk : Pattern scanning and processing language
cut : Remove sections from each line of files
sort : Sort lines of text files.
uniq : Report or omit repeated lines
Directory Commands
pwd : Prints the current working directory
cd : Changes the current directory
mkdir : Creates new directories
rmdir : Removes empty directories
tree : Lists contents of directories in a tree-like format
Hitesh Mankar
2. Filesystem Permissions and Security
chmod : Change file permissions
o chmod 755 file.txt – Give read, write, and execute permissions to owner, and
read-execute permissions to others
chown : Change file owner and group
o chown user:group file.txt – Change owner and group of a file
chgrp : Change group ownership of a file
o chgrp group file.txt – Change the group of a file
umask : Set default permissions for new files
o umask 022 – Set default permissions for newly created files to 755
setfacl : Set access control lists (ACL) for file permissions
getfacl : Get access control lists (ACL) for file permissions
3. User and Group Management
useradd : Creates a new user account
adduser : Creates a new user account with interactive prompts and generally sets up
a home directory and other default configurations
userdel : Deletes a user account
usermod : Modifies an existing user account’s properties
passwd : Changes a user's password
chage : Changes user password expiry information
id : Displays user and group identity information
whoami : Displays the effective username of the current user
su : Switches to another user account or becomes the superuser
sudo : Executes a command with elevated privileges
last : Displays information about the last logged-in users
who : Displays information about currently logged-in users
groupadd : Creates a new group
groupdel : Deletes a group
groupmod : Modifies an existing group's properties
groups : Displays the groups a user belongs to
newgrp : Changes the current group ID, effectively switching to a new group for the
current session
gpasswd : Administers the /etc/group and /etc/gshadow files, used for managing
group passwords and memberships
Hitesh Mankar
chgrp : Changes the group ownership of files or directories
4. Disk Management
lsblk : Lists block devices, including disks and their partitions, in a tree-like format
fdisk : partition table manipulator for linux
parted : A partition manipulator program
blkid : Locates and displays the attributes (UUID, LABEL, TYPE) of block devices
df : Reports filesystem disk space usage
du : Estimates file and directory space usage
Filesystem Creation
mkfs : Builds a Linux filesystem on a device or partition. It's a front-end for various
filesystem-specific tools (e.g., mkfs.ext4, mkfs.xfs)
mkswap : Sets up a Linux swap area
fsck : Checks and optionally repairs a Linux filesystem. It's a front-end for filesystem-
specific check tools (e.g., fsck.ext4)
e2fsck : Checks and repairs ext2, ext3, or ext4 filesystems
Mounting and Unmounting Filesystems
mount : Attaches a filesystem to a specified mount point in the directory tree, making
it accessible
umount : Detaches a mounted filesystem from the directory tree
/etc/fstab : A system configuration file that contains information about filesystems to
be mounted automatically at boot time
Logical Volume Management (LVM)
pvcreate : Initializes a physical volume for use by LVM
pvdisplay : Displays attributes of physical volumes
vgcreate : Creates a volume group
vgdisplay : Displays attributes of volume groups
lvcreate : Creates a logical volume
lvdisplay : Displays attributes of logical volumes
lvextend : Extends the size of a logical volume
lvreduce : Reduces the size of a logical volume
vgremove : Removes a volume group
lvremove : Removes a logical volume
Hitesh Mankar
5. Process management
ps : Report a snapshot of current processes.
top : Display Linux tasks.
htop : Interactive process viewer (advanced top).
kill : Send a signal to a process, typically to terminate.
killall : Terminate processes by name.
bg : Resume a suspended job in the background.
fg : Bring a job to the foreground.
jobs : List active jobs.
nice : Run a program with modified scheduling priority.
renice : Alter priority of running processes.
uptime : Show how long the system has been running.
time : Measure program running time.
6. Network management
ifconfig : displays and configure network interfaces
ip a : shows all network interfaces and their Ips
ip r : displays the routing tables
ping : Send ICMP Echo requests to network hosts
netstat : show open ports and listening services
ss : Socket statistics and listening services (faster than netstat)
traceroute : Trace the route packets take to a network host
nslookup : Query Internet name servers interactively
dig : DNS lookup utility
wget : Non-interactive network downloader
curl : Transfer data with URLs
scp : Secure copy files between hosts
ssh : Secure shell for remote login
ftp : File Transfer Protocol client
7. system information and monitoring
uname : print system information
hostname : Shows or sets the system's hostname
lsusb : Lists USB devices connected to the system
lspci : Lists PCI devices connected to the system
Hitesh Mankar
lshw : Lists hardware configuration
top : Displays dynamic processes and system information
htop : Interactive process and resource monitoring
ps : Report a snapshot of current process
free : Displays the total, used, and free amounts of physical and swap memory
df : Reports file system disk space usage
du : Estimates file space usage for files or directories.
Iostat : Reports CPU utilization and I/O statistics for devices and partitions.
vmstat : Report virtual memory statistics
netstat : show open ports and listening services
uptime : Shows system uptime and load averages (1, 5, and 15 minutes).
who : Displays information about users currently logged in.
w : Shows who is logged on and what they are doing
dmesg : Print the kernel ring buffer messages (system boot and hardware related
message)
journalctl : Query and view logs from system’s journal
8. package management (depends on distributions)
Debian-based (e.g., Ubuntu)
apt-get : APT package handling utility
o apt-get install : Install a package
o apt-get update : Update package list
o apt-get upgrade : Upgrade installed packages
o apt-get remove : Remove a package
apt-cache : Query APT cache
o apt-cache search : Search for a package
o apt-cache show : Show package details
Red Hat-based (e.g., CentOS, Fedora)
yum : Package manager for RPM-based systems
o yum install : Install a package
o yum update : Update installed packages
o yum remove : Remove a package
dnf : Next-generation package manager (Fedora, CentOS 8+)
o dnf install : Install a package
Hitesh Mankar
o dnf update : Update installed packages
o dnf remove : Remove a package
General Commands
rpm : RPM package manager
o rpm -i : Install an RPM package
o rpm -e : Remove an RPM package
dpkg – Debian package manager
o dpkg -i : Install a Debian package
o dpkg -r : Remove a Debian package
9. System Services and Daemon Management
systemctl : Control the systemd system and service manager
o systemctl start : Start a service
o systemctl stop : Stop a service
o systemctl restart : Restart a service
o systemctl enable : Enable a service to start on boot
o systemctl disable : Disable a service from starting on boot
o systemctl status : Check service status
service : Older service management command (used in non systemd systems)
o service start : Start a service
o service stop : Stop a service
o service restart : Restart a service
o service status : Check service status
10. Archiving and Compression
Working with tar files
tar -cvf archive.tar < files > : create a ter archive
tar -xvf archive.tar : extract a tar archive
tar -tvf archive.tar : list files in a tar archive
tar -czvf archive.tar.gz < files > : create a compressed tar.gz archive
tar -xzvf archive.tar.gz : extract a tar.gz archive
tar -cJvf archive.tar.xz : Create a tar.xz archive
tar -xJvf archive.tar.xz : Extract a tar.xz archive
Hitesh Mankar
Working with zip files
zip archive.zip <files> : Create a zip archive
unzip archive.zip : Extract a zip archive
unzip -l archive.zip : List contents of a zip file
zip -r archive.zip : Zip a directory
Working with gzip & bzip2
gzip <file> : Compress a file using gzip
gunzip <file> .gz : Decompress a gzip file
bzip2 <file> : Compress a file using bzip2
bunzip2 <file>.bz2 : Decompress a bzip2 file
11. Text Processing
grep : Search for patterns within files
o grep 'pattern' file.txt – Search for a pattern in a file
o grep -r 'pattern' /dir/ – Recursively search for a pattern
sed : Stream editor for filtering and transforming text
o sed 's/old/new/g' file.txt – Replace old with new globally
awk : A powerful text processing language
o awk '{print $1}' file.txt – Print the first column of each line in a file
cut : Remove sections from each line of a file
o cut -d ':' -f 1 /etc/passwd – Print the first field of each line, delimited by ":"
sort : Sort lines of text files
o sort file.txt – Sort file content in ascending order
uniq : Report or omit repeated lines in a file
o sort file.txt | uniq – Sort and remove duplicate lines
tee : Read from standard input and write to standard output and files
o echo "text" | tee file.txt – Write to file and show output on screen
tr : Translate or delete characters
o echo "hello" | tr 'a-z' 'A-Z' – Convert lowercase to uppercase
paste : Merge lines of files
o paste file1.txt file2.txt – Combine lines of file1 and file2 side by side
wc : Word, line, character, and byte count
o wc -l file.txt – Count lines in a file
o wc -w file.txt – Count words in a file
Hitesh Mankar
12. System Shutdown and Reboot
shutdown : Shut down the system
o shutdown -h now : Immediately shut down
o shutdown -r now : Reboot the system
o shutdown -h +10 : Shut down after 10 minutes
o shutdown -h 22:00 : Schedule shutdown at 10:00 PM
o shutdown -c : Cancel a scheduled shutdown
reboot : Reboot the system
halt : Halt the system immediately (equivalent to turning off power)
poweroff : Power off the system
init : Change the runlevel (old-style system manager)
o init 0 : Shutdown
o init 6 : Reboot
13. System Diagnostics and Troubleshooting
dmesg : Print the kernel ring buffer messages (system boot and hardware-related
messages)
journalctl : Query and view logs from systemd’s journal
strace : Trace system calls and signals
o strace : Trace a command’s system calls
lsof : List open files (useful for debugging)
o lsof : Show processes using a specific file
vmstat : Report virtual memory statistics
iostat : Report CPU and I/O statistics
mpstat : Report CPU usage statistics
pidstat : Report statistics by process
free : Display memory usage
uptime : How long the system has been running
watch : Execute a program periodically, showing output
o watch -n 1 free – Watch memory usage every second
lshw : List hardware configuration
htop : Interactive process viewer (better than top)
netstat : Network statistics (deprecated in favor of ss)
ss : Show socket statistics (more efficient than netstat)
Hitesh Mankar
14. Networking & Remote Management
ifconfig : Configure network interfaces (older command, replaced by ip)
ip : A more modern alternative for managing network interfaces and routing
o ip addr : Show IP addresses
o ip link : Show or manipulate network interfaces
o ip route : Show or manipulate routing tables
ss : Display socket statistics (useful for diagnosing network issues)
nmap : Network exploration tool (can be used for security auditing)
telnet : User interface to the TELNET protocol (less common nowadays)
nc (Netcat) : Network utility for reading and writing from network connections
o nc -l -p 1234 : Listen on port 1234
o nc <host><port> : Connect to a host and port
iptables : Administration tool for IPv4 packet filtering and NAT (Network Address
Translation)
firewalld : Frontend for managing firewall rules (used in some distros like Fedora and
CentOS)
ufw : Uncomplicated firewall (front-end for iptables)
o ufw enable – Enable firewall
o ufw allow <port> – Allow traffic on a specific port
tcpdump : Command-line packet analyzer
curl : Transfer data from or to a server using various protocols (HTTP, FTP, etc.)
wget : Download files from the web via HTTP, HTTPS, FTP
scp : Secure copy over SSH (used to copy files between systems)
o scp file.txt user@remote:/path/to/destination/ – Copy file to remote server
rsync : Remote file and directory synchronization (often used for backups)
o rsync -avz /local/path/ remote:/remote/path/ – Sync directories
15. Task Scheduling
cron : Daemon for running scheduled commands
o crontab -e : Edit cron jobs for the current user
o crontab -l : List the current user’s cron jobs
o crontab -r : Remove the current user's cron jobs
at : Run commands at a specified time
o at 09:00 : Schedule a command to run at 09:00 AM
batch : Run commands when the system load is low
Hitesh Mankar
sleep : Delay for a specified time
o sleep 5s – Sleep for 5 seconds
16. System Backup and Restore
rsync : Remote file and directory synchronization
o rsync -avz source/ destination/ : Synchronize files
o rsync -avz -e ssh source/ user@remote:/destination/ : Sync over SSH
cpio : Copy files to and from archives
dd : Low-level copying and backup of entire filesystems
o dd if=/dev/sda of=/path/to/backup.img : Backup a disk/partition
o dd if=/path/to/backup.img of=/dev/sda : Restore a disk/partition