Essential Unix Commands

Last Updated : 3 Feb, 2026

Unix commands are instructions used to interact with the Unix operating system through a terminal, allowing users to manage files, processes, users, and system resources efficiently. Unix is a powerful, multi-user, and multi-tasking operating system originally developed at Bell Labs and later inspired many modern systems, including Linux.

  • Unix was developed in the 1970s at AT&T Bell Labs by Dennis M. Ritchie and Ken Thompson.
  • The C programming language was created specifically to build the Unix operating system.
  • Linux is a Unix-like operating system that follows the same design philosophy and command structure.
  • The core of Linux is the Linux Kernel, first released in the early 1990s by Linus Torvalds.
  • All Unix/Linux commands are case-sensitive, meaning Hello and hello are treated differently.

Below are several sections that explain the most essential Linux commands:

1. File System Navigation Unix Commands

Command

Description

Example

cd

Changes the current working directory.

cd Documents

ls

Lists files and directories in the current directory.

ls

pwd

Prints the current working directory.

pwd

mkdir

Creates a new directory.

mkdir new_folder

rmdir

Removes an empty directory.

rmdir empty_folder

mv

Moves files or directories.

mv file1.txt Documents/

2. File Manipulation Unix Commands

Command

Description

Example

touch

Creates an empty file or updates the access and modification times.

touch new_file.txt

cp

Copies files or directories.

cp file1.txt file2.txt

mv

Moves files or directories.

mv file1.txt Documents

rm

Remove files or directories.

rm old_file.txt

chmod

Changes the permissions of a file or directory.

chmod 644 file.txt

chown

Changes the owner and group of a file or directory.

chown user:group file.txt

ln

Creates links between files.

ln -s target_file symlink

catConcatenates files and displays their contents.cat file1.txt file2.txt
headDisplays the first few lines of a file.head file.txt
tailDisplays the last few lines of a file.tail file.txt
moreDisplays the contents of a file page by page.more file.txt
lessDisplays the contents of a file with advanced navigation features.less file.txt
diffCompares files line by line.diff file1.txt file2.txt
patchApplies a diff file to update a target file.patch file.txt < changes.diff

3. Process Management Unix Commands

Command

Description

Example

psDisplays information about active processes, including their status and IDs.ps aux
topDisplays a dynamic real-time view of system processes and their resource usage.top
killTerminates processes using their process IDs (PIDs).kill <pid>
pkillSends signals to processes based on name or other attributes.pkill -9 firefox
killallTerminates processes by name.killall -9 firefox
reniceChanges the priority of running processes.renice -n 10 <pid>
niceRuns a command with modified scheduling priority.nice -n 10 command
pstreeDisplays running processes as a tree.pstree
pgrepSearches for processes by name or other attributes.pgrep firefox
jobsLists active jobs and their status in the current shell session.jobs
bgPuts a job in the background.bg <job_id>
fgBrings a background job to the foreground.fg <job_id>
nohupRuns a command immune to hangups, with output to a specified file.nohup command &
disownRemoves jobs from the shell's job table, allowing them to run independently.disown <job_id>

4. Text Processing Unix Commands

Command

Description

Example

grepSearches for patterns in text files.grep "error" logfile.txt
sedProcesses and transforms text streams.sed 's/old_string/new_string/g' file.txt
awkProcesses and analyzes text files using a pattern scanning and processing language.awk '{print $1, $3}' data.csv

5. Network Communication Unix Commands

Command DescriptionExample
pingTests connectivity with another host using ICMP echo requests.ping google.com
tracerouteTraces the route that packets take to reach a destination.traceroute google.com
nslookupQueries DNS servers for domain name resolution and IP address information.nslookup google.com
digPerforms DNS queries, providing detailed information about DNS records.dig google.com
hostPerforms DNS lookups, displaying domain name to IP address resolution.host google.com
whoisRetrieves information about domain registration and ownership.whois google.com
sshProvides secure remote access to a system.ssh username@hostname
scpSecurely copies files between hosts over a network.scp file.txt username@hostname:/path/
ftpTransfers files between hosts using the File Transfer Protocol (FTP).ftp hostname
telnetEstablishes interactive text-based communication with a remote host.telnet hostname
netstatDisplays network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.netstat -tuln
ifconfigDisplays or configures network interfaces and their settings.ifconfig
iwconfigConfigures wireless network interfaces.iwconfig wlan0
routeDisplays or modifies the IP routing table.route -n
arpDisplays or modifies the Address Resolution Protocol (ARP) cache.arp -a
ssDisplays socket statistics.ss -tuln
hostnameDisplays or sets the system's hostname.hostname
mtrCombines the functionality of ping and traceroute, providing detailed network diagnostic information.mtr google.com

6. Coding and Development Unix Commands

CommandDescriptionExample
vim / nanoUsed to write and edit source code files from the terminal.vim main.c
gccCompiles C programs into executable files.gcc program.c -o program
makeAutomates compilation using a Makefile.make
./programRuns a compiled executable file../program
python3Executes Python scripts.python3 script.py
gitManages source code version control.git status
grepSearches code files for specific patterns or keywords.grep "main" *.c

7. System Administration Unix Commands

Command

Description

Example

df

Displays disk space usage.

df -h

du

Displays disk usage of files and directories.

du -sh /path/to/directory

crontab -e

Manages cron jobs, which are scheduled tasks that run at predefined times or intervals.

crontab -e

8. Text Editors in Unix

Text EditorDescriptionExample
Vi / VimVi (Vim) is a highly configurable, powerful, and feature-rich text editor based on the original Vi editor. Vim offers modes for both command-line operations and text editing.Open a file with Vim: vim filename
Exit Vim editor: Press Esc, then type :wq and press Enter
EmacsEmacs is a versatile text editor with extensive customization capabilities and support for various programming languages.Open a file with Emacs: emacs filename
Save and exit Emacs: Press Ctrl + X, then Ctrl + S and Ctrl + X, then Ctrl + C to exit
NanoNano is a simple and user-friendly text editor designed for ease of use and accessibility.Open a file with Nano: nano filename
Save and exit Nano: Press Ctrl + O, then Ctrl + X
EdEd is a standard Unix text editor that operates in line-oriented mode, making it suitable for batch processing and automation tasks.Open a file with Ed: ed filename
Exit Ed editor: Type q and press Enter
JedJed is a lightweight yet powerful text editor that provides an intuitive interface and support for various programming languages.Open a file with Jed: jed filename
Save and exit Jed: Press Alt + X, then type exit and press Enter
Comment

Explore