home..
Linux Commands
(831 Words, 5 Minutes)
linux
File and Directory Management
ls– List directory contentspwd– Print current working directorycd [directory]– Change directorymkdir [dir]– Create a new directoryrmdir [dir]– Remove an empty directoryrm -r [dir/file]– Remove directory or file recursivelycp [source] [destination]– Copy files or directoriesmv [source] [destination]– Move/rename filesfind [path] -name [filename]– Search for files by name
File Operations
cat [file]– Display file contentstac [file]– Display file contents in reverseless [file]– View file content page by pagemore [file]– Similar toless, but less advancedhead -n [num] [file]– Show firstnlines of a filetail -n [num] [file]– Show lastnlines of a filetouch [file]– Create an empty file or update timestampstat [file]– Display file metadatadiff [file1] [file2]– Compare two files
Permissions and Ownership
ls -l– Show file permissions and ownershipchmod [mode] [file]– Change file permissions (chmod 755 file)chown [user]:[group] [file]– Change file ownerchgrp [group] [file]– Change file group
Process Management
ps aux– Show running processestop– Display real-time process usagehtop– Interactive process viewer (if installed)kill [PID]– Terminate process by PIDkillall [name]– Kill all processes by namepkill [pattern]– Kill processes matching a patternjobs– Show background jobsfg– Bring background job to foregroundbg– Resume a background jobnohup [command] &– Run a process in the background
Networking
ip a– Show IP address configurationifconfig– Deprecated alternative toip aping [host]– Test network connectioncurl [url]– Fetch data from a URLwget [url]– Download filesnetstat -tulnp– Show open ports and servicesss -tulnp– Modern alternative tonetstattraceroute [host]– Trace network path to a hostnslookup [domain]– Query DNS records
User Management
whoami– Show current userwho– Show logged-in usersid [user]– Show user’s UID and GIDsu [user]– Switch to another usersudo [command]– Run command as superuserpasswd [user]– Change user passworduseradd [user]– Create a new userusermod -aG [group] [user]– Add user to a groupuserdel [user]– Delete a user
Disk and Storage
df -h– Show disk space usagedu -sh [dir]– Show size of a directorymount [device] [mountpoint]– Mount a filesystemumount [device]– Unmount a filesystemlsblk– List all block devicesfdisk -l– Show disk partitionsmkfs.ext4 /dev/[device]– Format a disk partition
Package Management
Debian/Ubuntu (APT)
apt update– Update package listsapt upgrade– Upgrade all installed packagesapt install [package]– Install a packageapt remove [package]– Remove a package
Arch Linux (Pacman)
pacman -Syu– Sync and update systempacman -S [package]– Install packagepacman -R [package]– Remove package
Red Hat/CentOS (Yum/DNF)
yum updateordnf update– Update packagesyum install [package]– Install packageyum remove [package]– Remove package
System Monitoring
uptime– Show system uptimefree -h– Show memory usagevmstat– Show system performance metricsiostat– Show CPU and disk I/O statsdmesg | tail– Show kernel logsjournalctl -xe– Show detailed system logshistory– Show command history
Archiving and Compression
tar -cvf archive.tar [file/dir]– Create tar archivetar -xvf archive.tar– Extract tar archivetar -czvf archive.tar.gz [file/dir]– Create tar.gz archivetar -xzvf archive.tar.gz– Extract tar.gz archivezip [file.zip] [file]– Create ZIP archiveunzip [file.zip]– Extract ZIP archive
Text Processing
grep [pattern] [file]– Search text in a fileawk '{print $1}' file– Process text by columnssed 's/old/new/g' file– Replace text in a filecut -d':' -f1 /etc/passwd– Extract fields from textsort [file]– Sort file contentuniq [file]– Remove duplicate lines
Shell Scripting and Automation
echo "Hello"– Print textread var– Take user inputexport VAR=value– Set environment variablecrontab -e– Edit cron jobschmod +x script.sh– Make script executable./script.sh– Run a script
Miscellaneous
alias ll='ls -lah'– Create aliasunalias ll– Remove aliastime [command]– Measure execution timewatch -n 5 [command]– Run command every 5 secondsyes | command– Auto-confirm promptssleep 5– Wait for 5 seconds
© 2025 Jithendra Yenugula