A
AiTechWorlds
AiTechWorlds

pwd # print working directory
ls # list files
ls -la # list all with details
ls -lh # human-readable sizes
cd /path/to/dir # change directory
cd ~ # home directory
cd .. # parent directory
cd - # previous directory# Create
touch file.txt # create empty file
mkdir my-folder # create directory
mkdir -p a/b/c # create nested dirs
# Copy
cp file.txt copy.txt # copy file
cp -r folder/ copy/ # copy directory recursively
# Move / Rename
mv file.txt new-name.txt # rename
mv file.txt /path/to/dir/ # move
# Delete
rm file.txt # delete file
rm -rf folder/ # delete directory (careful!)
rmdir folder/ # delete empty directory
# View files
cat file.txt # print entire file
less file.txt # paginated view (q to quit)
head -n 20 file.txt # first 20 lines
tail -n 20 file.txt # last 20 lines
tail -f logfile.log # follow live (Ctrl+C to stop)# Find files
find . -name "*.txt" # by name
find . -type f -name "*.js" # files only
find . -type d -name "node_modules" # directories
find . -mtime -7 # modified in 7 days
find . -size +100M # files > 100MB
# Search inside files (grep)
grep "pattern" file.txt # basic search
grep -i "pattern" file.txt # case-insensitive
grep -r "pattern" ./src/ # recursive
grep -n "pattern" file.txt # show line numbers
grep -l "pattern" *.js # show only filenames
grep -v "pattern" file.txt # invert match
grep -E "regex+" file.txt # extended regex# View permissions
ls -l file.txt
# -rwxr-xr-x 1 user group 1234 date file.txt
# ^-------- owner | group | others
# chmod numeric
chmod 755 file.sh # rwxr-xr-x
chmod 644 file.txt # rw-r--r--
chmod 600 secret.key # rw-------
# chmod symbolic
chmod +x script.sh # add execute permission
chmod -w file.txt # remove write permission
chmod u+x,g-w file # owner +x, group -w
# Change owner
chown user:group file.txt
chown -R user:group /path/# View processes
ps aux # all running processes
ps aux | grep nginx # filter processes
top # live process monitor
htop # better process monitor
# Kill processes
kill PID # graceful kill (SIGTERM)
kill -9 PID # force kill (SIGKILL)
killall nginx # kill by name
pkill -f "python" # kill by pattern
# Background jobs
command & # run in background
jobs # list background jobs
fg %1 # bring job 1 to foreground
nohup command & # run even after logout
# System monitoring
df -h # disk usage
du -sh folder/ # folder size
free -h # memory usage
uptime # system uptime# Connectivity
ping google.com
curl https://api.example.com
wget https://file.com/download.zip
# curl with options
curl -X POST https://api.example.com/data \
-H "Content-Type: application/json" \
-d '{"key": "value"}'
curl -o output.html https://example.com
# Network info
ifconfig # network interfaces
ip addr # modern alternative
netstat -tuln # open ports
ss -tuln # modern alternative
nslookup google.com # DNS lookup# Sort and unique
sort file.txt
sort -r file.txt # reverse
sort -n numbers.txt # numeric sort
uniq file.txt # remove adjacent duplicates
# Count
wc -l file.txt # line count
wc -w file.txt # word count
wc -c file.txt # byte count
# sed โ stream editor
sed 's/old/new/g' file.txt # replace all
sed -i 's/old/new/g' file.txt # in-place
sed -n '10,20p' file.txt # print lines 10-20
# awk โ text processing
awk '{print $1}' file.txt # print first column
awk -F, '{print $2}' file.csv # CSV second column
awk 'NR>1' file.txt # skip first line# tar
tar -czf archive.tar.gz folder/ # create gzip archive
tar -xzf archive.tar.gz # extract
tar -tzf archive.tar.gz # list contents
# zip
zip -r archive.zip folder/ # create zip
unzip archive.zip # extract
unzip -l archive.zip # list contentsexport MY_VAR="value" # set env variable
echo $MY_VAR # print variable
unset MY_VAR # remove variable
env # all environment variables
# .bashrc / .zshrc
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc # reload config
# Aliases
alias ll='ls -la'
alias gs='git status'ssh user@hostname
ssh -p 2222 user@hostname # custom port
ssh -i key.pem user@hostname # with key file
# Copy files
scp file.txt user@host:/path/
scp user@host:/path/file.txt .
rsync -avz ./local/ user@host:/remote/
# SSH key setup
ssh-keygen -t ed25519 -C "email@example.com"
ssh-copy-id user@hostnameGet more notes like this daily on Telegram!
Free study notes, cheat sheets & AI tips
Last reviewed on June 13, 2026 by the AiTechWorlds Notes Team. Free cheat sheet no signup required.
Join AiTechWorlds on Telegram and get daily AI tips, prompt engineering templates, coding resources, and exclusive content 100% free!
No spam. Leave anytime.