Linux Commands Cheatsheet

A quick reference for essential Linux terminal commands.


Navigation

Show Current Directory

pwd

List Files

ls
ls -la

Change Directory

cd /path/to/folder
cd ..

File & Directory Operations

Create File / Directory

touch file.txt
mkdir folder-name
mkdir -p parent/child

Copy / Move / Rename

cp source.txt destination.txt
cp -r source-dir target-dir
mv old-name.txt new-name.txt
mv file.txt /target/path

Remove File / Directory

rm file.txt
rm -r folder-name
rm -rf folder-name

Viewing File Content

View Full File

cat file.txt

View File by Pages

less file.txt

Show First / Last Lines

head -n 20 file.txt
tail -n 20 file.txt
tail -f app.log

Search

Find Text in Files

grep "keyword" file.txt
grep -R "keyword" .

Find Files by Name

find . -name "*.js"

Permissions

Show Permissions

ls -l

Change Permissions

chmod 644 file.txt
chmod +x script.sh

Change Owner

chown user:group file.txt

Processes & System

Show Running Processes

ps aux

Monitor System Processes

top

Kill Process

kill process-id
kill -9 process-id

Disk Usage

df -h
du -sh .

Networking

Check Network Interfaces

ip a

Test Connection

ping google.com

Download File

curl -O https://example.com/file.zip
wget https://example.com/file.zip