Linux
Command
Library
GitHub
F-Droid
Google Play Store
Basics
Tips
Commands
One-liners
Run the previous command with sudo
$
sudo
!!
copy
Repeat the last command
$ !!
copy
Fix typo in the previous command
$ ^wrong^correct^
copy
Search command history interactively
$ Ctrl+R
copy
Edit current command line in your editor
$ Ctrl+X Ctrl+E
copy
Alias to repeat last command
$ alias r='fc -s'
copy
Show most used commands
$ history | awk '{print 2ドル}' | sort | uniq -c | sort -nr | head
copy
Reload shell configuration
$ source ~/.bashrc
copy
Check if command exists
$ command -v cmd >/dev/null && echo yes
copy
Change to the previous directory
$
cd
-
copy
Create directory and cd into it
$
mkdir
dir &&
cd
dir
copy
Create 100 numbered directories
$
mkdir
project{01..100}
copy
Quickly backup a file
$
cp
file{,.bak}
copy
Empty/truncate a file
$ > file.txt
copy
Batch rename files
$ for f in *.txt; do mv "$f" "${f%.txt}.bak"; done
copy
Create symlink
$
ln
-s target link
copy
Show only directories
$
ls
-d */
copy
List files by modification time
$
ls
-lt
copy
Count files in directory
$
ls
|
wc
-l
copy
Tree view of directory
$
tree
copy
Show file with line numbers
$
nl
file.txt
copy
Count lines in a file
$
wc
-l file.txt
copy
Remove duplicate lines
$
sort
file |
uniq
copy
Search and replace in files
$
sed
-i 's/old/new/g' *.txt
copy
Grep recursively ignoring case
$
grep
-ir "text" .
copy
Find files by name
$
find
. -iname "*.log"
copy
Find files larger than 100MB
$
find
. -type f -size +100M
copy
Delete files older than 30 days
$
find
. -mtime +30 -delete
copy
Find and delete empty directories
$
find
. -type d -empty -delete
copy
Find broken symlinks
$
find
. -xtype l
copy
Find largest files and directories
$
du
-ah . |
sort
-hr |
head
-20
copy
Show directory sizes sorted
$
du
-sh * |
sort
-hr
copy
Show disk usage in human-readable format
$
df
-h
copy
Monitor file changes
$
tail
-f logfile
copy
Watch command output refresh every 2 seconds
$
watch
command
copy
Display clock in terminal
$
watch
-n 1 date
copy
Create a tar.gz backup
$
tar
czf backup.tar.gz directory/
copy
Extract a tar.gz archive
$
tar
xzf archive.tar.gz
copy
Extract any archive format
$
atool
-x archive
copy
Split large file
$
split
-b 1G largefile part-
copy
Reassemble split files
$
cat
part-* > largefile
copy
Check file checksum
$
sha256sum
file
copy
Encrypt file with gpg
$
gpg
-c file
copy
Generate random password
$ < /dev/urandom
tr
-dc A-Za-z0-9 |
head
-c 32; echo
copy
Copy with progress bar
$
rsync
-ah --progress src dest
copy
Progress bar for any pipe
$
pv
largefile |
gzip
> largefile.gz
copy
Create sparse 10GB file
$
truncate
-s 10G file.img
copy
Convert DOS to Unix line endings
$
dos2unix
file
copy
Pretty-print JSON from stdin
$
jq
.
copy
Pretty-print XML
$
xmllint
--format file.xml
copy
Pipe output to clipboard
$ command |
xclip
-sel clip
copy
Run command in background
$ command &
copy
Run detached from terminal
$
nohup
command &
copy
Kill process by name
$
pkill
process_name
copy
View processes sorted by CPU
$
top
copy
Check system uptime
$
uptime
copy
List cron jobs
$
crontab
-l
copy
List hardware info
$
lshw
-short
copy
Monitor CPU temperature
$
sensors
copy
Check battery percentage
$
upower
-i $(upower -e | grep BAT) | grep percentage
copy
Show current timezone
$
timedatectl
copy
Show calendar
$
cal
copy
Show previous, current, and next month
$
cal
-3
copy
Create RAM disk
$
mount
-t tmpfs -o size=1G tmpfs /mnt/ram
copy
Disk speed test
$
dd
if=/dev/zero of=test bs=1G count=1 oflag=dsync
copy
Burn ISO to USB
$
dd
if=iso.iso of=/dev/sdX bs=4M status=progress
copy
Securely wipe drive
$
shred
-v /dev/sdX
copy
Record terminal session
$
script
--log-timing timing.log session.log
copy
Replay terminal session
$
scriptreplay
--log-timing timing.log session.log
copy
Get your public IP address
$
curl
ifconfig.me
copy
List open network ports
$
ss
-tuln
copy
Download file with resume
$
wget
-c url
copy
Mount remote directory over SSH
$
sshfs
user@host:/remote /local
copy
Spin up a local HTTP server
$
python3
-m http.server 8000
copy
Quick HTTP server in Ruby
$
ruby
-run -e httpd . -p 8000
copy
Quick HTTP server in PHP
$
php
-S localhost:8000
copy
Quick HTTP server in Node.js
$
npx
http-server
copy
One-liner web server in bash
$ while true; do echo -e "HTTP/1.1 200 OK\n\n$(date)" | nc -l 8080; done
copy
Show weather in terminal
$
curl
wttr.in
copy
Get full weather report
$
curl
v2.wttr.in
copy
Generate QR code
$
qrencode
-t ANSI "text"
copy
Download YouTube video
$
yt-dlp
url
copy
Play YouTube video in terminal
$
mpv
url
copy
Play a video in terminal as ASCII
$
mplayer
-vo caca video.mp4
copy
Convert image to different format
$
convert
input.jpg output.png
copy
Create animated GIF from images
$
convert
-delay 10 -loop 0 *.png animation.gif
copy
Convert video to GIF
$
ffmpeg
-i input.mp4 output.gif
copy
Merge multiple PDFs
$
gs
-dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf
copy
View PDF in terminal
$
pdftotext
file.pdf - |
less
copy
Show current git branch
$
git
branch --show-current
copy
Show git status nicely
$
git
status -sb
copy
Display system info with ASCII art
$
neofetch
copy
$
screenfetch
copy
Display fortune and cow
$
fortune
|
cowsay
copy
Rainbow text
$ echo "text" |
lolcat
copy
Simulate slow typing
$ echo "text" |
pv
-qL 10
copy
Matrix digital rain
$
cmatrix
copy
Run the train animation
$
sl
copy
Play beep
$ echo -e "\a"
copy
Copied to clipboard
Kai
AltStyle
によって変換されたページ
(->オリジナル)
/
アドレス:
モード:
デフォルト
音声ブラウザ
ルビ付き
配色反転
文字拡大
モバイル