Fundamentals 21 min read

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.

ITPUB
ITPUB
ITPUB
Essential Unix/Linux Commands Every User Should Master

1. tar

Create, list, and extract tar archives.

$ tar cvf archive_name.tar dirname/
$ tar xvf archive_name.tar
$ tar tvf archive_name.tar

2. 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 ~ -empty

4. ssh

Connect to remote hosts and debug the client.

$ ssh -l jsmith remotehost.example.com
$ ssh -v -l jsmith remotehost.example.com
$ ssh -V

5. 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.txt

7. vim

Open files at specific lines or patterns.

$ vim +10 filename.txt
$ vim +/search-term filename.txt
$ vim -R /etc/passwd

8. diff

Compare files while ignoring whitespace.

$ diff -w name_list.txt name_list_new.txt

9. sort

Sort file contents in various ways.

$ sort names.txt
$ sort -r names.txt
$ sort -t: -k 3n /etc/passwd | more

10. export

Set or display environment variables.

$ export | grep ORACLE
$ export ORACLE_HOME=/u01/app/oracle/product/10.2.0

11. 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 -c

12. ls

List directory contents with human‑readable sizes, timestamps, or file types.

$ ls -lh
$ ls -ltr
$ ls -F

13. pwd

Print the current working directory.

$ pwd

14. 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 *.gz

16. bzip2

Compress and decompress .bz2 files.

$ bzip2 test.txt
$ bzip2 -d test.txt.bz2

17. unzip

Extract .zip archives and list their contents.

$ unzip test.zip
$ unzip -l jasper.zip

18. shutdown

Power off or reboot the system.

$ shutdown -h now
$ shutdown -h +10
$ shutdown -r now
$ shutdown -Fr now

19. ftp

Transfer files via FTP.

$ ftp IP/hostname
ftp> mget *.html

20. crontab

View and schedule recurring tasks.

$ crontab -u john -l
*/10 * * * * /home/ramesh/check-disk-space

21. service

Manage System V init scripts.

$ service ssh status
$ service --status-all
$ service ssh restart

22. ps

Display running processes.

$ ps -ef | more
$ ps -efH | more

23. free

Show memory usage; options change units.

$ free
$ free -g
$ free -t

24. top

Interactive process viewer; change sort field with O and filter by user.

$ top -u oracle

25. df

Report filesystem disk usage; -h for human‑readable, -T to show type.

$ df -k
$ df -h
$ df -T

26. kill

Terminate processes by PID; alternatives include killall, pkill, xkill.

$ ps -ef | grep vim
$ kill -9 7243

27. rm

Remove files or directories with safety prompts.

$ rm -i filename.txt
$ rm -i file*
$ rm -r example

28. cp

Copy files while preserving attributes.

$ cp -p file1 file2
$ cp -i file1 file2

29. mv

Rename or move files; -i prompts, -v shows progress.

$ mv -i file1 file2
$ mv -v file1 file2

30. cat

Concatenate and display file contents; -n adds line numbers.

$ cat file1 file2
$ cat -n /etc/logrotate.conf

31. mount

Mount filesystems manually or via /etc/fstab.

# mkdir /u01 && mount /dev/sdb1 /u01
/dev/sdb1 /u01 ext2 defaults 0 2

32. chmod

Change file permissions.

$ chmod ug+rwx file.txt
$ chmod g-rwx file.txt
$ chmod -R ug+rwx file.txt

33. chown

Change file owner and group.

$ chown oracle:dba dbora.sh
$ chown -R oracle:dba /home/oracle

34. passwd

Modify user passwords; root can change others without prompting.

$ passwd
# passwd USERNAME
# passwd -d USERNAME

35. 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 down

37. uname

Show system information such as kernel version.

$ uname -a

38. whereis

Locate binaries, sources, and manuals.

$ whereis ls
$ whereis -u -B /tmp -f lsmk

39. whatis

Display a brief description of a command.

$ whatis ls
$ whatis ifconfig

40. locate

Find files by name using a prebuilt database.

$ locate crontab

41. man

Read manual pages; sections categorize command types.

$ man crontab
$ man 5 crontab

42. tail

Show the end of files; -n sets line count, -f follows updates.

$ tail filename.txt
$ tail -n 20 filename.txt
$ tail -f log-file

43. 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' USERNAME

45. mysql

Interact with MySQL databases locally or remotely.

$ mysql -u root -p -h 192.168.1.2
$ mysql -u root -p

46. yum

Package manager for RPM‑based distributions.

$ yum install httpd
$ yum update httpd
$ yum remove httpd

47. 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 httpd

48. ping

Test network connectivity; limit packet count with -c.

$ ping -c 5 gmail.com

49. date

Set system date and synchronize hardware clock.

# date -s "01/31/2010 23:59:53"
# hwclock --systohc --utc

50. wget

Download files from the web.

$ wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gz
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Shellcommand-lineUnixSystem Administration
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.