Common Linux Commands

๐Ÿ—‚๏ธ 1. File and Directory Management

CommandDescription
lsList directory contents
cdChange the current directory
pwdPrint working directory
mkdirCreate a new directory
rmdirRemove an empty directory
rmRemove files or directories
cpCopy files or directories
mvMove or rename files or directories
touchCreate an empty file
findSearch for files and directories
statShow detailed file info
treeDisplay directory structure in a tree format
basenameExtract filename from path
dirnameExtract directory path from full path

๐Ÿ“„ 2. File Viewing and Editing

CommandDescription
catView file contents
lessView large files (scrollable)
moreView file contents one page at a time
headShow first lines of a file
tailShow last lines of a file
nanoSimple terminal-based text editor
vimAdvanced terminal-based text editor
viTraditional version of vim
geditGUI text editor (GNOME)
diffCompare two files
cmpCompare two files byte by byte

๐Ÿ“ฆ 3. File Permissions and Ownership

CommandDescription
chmodChange file permissions
chownChange file ownership
chgrpChange group ownership
umaskSet default file permissions
ls -lList file permissions and ownership

๐Ÿ“‚ 4. Archiving and Compression

CommandDescription
tarArchive files
zip / unzipCompress/decompress ZIP archives
gzip / gunzipCompress/decompress with Gzip
bzip2 / bunzip2Compress/decompress with Bzip2
xz / unxzCompress/decompress with XZ
7z7-Zip compression (if installed)

โš™๏ธ 5. System Information

CommandDescription
uname -aShow system information
hostnameShow or set hostname
uptimeShow how long the system has been running
topDisplay real-time processes
htopInteractive process viewer (if installed)
whoamiShow current user
idShow user and group ID
df -hShow disk usage
du -shShow directory size
free -hShow memory usage
vmstatShow system performance
lscpuShow CPU info
lsblkList block devices
lspciList PCI devices
lsusbList USB devices

๐Ÿ”ง 6. Process Management

CommandDescription
psShow running processes
topReal-time process viewer
htopEnhanced version of top
killKill a process by PID
killallKill processes by name
nice / reniceSet process priority
jobsList background jobs
fgBring job to foreground
bgResume job in background

๐ŸŒ 7. Networking

CommandDescription
ip aShow IP addresses
ifconfigShow network interfaces (older tool)
pingTest network connectivity
tracerouteTrace the route to a host
netstatNetwork stats (deprecated)
ssModern replacement for netstat
curlTransfer data from/to a server
wgetDownload files from the web
digDNS lookup
nslookupQuery Internet name servers
hostDNS lookup tool
scpSecure file copy between systems
rsyncRemote/local file synchronization

๐Ÿ” 8. User Management

CommandDescription
adduser / useraddCreate a new user
passwdChange user password
deluser / userdelDelete a user
groupaddAdd new group
groupdelDelete a group
usermodModify a user
groupsShow user groups
suSwitch user
sudoRun command as superuser

๐Ÿ“œ 9. Package Management

๐Ÿ”น Varies by distribution. Here are the main tools per distro:

For Debian/Ubuntu:

CommandDescription
apt updateUpdate package lists
apt upgradeUpgrade installed packages
apt install <pkg>Install a package
apt remove <pkg>Remove a package
dpkg -i <pkg.deb>Install .deb file

For RHEL/CentOS/Fedora:

CommandDescription
yum install <pkg>Install package (older systems)
dnf install <pkg>Install package (newer systems)
rpm -i <pkg.rpm>Install .rpm file

For Arch Linux:

CommandDescription
pacman -SyuUpdate and upgrade
pacman -S <pkg>Install package

โŒจ๏ธ 10. Shell and Scripting

CommandDescription
echoPrint to terminal
readTake input from user
aliasCreate command shortcut
unaliasRemove alias
whichShow command path
whereisLocate binary/source/man page
manShow manual pages
bashStart a new shell session
shBourne shell
historyShow command history
sourceRun commands from a script in the current shell

๐Ÿงช 11. Disk and Filesystem

CommandDescription
mountMount a device
umountUnmount a device
fsckFilesystem check
mkfsCreate a new filesystem
blkidLocate/identify devices
fdiskPartition a disk
partedDisk partitioning tool

๐Ÿงผ 12. System Maintenance

CommandDescription
rebootReboot system
shutdownShutdown system
systemctlControl systemd services
journalctlView logs from systemd
cron / crontabSchedule tasks
atRun tasks at a specified time
logrotateRotate log files

๐Ÿง™โ€โ™‚๏ธ 13. Miscellaneous

CommandDescription
dateShow or set the date/time
calDisplay calendar
envShow environment variables
exportSet environment variable
timeMeasure execution time
yesOutput a string repeatedly
sleepPause for seconds
watchRun command at intervals
aliasCreate command shortcuts

Please follow and like us:
Pin Share

Leave a Reply

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

RSS
Follow by Email
Copy link
URL has been copied successfully!