Skip to content

A collection of the most commonly used Unix commands with simple, practical examples

Notifications You must be signed in to change notification settings

zokirjonkodirov/CommonUnixCommands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 

Repository files navigation

CommonUnixCommands

A collection of the most commonly used Unix commands with simple, practical examples. Quick reference for daily tasks and advanced operations.

File and Directory Management

ls: List files and directories.

ls
ls -la

pwd: Print the current working directory.

pwd

mkdir: Create a new directory.

mkdir new_folder

rm: Remove files or directories.

rm file.txt
rm -r folder_name

cp: Copy files or directories.

cp source.txt destination.txt
cp -r folder1 folder2

mv: Move or rename files or directories.

mv old_name.txt new_name.txt
mv file.txt /destination/path/

touch: Create an empty file.

touch file.txt

open: Open files or applications.

open file.txt
open -a "Safari"

find: Search for files and directories.

find . -name "*.txt"

File Content Viewing

cat: Display the content of a file.

cat file.txt

less: View file content one screen at a time.

less file.txt

head: Show the first 10 lines of a file.

head file.txt

tail: Show the last 10 lines of a file.

tail file.txt

wc: Word, line, character count.

wc file.txt
wc -l file.txt

grep: Search for patterns in a file.

grep "pattern" file.txt

diff: Compare two files.

diff file1.txt file2.txt

Disk and System Info

df: Disk space usage.

df -h

du: Disk usage of a directory.

du -sh folder_name

top: Display running processes.

top

ps: View running processes.

ps -aux

kill: Terminate a process.

kill PID

uptime: Show system uptime.

uptime

who: Show logged-in users.

who

date: Display current date and time.

date

cal: Show the calendar.

cal

hostname: Display the computer's hostname.

hostname

Networking

ping: Test network connectivity.

ping google.com

ifconfig: View network configuration.

ifconfig

curl: Make HTTP requests.

curl https://example.com

wget: Download files from the web.

wget https://example.com/file.zip

scp: Securely copy files between systems.

scp file.txt user@host:/path/to/destination

uptime: Show system uptime.

uptime

ssh: Connect to a remote system.

ssh user@hostname

netstat: View network statistics.

netstat -an

Compression and Archiving

zip: Compress files into a .zip archive.

zip archive.zip file1 file2

unzip: Extract a .zip archive.

unzip archive.zip

tar: Compress or extract tar archives.

tar -cvf archive.tar folder_name
tar -xvf archive.tar

Permissions and Ownership

chmod: Change file permissions.

chmod 755 file.txt

chown: Change file ownership.

chown user:group file.txt

sudo: Run commands with elevated privilegas.

sudo command

Search and Filters

sort: Sort lines in a file.

sort file.txt

uniq: Remove duplicate lines.

uniq file.txt

cut: Extract sections of text.

cut -d ',' -f file.csv

awk: Text processing and pattern scanning.

awk '{print $1}' file.txt

sed: Stream editor for search and replace.

sed 's/old/new/g' file.txt

System Utilities

echo: Print text to terminal.

echo "Hello, World!"

clear: Clear the terminal screen.

clear

history: Show command history.

history

exit: Exit the terminal.

exit

About

A collection of the most commonly used Unix commands with simple, practical examples

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published