Open In App

Essential Unix Commands

Last Updated : 04 Apr, 2024
Like Article

Unix commands are a set of commands that are used to interact with the Unix operating system. Unix is a powerful, multi-user, multi-tasking operating system that was developed in the 1960s by Bell Labs. Unix commands are entered at the command prompt in a terminal window, and they allow users to perform a wide variety of tasks, such as managing files and directories, running processes, managing user accounts, and configuring network settings. Unix is now one of the most commonly used Operating systems used for various purposes such as Personal use, Servers, Smartphones, and many more. It was developed in the 1970’s at AT& T Labs by two famous personalities Dennis M. Ritchie and Ken Thompson. 

  • You’ll be surprised to know that the most popular programming language C came into existence to write the Unix Operating System.
  • Linux is Unix-Like operating system.
  • The most important part of the Linux is Linux Kernel which was first released in the early 90s by Linus Torvalds. There are several Linux distros available (most are open-source and free to download and use) such as Ubuntu, Debian, Fedora, Kali, Mint, Gentoo, Arch and much more.
  • Now coming to the Basic and most usable commands of Linux/Unix part. (Please note that all the linux/unix commands are run in the terminal of a linux system.Terminal is like command prompt as that of in Windows OS)
  • Linux/Unix commands are case-sensitive i.e Hello is different from hello.

Basic Unix commands: 

File System Navigation Unix Command





Changes the current working directory.

cd Documents


Lists files and directories in the current directory.



Prints the current working directory.



Creates a new directory.

mkdir new_folder


Removes an empty directory.

rmdir empty_folder


Moves files or directories.

mv file1.txt Documents/

File Manipulation Unix Command





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

touch new_file.txt


Copies files or directories.

cp file1.txt file2.txt


Moves files or directories.

mv file1.txt Documents


Remove files or directories.

rm old_file.txt


Changes the permissions of a file or directory.

chmod 644 file.txt


Changes the owner and group of a file or directory.

chown user:group file.txt


Creates links between files.

ln -s target_file symlink

cat Concatenates files and displays their contents. cat file1.txt file2.txt
head Displays the first few lines of a file. head file.txt
tail Displays the last few lines of a file. tail file.txt
more Displays the contents of a file page by page. more file.txt
less Displays the contents of a file with advanced navigation features. less file.txt
diff Compares files line by line. diff file1.txt file2.txt
patch Applies a diff file to update a target file. patch file.txt < changes.diff

Process Management Unix Command




ps Displays information about active processes, including their status and IDs. ps aux
top Displays a dynamic real-time view of system processes and their resource usage. top
kill Terminates processes using their process IDs (PIDs). kill <pid>
pkill Sends signals to processes based on name or other attributes. pkill -9 firefox
killall Terminates processes by name. killall -9 firefox
renice Changes the priority of running processes. renice -n 10 <pid>
nice Runs a command with modified scheduling priority. nice -n 10 command
pstree Displays running processes as a tree. pstree
pgrep Searches for processes by name or other attributes. pgrep firefox
jobs Lists active jobs and their status in the current shell session. jobs
bg Puts a job in the background. bg <job_id>
fg Brings a background job to the foreground. fg <job_id>
nohup Runs a command immune to hangups, with output to a specified file. nohup command &
disown Removes jobs from the shell’s job table, allowing them to run independently. disown <job_id>

Text Processing Unix Command




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

Network Communication Unix Command

Command Description Example
ping Tests connectivity with another host using ICMP echo requests. ping
traceroute Traces the route that packets take to reach a destination. traceroute
nslookup Queries DNS servers for domain name resolution and IP address information. nslookup
dig Performs DNS queries, providing detailed information about DNS records. dig
host Performs DNS lookups, displaying domain name to IP address resolution. host
whois Retrieves information about domain registration and ownership. whois
ssh Provides secure remote access to a system. ssh username@hostname
scp Securely copies files between hosts over a network. scp file.txt username@hostname:/path/
ftp Transfers files between hosts using the File Transfer Protocol (FTP). ftp hostname
telnet Establishes interactive text-based communication with a remote host. telnet hostname
netstat Displays network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. netstat -tuln
ifconfig Displays or configures network interfaces and their settings. ifconfig
iwconfig Configures wireless network interfaces. iwconfig wlan0
route Displays or modifies the IP routing table. route -n
arp Displays or modifies the Address Resolution Protocol (ARP) cache. arp -a
ss Displays socket statistics. ss -tuln
hostname Displays or sets the system’s hostname. hostname
mtr Combines the functionality of ping and traceroute, providing detailed network diagnostic information. mtr

System Administration Unix Command





Displays disk space usage.

df -h


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

Text Editors in Unix

Text Editor Description Example
Vi / Vim Vi (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
Emacs Emacs 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
Nano Nano 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
Ed Ed 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
Jed Jed 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

Unix Commands – FAQs

What is Unix and how does it differ from other operating systems?

This question aims to clarify the unique features and characteristics of Unix compared to other operating systems like Windows or macOS.

Who developed Unix and what is its significance in the history of computing?

Users might want to know about the origins of Unix, its developers, and its role in shaping the modern computing landscape.

What are some popular Unix-like operating systems and how do they relate to Unix?

This question seeks to understand the relationship between Unix and Unix-like systems such as Linux, and the various distributions available for different purposes.

What are the essential Unix commands and how are they used?

Users may seek clarification on the basic Unix commands listed in the article and how they can be applied in practical scenarios.

How can I learn Unix commands and improve my proficiency in using Unix-based systems?

This question targets individuals who are interested in learning more about Unix commands and how to become proficient in utilizing Unix-based operating systems effectively.


In conclusion, Unix commands serve as a fundamental toolkit for navigating and managing the Unix operating system, which has evolved from its inception in the 1960s to become one of the most widely used OS platforms across various domains including personal computing, servers, and mobile devices. From its origins at Bell Labs with developers Dennis M. Ritchie and Ken Thompson to the birth of the C programming language and the subsequent emergence of Unix-like systems such as Linux, the Unix ecosystem has significantly shaped the computing landscape. Understanding basic Unix commands is essential for users to efficiently manipulate files, manage processes, configure networks, and perform system administration tasks, thereby empowering them to leverage the full potential of Unix-based systems for diverse computing needs.

Previous Article
Next Article

Similar Reads

Commands in Unix when things go wrong
Terminals and keyboards has no uniform behavioral pattern. There are some commands to wriggle out of some common traps. You must know which keys you need to press when things don't quite work as expected. 1. Backspacing doesn't work: Consider you misspelled command stty as ssty and when you press backspace to erase the command, an unexpected symbol
2 min read
Process Control Commands in Unix/Linux
Process control commands in Unix are: bg - put suspended process into background fg - bring process into foreground jobs - list processes bg Command : bg is a process control command that resumes suspended process while keeping them running in the background. User can run a job in the background by adding a "&amp;" symbol at the end of the command.
3 min read
Processes in Linux/Unix
A program/command when executed, a special instance is provided by the system to the process. This instance consists of all the services/resources that may be utilized by the process under execution. Whenever a command is issued in Unix/Linux, it creates/starts a new process. For example, pwd when issued which is used to list the current directory
6 min read
Piping in Unix or Linux
A pipe is a form of redirection (transfer of standard output to some other destination) that is used in Linux and other Unix-like operating systems to send the output of one command/program/process to another command/program/process for further processing. The Unix/Linux systems allow the stdout of a command to be connected to the stdin of another
5 min read
15 Best Linux/UNIX Books For Beginners
Linux has a variety of operating systems with different features and functionalities. You can use Linux Distros on various hardware manufactured by IBM, Intel, HP, SPARC, etc. Whether you are a developer or a video editor, Linux has so much to offer everyone. In Linux, you can do out-of-the-box tasks or even create something new with your skills. H
10 min read
Data Analysis with Unix - Part 1
To understand how to work with Unix, data - Weather Dataset is used. Weather sensors gather information consistently at numerous areas over the globe and assemble an enormous volume of log information, which is a decent possibility for investigation with MapReduce in light of the fact that is required to process every one of the information, and th
2 min read
Data Analysis with Unix - Part 2
Use of UNIX So now we'll find out the highest recorded global temperature in the dataset (for each year) using Unix? The classic tool for processing line-oriented data is awk. Small script to find the maximum temperature for each year in NCDC data #!/user / bin / env bash for year in all/* do # using each year data file echo -ne `basename $year .gz
4 min read
Pipes and Filters in Linux/Unix
Pipes in UNIX The novel idea of Pipes was introduced by M.D Mcllroy in June 1972- version 2, 10 UNIX installations. Piping is used to give the output of one command (written on LHS) as input to another command (written on RHS). Commands are piped together using vertical bar " | " symbol. Syntax: command 1|command 2 Example: Input: ls|moreOutput: mo
2 min read
What is Open API in UNIX?
There is a set of generic APIs in UNIX which is used to manipulate files. One of these APIs is the open API. The open API is used to create new files and also to establish a connection between a process and a file. After a file is created, any process can call the open function and it gets a file descriptor to refer to the file, which contains the
5 min read
Signals and traps in Unix
In this article, we will discuss the overview of Signals and traps in Unix and understand it with the help of an example. And finally will conclude different scenarios for signals and traps in Unix. Let's discuss it one by one. Overview : Signals are software interrupts that are sent to a program to notify it of an important occurrence. User reques
5 min read
Article Tags :