Essential Unix/Linux Commands Every User Should Master
This guide presents over forty essential Unix/Linux commands with concise explanations and practical examples, covering file manipulation, process control, networking, system monitoring, and package management to help beginners and intermediate users efficiently operate a Linux environment.
1. tar
Create, list, and extract tar archives.
$ tar cvf archive_name.tar dirname/ $ tar xvf archive_name.tar $ tar tvf archive_name.tar2. grep
Search for patterns in files.
$ grep -i "the" demo_file $ grep -A 3 -i "example" demo_text $ grep -r "ramesh" *3. find
Locate files by name and execute actions.
$ find -iname "MyProgram.c" $ find -iname "MyProgram.c" -exec md5sum {} \; $ find ~ -empty4. ssh
Connect to remote hosts and debug the client.
$ ssh -l jsmith remotehost.example.com $ ssh -v -l jsmith remotehost.example.com $ ssh -V5. sed
Stream editor for text transformations.
$ sed 's/.$//' filename $ sed -n '1!G; h; p' filename $ sed '/./=' thegeekstuff.txt | sed 'N; s/
/ /'6. awk
Pattern‑scanning and processing language.
$ awk '!($0 in array) { array[$0]; print}' temp $ awk -F ':' '$3=$4' /etc/passwd $ awk '{print $2,$5;}' employee.txt7. vim
Open files at specific lines or patterns.
$ vim +10 filename.txt $ vim +/search-term filename.txt $ vim -R /etc/passwd8. diff
Compare files while ignoring whitespace.
$ diff -w name_list.txt name_list_new.txt9. sort
Sort file contents in various ways.
$ sort names.txt $ sort -r names.txt $ sort -t: -k 3n /etc/passwd | more10. export
Set or display environment variables.
$ export | grep ORACLE $ export ORACLE_HOME=/u01/app/oracle/product/10.2.011. xargs
Build and execute command lines from standard input.
$ ls *.jpg | xargs -n1 -i cp {} /external-hard-drive/directory $ find / -name *.jpg -type f -print | xargs tar -cvzf images.tar.gz $ cat url-list.txt | xargs wget -c12. ls
List directory contents with human‑readable sizes, timestamps, or file types.
$ ls -lh $ ls -ltr $ ls -F13. pwd
Print the current working directory.
$ pwd14. cd
Change directories; cd - toggles between the last two locations. Enable spelling correction with shopt -s cdspell.
$ cd -15. gzip
Compress and decompress .gz files.
$ gzip test.txt $ gzip -d test.txt.gz $ gzip -l *.gz16. bzip2
Compress and decompress .bz2 files.
$ bzip2 test.txt $ bzip2 -d test.txt.bz217. unzip
Extract .zip archives and list their contents.
$ unzip test.zip $ unzip -l jasper.zip18. shutdown
Power off or reboot the system.
$ shutdown -h now $ shutdown -h +10 $ shutdown -r now $ shutdown -Fr now19. ftp
Transfer files via FTP.
$ ftp IP/hostname ftp> mget *.html20. crontab
View and schedule recurring tasks.
$ crontab -u john -l */10 * * * * /home/ramesh/check-disk-space21. service
Manage System V init scripts.
$ service ssh status $ service --status-all $ service ssh restart22. ps
Display running processes.
$ ps -ef | more $ ps -efH | more23. free
Show memory usage; options change units.
$ free $ free -g $ free -t24. top
Interactive process viewer; change sort field with O and filter by user.
$ top -u oracle25. df
Report filesystem disk usage; -h for human‑readable, -T to show type.
$ df -k $ df -h $ df -T26. kill
Terminate processes by PID; alternatives include killall, pkill, xkill.
$ ps -ef | grep vim $ kill -9 724327. rm
Remove files or directories with safety prompts.
$ rm -i filename.txt $ rm -i file* $ rm -r example28. cp
Copy files while preserving attributes.
$ cp -p file1 file2 $ cp -i file1 file229. mv
Rename or move files; -i prompts, -v shows progress.
$ mv -i file1 file2 $ mv -v file1 file230. cat
Concatenate and display file contents; -n adds line numbers.
$ cat file1 file2 $ cat -n /etc/logrotate.conf31. mount
Mount filesystems manually or via /etc/fstab.
# mkdir /u01 && mount /dev/sdb1 /u01 /dev/sdb1 /u01 ext2 defaults 0 232. chmod
Change file permissions.
$ chmod ug+rwx file.txt $ chmod g-rwx file.txt $ chmod -R ug+rwx file.txt33. chown
Change file owner and group.
$ chown oracle:dba dbora.sh $ chown -R oracle:dba /home/oracle34. passwd
Modify user passwords; root can change others without prompting.
$ passwd # passwd USERNAME # passwd -d USERNAME35. mkdir
Create directories; -p creates parent paths as needed.
$ mkdir ~/temp $ mkdir -p dir1/dir2/dir3/dir4/36. ifconfig
Display and configure network interfaces.
$ ifconfig -a $ ifconfig eth0 up $ ifconfig eth0 down37. uname
Show system information such as kernel version.
$ uname -a38. whereis
Locate binaries, sources, and manuals.
$ whereis ls $ whereis -u -B /tmp -f lsmk39. whatis
Display a brief description of a command.
$ whatis ls $ whatis ifconfig40. locate
Find files by name using a prebuilt database.
$ locate crontab41. man
Read manual pages; sections categorize command types.
$ man crontab $ man 5 crontab42. tail
Show the end of files; -n sets line count, -f follows updates.
$ tail filename.txt $ tail -n 20 filename.txt $ tail -f log-file43. less
Page through large files without loading them entirely. $ less huge-log-file.log Use CTRL+F to move forward and CTRL+B to move backward.
44. su
Switch user identity; root can become any user without a password.
$ su - USERNAME $ su - raj -c 'ls' $ su -s 'SHELLNAME' USERNAME45. mysql
Interact with MySQL databases locally or remotely.
$ mysql -u root -p -h 192.168.1.2 $ mysql -u root -p46. yum
Package manager for RPM‑based distributions.
$ yum install httpd $ yum update httpd $ yum remove httpd47. rpm
Low‑level RPM package handling.
# rpm -ivh httpd-2.2.3-22.0.1.el5.i386.rpm # rpm -uvh httpd-2.2.3-22.0.1.el5.i386.rpm # rpm -ev httpd48. ping
Test network connectivity; limit packet count with -c.
$ ping -c 5 gmail.com49. date
Set system date and synchronize hardware clock.
# date -s "01/31/2010 23:59:53" # hwclock --systohc --utc50. wget
Download files from the web.
$ wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gzSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
