Linux utilities that every developer should know (printable tooltips included)

Apr 16 · 9 min read

Work with files

mv /path/to/source /path/to/destination
cp /path/to/source /path/to/destination_directory
cp -r /path/to/source_directory /path/to/destination_directory
cp /path/to/file1 /path/to/file2 /path/to/destination_directory
rm /path/to/file
rm -rf *.txt
rm -rf /path/to/directory
chown user:group /path/to/file
chown -R user:group /path/to/directory
chmod -R a+rw /path/to/directory
chmod — reference=/path/to/source /path/to/destination

Work with disk drives

mount /dev/sdb1 /mnt/usb -t ext4 -o ro -o noload
umount /mnt/usb
umount -f /mnt/usb
dd if=/path/to/input of=/path/to/output
dd bs=4M if=/path/to/linux.iso of=/dev/sdx

Reading logs

head -n 20 access.log
tail -n 30 error.log
tail -f access.log
less access.log
less -N access.log

File system search

find -name ‘netdata.conf’
find / -name ‘*.conf’
find / -type f -name ‘apache2’
find / -type d -name ‘nginx’
find ~ -size +100M
find ~ -size -100M
find ~ -empty
find ~ -empty -exec rm -rf {} \;
grep ‘Forbidden’ error.log
grep -i ‘forbidden’ error.log
grep -c ‘Forbidden’ error.log
grep -i -A2 ‘forbidden’ error.log
grep -i -B2 ‘forbidden’ error.log
grep -i -C2 ‘forbidden’ error.log
grep -i -r ‘access denied’ ~/.pm2/logs

Dealing with processes

ps aux
ps aux | grep node
ps -e -o pid,args --forest
kill -SIGTERM 8888
kill -9 8888
killall node
pgrep -P 3607
lsof /etc/hosts
lsof -i :80

Running processes in background

ping &
ping & nmap 192.168.1.* &
jobs -l
screen -d -m ping
screen -ls
screen -R [session id]

System resources utilization

du /path/to/directory
ncdu /path/to/directory

View system information

lsb_release -a
free -h
df -h

Deal with the network

curl -I
curl -d ‘first_name=John&last_name=Doe’
curl -d ‘{“name”:”John”}’ -H ‘content-type: application/json’
curl -O
tcpdump src
tcpdump dst -i eth0
tcpdump --list-interfaces
tcpdump src and dst -n
tcpdump dst and port 80 -A
tcpdump dst and port 443 -n
nmap -sP
nmap -sP 192.168.1.*
nmap -O
nmap -Pn
nmap -F
nmap -Pn -p 80,443
nmap -p U:53,111,137,T:21–25,80,139,8080
nmap -Pn — top-ports 10

Other utilities

watch -n0.5 ls -laS
cal -j
cal -j 6 2021
echo Hello | base64
echo “SGVsbG8K” | base64 -d
echo ‘{“status”:1}’ | jqcurl | jq



Written by


WebbyLab - the company develops complicated, high-load and feature-rich Web-projects.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade