Show disk usage in human-readable format
Useful Linux one-liner
df -h
Linux basics
102 One-liners Linux command examples grouped into 40 practical sections.
Browse grouped command cards or search directly below.
21 commands
Useful Linux one-liner
df -h
Useful Linux one-liner
du -sh * | sort -hr
Useful Linux one-liner
< /dev/urandom tr -dc A-Za-z0-9 | head -c 32; echo
Useful Linux one-liner
wc -l file.txt
Useful Linux one-liner
sort file | uniq
Useful Linux one-liner
wget -c url
Useful Linux one-liner
> file.txt
Useful Linux one-liner
tail -f logfile
Useful Linux one-liner
gpg -c file
Useful Linux one-liner
split -b 1G largefile part-
Useful Linux one-liner
cat part-* > largefile
Useful Linux one-liner
sha256sum file
Useful Linux one-liner
nl file.txt
Useful Linux one-liner
dos2unix file
Useful Linux one-liner
command | pv -s $(du -b input | cut -f1)
Useful Linux one-liner
pdftotext file.pdf - | less
Useful Linux one-liner
echo "text" | lolcat
Useful Linux one-liner
history | awk '{print $2}' | sort | uniq -c | sort -nr | head
Useful Linux one-liner
a() { case $1 in *.tar.gz) tar xzf $1;; *.zip) unzip $1;; esac; }; a file
Useful Linux one-liner
truncate -s 10G file.img
Useful Linux one-liner
gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf
7 commands
Useful Linux one-liner
mkdir project{01..100}
Useful Linux one-liner
du -h . | sort -hr | head -20
Useful Linux one-liner
ls -lt
Useful Linux one-liner
mkdir dir && cd dir
Useful Linux one-liner
ls -d */
Useful Linux one-liner
tree
Useful Linux one-liner
ls | wc -l
7 commands
Useful Linux one-liner
python3 -m http.server 8000
Useful Linux one-liner
curl ifconfig.me
Useful Linux one-liner
curl wttr.in
Useful Linux one-liner
curl v2.wttr.in
Useful Linux one-liner
ruby -run -e httpd . -p 8000
Useful Linux one-liner
php -S localhost:8000
Useful Linux one-liner
npx http-server
7 commands
Useful Linux one-liner
find . -iname "*.log"
Useful Linux one-liner
find . -type f -size +100M
Useful Linux one-liner
grep -ir "text" .
Useful Linux one-liner
find . -mtime +30 -delete
Useful Linux one-liner
find . -type d -empty -delete
Useful Linux one-liner
upower -i $(upower -e | grep BAT) | grep percentage
Useful Linux one-liner
find . -xtype l
6 commands
Useful Linux one-liner
mplayer -vo caca video.mp4
Useful Linux one-liner
convert input.jpg output.png
Useful Linux one-liner
convert -delay 10 -loop 0 *.png animation.gif
Useful Linux one-liner
yt-dlp url
Useful Linux one-liner
mpv url
Useful Linux one-liner
ffmpeg -i input.mp4 output.gif
6 commands
Useful Linux one-liner
echo "text" | pv -qL 10
Useful Linux one-liner
pkill process_name
Useful Linux one-liner
command | xclip -sel clip
Useful Linux one-liner
dd if=iso.iso of=/dev/sdX bs=4M status=progress
Useful Linux one-liner
dd if=/dev/zero of=test bs=1G count=1 oflag=dsync
Useful Linux one-liner
while true; do echo -e "HTTP/1.1 200 OK\n\n$(date)" | nc -l 8080; done
4 commands
Useful Linux one-liner
cp file{,.bak}
Useful Linux one-liner
ss -tuln
Useful Linux one-liner
ln -s target link
Useful Linux one-liner
for f in *.txt; do mv "$f" "${f%.txt}.bak"; done
4 commands
Useful Linux one-liner
cd -
Useful Linux one-liner
Ctrl+R
Useful Linux one-liner
source ~/.bashrc
Useful Linux one-liner
alias r='fc -s'
3 commands
Useful Linux one-liner
tar czf backup.tar.gz directory/
Useful Linux one-liner
tar xzf archive.tar.gz
Useful Linux one-liner
tar cjf archive.tar.bz2 dir/
2 commands
Useful Linux one-liner
rsync -ah --progress src dest
Useful Linux one-liner
sshfs user@host:/remote /local
2 commands
Useful Linux one-liner
telnet towel.blinkenlights.nl
Useful Linux one-liner
sed -i 's/old/new/g' *.txt
2 commands
Useful Linux one-liner
cal
Useful Linux one-liner
cal -3
2 commands
Useful Linux one-liner
command -v cmd >/dev/null && echo yes
Useful Linux one-liner
command &
2 commands
Useful Linux one-liner
git branch --show-current
Useful Linux one-liner
git status -sb
2 commands
Useful Linux one-liner
watch command
Useful Linux one-liner
watch -n 1 date
1 commands
Useful Linux one-liner
!!
1 commands
Useful Linux one-liner
mount -t tmpfs -o size=1G tmpfs /mnt/ram
1 commands
Useful Linux one-liner
top
1 commands
Useful Linux one-liner
sudo !!
1 commands
Useful Linux one-liner
^wrong^correct^
1 commands
Useful Linux one-liner
cmatrix
1 commands
Useful Linux one-liner
crontab -l
1 commands
Useful Linux one-liner
Ctrl+X Ctrl+E
1 commands
Useful Linux one-liner
dd if=/dev/urandom of=/dev/sdX
1 commands
1 commands
Useful Linux one-liner
for i in {1..50}; do echo -e "\e[${((RANDOM%7+31))}m✨\e[0m"; sleep 0.1; done
1 commands
Useful Linux one-liner
fortune | cowsay
1 commands
Useful Linux one-liner
jq .
1 commands
Useful Linux one-liner
lshw -short
1 commands
Useful Linux one-liner
neofetch
1 commands
Useful Linux one-liner
nohup command &
1 commands
Useful Linux one-liner
qrencode -t ANSI "text"
1 commands
Useful Linux one-liner
screenfetch or neofetch
1 commands
Useful Linux one-liner
script session.log
1 commands
Useful Linux one-liner
scriptreplay -t timing.log session.log
1 commands
Useful Linux one-liner
sensors
1 commands
Useful Linux one-liner
sl
1 commands
Useful Linux one-liner
timedatectl
1 commands
Useful Linux one-liner
uptime
1 commands
Useful Linux one-liner
xmllint --format file.xml
sudo !!
May affect permissions or system state. Check the target first.
python3 -m http.server 8000
Copy it and replace filenames, paths, or keywords as needed.
telnet towel.blinkenlights.nl
Requires network or a remote resource.
mplayer -vo caca video.mp4
Copy it and replace filenames, paths, or keywords as needed.
screenfetch or neofetch
Copy it and replace filenames, paths, or keywords as needed.
fortune | cowsay
Uses pipes, overwrite, or deletion. Check paths and options first.
echo "text" | pv -qL 10
Uses pipes, overwrite, or deletion. Check paths and options first.
cmatrix
Copy it and replace filenames, paths, or keywords as needed.
mkdir project{01..100}
Copy it and replace filenames, paths, or keywords as needed.
cd -
Copy it and replace filenames, paths, or keywords as needed.
cp file{,.bak}
Copy it and replace filenames, paths, or keywords as needed.
^wrong^correct^
Copy it and replace filenames, paths, or keywords as needed.
curl ifconfig.me
Requires network or a remote resource.
!!
Copy it and replace filenames, paths, or keywords as needed.
Ctrl+X Ctrl+E
Copy it and replace filenames, paths, or keywords as needed.
jq .
Copy it and replace filenames, paths, or keywords as needed.
du -h . | sort -hr | head -20
Uses pipes, overwrite, or deletion. Check paths and options first.
df -h
Copy it and replace filenames, paths, or keywords as needed.
du -sh * | sort -hr
Uses pipes, overwrite, or deletion. Check paths and options first.
tar czf backup.tar.gz directory/
Copy it and replace filenames, paths, or keywords as needed.
tar xzf archive.tar.gz
Copy it and replace filenames, paths, or keywords as needed.
watch command
Copy it and replace filenames, paths, or keywords as needed.
pkill process_name
May affect permissions or system state. Check the target first.
top
Copy it and replace filenames, paths, or keywords as needed.
ss -tuln
Copy it and replace filenames, paths, or keywords as needed.
< /dev/urandom tr -dc A-Za-z0-9 | head -c 32; echo
Uses pipes, overwrite, or deletion. Check paths and options first.
Ctrl+R
Copy it and replace filenames, paths, or keywords as needed.
wc -l file.txt
Copy it and replace filenames, paths, or keywords as needed.
sort file | uniq
Uses pipes, overwrite, or deletion. Check paths and options first.
find . -iname "*.log"
Copy it and replace filenames, paths, or keywords as needed.
find . -type f -size +100M
Copy it and replace filenames, paths, or keywords as needed.
rsync -ah --progress src dest
Requires network or a remote resource.
wget -c url
Requires network or a remote resource.
sshfs user@host:/remote /local
Requires network or a remote resource.
command -v cmd >/dev/null && echo yes
Uses pipes, overwrite, or deletion. Check paths and options first.
ls -lt
Copy it and replace filenames, paths, or keywords as needed.
grep -ir "text" .
Copy it and replace filenames, paths, or keywords as needed.
> file.txt
Uses pipes, overwrite, or deletion. Check paths and options first.
mkdir dir && cd dir
Uses pipes, overwrite, or deletion. Check paths and options first.
tar cjf archive.tar.bz2 dir/
Copy it and replace filenames, paths, or keywords as needed.
curl wttr.in
Requires network or a remote resource.
curl v2.wttr.in
Requires network or a remote resource.
xmllint --format file.xml
Copy it and replace filenames, paths, or keywords as needed.
convert input.jpg output.png
Copy it and replace filenames, paths, or keywords as needed.
convert -delay 10 -loop 0 *.png animation.gif
Copy it and replace filenames, paths, or keywords as needed.
sl
Copy it and replace filenames, paths, or keywords as needed.
neofetch
Copy it and replace filenames, paths, or keywords as needed.
tail -f logfile
Copy it and replace filenames, paths, or keywords as needed.
sed -i 's/old/new/g' *.txt
Copy it and replace filenames, paths, or keywords as needed.
ls -d */
Copy it and replace filenames, paths, or keywords as needed.
tree
Copy it and replace filenames, paths, or keywords as needed.
command | xclip -sel clip
Uses pipes, overwrite, or deletion. Check paths and options first.
ln -s target link
Copy it and replace filenames, paths, or keywords as needed.
git branch --show-current
Copy it and replace filenames, paths, or keywords as needed.
find . -mtime +30 -delete
Copy it and replace filenames, paths, or keywords as needed.
find . -type d -empty -delete
Copy it and replace filenames, paths, or keywords as needed.
cal
Copy it and replace filenames, paths, or keywords as needed.
cal -3
Copy it and replace filenames, paths, or keywords as needed.
qrencode -t ANSI "text"
Copy it and replace filenames, paths, or keywords as needed.
script session.log
Copy it and replace filenames, paths, or keywords as needed.
scriptreplay -t timing.log session.log
Copy it and replace filenames, paths, or keywords as needed.
upower -i $(upower -e | grep BAT) | grep percentage
Uses pipes, overwrite, or deletion. Check paths and options first.
sensors
Copy it and replace filenames, paths, or keywords as needed.
crontab -l
Copy it and replace filenames, paths, or keywords as needed.
gpg -c file
May affect permissions or system state. Check the target first.
mount -t tmpfs -o size=1G tmpfs /mnt/ram
May affect permissions or system state. Check the target first.
command &
Uses pipes, overwrite, or deletion. Check paths and options first.
nohup command &
Uses pipes, overwrite, or deletion. Check paths and options first.
split -b 1G largefile part-
Copy it and replace filenames, paths, or keywords as needed.
cat part-* > largefile
Uses pipes, overwrite, or deletion. Check paths and options first.
sha256sum file
Copy it and replace filenames, paths, or keywords as needed.
yt-dlp url
Requires network or a remote resource.
mpv url
Requires network or a remote resource.
nl file.txt
Copy it and replace filenames, paths, or keywords as needed.
dos2unix file
Copy it and replace filenames, paths, or keywords as needed.
source ~/.bashrc
Copy it and replace filenames, paths, or keywords as needed.
uptime
Copy it and replace filenames, paths, or keywords as needed.
command | pv -s $(du -b input | cut -f1)
Uses pipes, overwrite, or deletion. Check paths and options first.
pdftotext file.pdf - | less
Uses pipes, overwrite, or deletion. Check paths and options first.
dd if=iso.iso of=/dev/sdX bs=4M status=progress
May affect permissions or system state. Check the target first.
dd if=/dev/urandom of=/dev/sdX
May affect permissions or system state. Check the target first.
lshw -short
Copy it and replace filenames, paths, or keywords as needed.
dd if=/dev/zero of=test bs=1G count=1 oflag=dsync
May affect permissions or system state. Check the target first.
echo -e "\a"
Copy it and replace filenames, paths, or keywords as needed.
timedatectl
Copy it and replace filenames, paths, or keywords as needed.
for i in {1..50}; do echo -e "\e[${((RANDOM%7+31))}m✨\e[0m"; sleep 0.1; done
Uses pipes, overwrite, or deletion. Check paths and options first.
echo "text" | lolcat
Uses pipes, overwrite, or deletion. Check paths and options first.
watch -n 1 date
Copy it and replace filenames, paths, or keywords as needed.
ls | wc -l
Uses pipes, overwrite, or deletion. Check paths and options first.
find . -xtype l
Copy it and replace filenames, paths, or keywords as needed.
ruby -run -e httpd . -p 8000
Copy it and replace filenames, paths, or keywords as needed.
php -S localhost:8000
Copy it and replace filenames, paths, or keywords as needed.
npx http-server
Copy it and replace filenames, paths, or keywords as needed.
alias r='fc -s'
Copy it and replace filenames, paths, or keywords as needed.
history | awk '{print $2}' | sort | uniq -c | sort -nr | head
Uses pipes, overwrite, or deletion. Check paths and options first.
a() { case $1 in *.tar.gz) tar xzf $1;; *.zip) unzip $1;; esac; }; a file
Uses pipes, overwrite, or deletion. Check paths and options first.
truncate -s 10G file.img
Copy it and replace filenames, paths, or keywords as needed.
gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf
Copy it and replace filenames, paths, or keywords as needed.
ffmpeg -i input.mp4 output.gif
Copy it and replace filenames, paths, or keywords as needed.
for f in *.txt; do mv "$f" "${f%.txt}.bak"; done
Uses pipes, overwrite, or deletion. Check paths and options first.
git status -sb
Copy it and replace filenames, paths, or keywords as needed.
while true; do echo -e "HTTP/1.1 200 OK\n\n$(date)" | nc -l 8080; done
Uses pipes, overwrite, or deletion. Check paths and options first.