0% found this document useful (0 votes)
26 views6 pages

Essential Unix Commands - GeeksforGeeks

Uploaded by

gauriagrawal437
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views6 pages

Essential Unix Commands - GeeksforGeeks

Uploaded by

gauriagrawal437
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

8/29/25, 11:02 AM Essential Unix Commands - GeeksforGeeks

File System Navigation Unix Command

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 [Link] Documents/

File Manipulation Unix Command

Command Description Example

touch Creates an empty file or updates the access and


touch new_file.txt
modification times.

cp Copies files or directories. cp [Link] [Link]

mv Moves files or directories. mv [Link] Documents

rm Remove files or directories. rm old_file.txt

chmod Changes the permissions of a file or directory. chmod 644 [Link]

chown Changes the owner and group of a file or directory. chown user:group [Link]

[Link] 1/6
8/29/25, 11:02 AM Essential Unix Commands - GeeksforGeeks

Command Description Example

ln Creates links between files. ln -s target_file symlink

cat Concatenates files and displays their contents. cat [Link] [Link]

head Displays the first few lines of a file. head [Link]

tail Displays the last few lines of a file. tail [Link]

more Displays the contents of a file page by page. more [Link]

less Displays the contents of a file with advanced


less [Link]
navigation features.

diff Compares files line by line. diff [Link] [Link]

patch patch [Link] <


Applies a diff file to update a target file. [Link]

Process Management Unix Command

Command Description Example

ps Displays information about active processes, including their


ps aux
status and IDs.

top Displays a dynamic real-time view of system processes and


top
their resource usage.

kill Terminates processes using their process IDs (PIDs). kill <pid>

pkill Sends signals to processes based on name or other pkill -9


attributes. firefox

killall killall -9
Terminates processes by name. firefox

renice renice -n 10
Changes the priority of running processes. <pid>

[Link] 2/6
8/29/25, 11:02 AM Essential Unix Commands - GeeksforGeeks

Command Description Example

nice nice -n 10
Runs a command with modified scheduling priority. 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


nohup command &
specified file.

disown Removes jobs from the shell's job table, allowing them to run
disown <job_id>
independently.

Text Processing Unix Command

Command Description Example

grep Searches for patterns in text files. grep "error" [Link]

sed sed 's/old_string/new_string/g'


Processes and transforms text streams. [Link]

awk Processes and analyzes text files using a


pattern scanning and processing awk '{print $1, $3}' [Link]
language.

Network Communication Unix Command

[Link] 3/6
8/29/25, 11:02 AM Essential Unix Commands - GeeksforGeeks

Command Description Example

ping Tests connectivity with another host using


ping [Link]
ICMP echo requests.

traceroute Traces the route that packets take to reach a


traceroute [Link]
destination.

nslookup Queries DNS servers for domain name


nslookup [Link]
resolution and IP address information.

dig Performs DNS queries, providing detailed


dig [Link]
information about DNS records.

host Performs DNS lookups, displaying domain


host [Link]
name to IP address resolution.

whois Retrieves information about domain registration


whois [Link]
and ownership.

ssh Provides secure remote access to a system. ssh username@hostname

scp Securely copies files between hosts over a scp [Link]


network. username@hostname:/path/

ftp Transfers files between hosts using the File


ftp hostname
Transfer Protocol (FTP).

telnet Establishes interactive text-based


telnet hostname
communication with a remote host.

netstat Displays network connections, routing tables,


interface statistics, masquerade connections, netstat -tuln
and multicast memberships.

ifconfig Displays or configures network interfaces and


ifconfig
their settings.

iwconfig Configures wireless network interfaces. iwconfig wlan0

route Displays or modifies the IP routing table. route -n

[Link] 4/6
8/29/25, 11:02 AM Essential Unix Commands - GeeksforGeeks

Command Description Example

arp Displays or modifies the Address Resolution


arp -a
Protocol (ARP) cache.

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 mtr [Link]
diagnostic information.

System Administration Unix Command

Command Description Example

df Displays disk space usage. df -h

du du -sh
Displays disk usage of files and directories.
/path/to/directory

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

Text Editors in Unix

Text Description Example


Editor

Vi / Vim Vi (Vim) is a highly configurable, powerful, and Open a file with Vim: vim
feature-rich text editor based on the original Vi filename
editor. Vim offers modes for both command-line Exit Vim editor: Press Esc, then
operations and text editing. type :wq and press Enter

Emacs Emacs is a versatile text editor with extensive Open a file with Emacs: emacs
customization capabilities and support for various filename
programming languages. Save and exit Emacs:
Press Ctrl + X, then Ctrl +

[Link] 5/6
8/29/25, 11:02 AM Essential Unix Commands - GeeksforGeeks

Text Description Example


Editor
S and Ctrl + X, then Ctrl +
C to exit

Nano Open a file with Nano: nano


Nano is a simple and user-friendly text editor filename
designed for ease of use and accessibility. Save and exit Nano:
Press Ctrl + O, then Ctrl + X

Ed Open a file with Ed: ed


Ed is a standard Unix text editor that operates in
filename
line-oriented mode, making it suitable for batch
Exit Ed editor: Type q and
processing and automation tasks.
press Enter

Jed Open a file with Jed: jed


Jed is a lightweight yet powerful text editor that filename
provides an intuitive interface and support for Save and exit Jed: Press Alt +
various programming languages. X, then type exit and
press Enter

[Link] 6/6

You might also like