完全無料
Linux / Bash コマンド チートシート
Linux・Bashコマンドの総合チートシート。80以上のコマンドを検索し、説明・例・コピー機能付きで参照できます。
ls
List directory contents
例:
ls -la /home/userls -la
List all files including hidden, with details
例:
ls -la ~/Documentscd
Change directory
例:
cd /var/logpwd
Print working directory path
例:
pwdmkdir
Create a new directory
例:
mkdir -p /tmp/mydir/subdirrm
Remove files or directories
例:
rm -rf /tmp/oldfilescp
Copy files or directories
例:
cp -r /src/dir /dst/dirmv
Move or rename files/directories
例:
mv oldname.txt newname.txttouch
Create an empty file or update timestamp
例:
touch newfile.txtfind
Search for files in a directory hierarchy
例:
find /home -name '*.log' -mtime -7locate
Find files by name using a prebuilt database
例:
locate nginx.confln
Create hard or symbolic links
例:
ln -s /path/to/target /path/to/linkdf
Report disk space usage of file systems
例:
df -hdu
Estimate file space usage
例:
du -sh /var/log/*stat
Display file or file system status
例:
stat /etc/passwdfile
Determine file type
例:
file /usr/bin/bashcat
Concatenate and display file contents
例:
cat /etc/hostsless
View file content one screen at a time
例:
less /var/log/syslogmore
View file content page by page
例:
more /etc/passwdhead
Output the first part of a file
例:
head -n 20 /var/log/auth.logtail
Output the last part of a file
例:
tail -f /var/log/sysloggrep
Search text using patterns
例:
grep -rn 'error' /var/log/sed
Stream editor for filtering and transforming text
例:
sed 's/old/new/g' file.txtawk
Pattern scanning and text processing language
例:
awk '{print $1, $3}' access.logsort
Sort lines of text files
例:
sort -k2 -n data.txtuniq
Report or omit repeated lines
例:
sort file.txt | uniq -cwc
Print newline, word, and byte counts
例:
wc -l /etc/passwdcut
Remove sections from each line of files
例:
cut -d: -f1 /etc/passwdtr
Translate or delete characters
例:
echo 'hello' | tr 'a-z' 'A-Z'echo
Display a line of text
例:
echo "Hello, World!"printf
Format and print data
例:
printf "%s\t%d\n" name 42diff
Compare files line by line
例:
diff file1.txt file2.txttee
Read from stdin and write to stdout and files
例:
ls | tee output.txtps
Report a snapshot of current processes
例:
ps aux | grep nginxtop
Display Linux processes in real time
例:
top -u www-datahtop
Interactive process viewer (ncurses-based)
例:
htopkill
Send a signal to a process
例:
kill -9 1234killall
Kill processes by name
例:
killall firefoxbg
Resume a suspended job in the background
例:
bg %1fg
Bring a job to the foreground
例:
fg %1jobs
List active jobs in the current shell
例:
jobs -lnohup
Run a command immune to hangups
例:
nohup ./script.sh &nice
Run a command with modified scheduling priority
例:
nice -n 10 ./heavy_task.shsystemctl
Control the systemd system and service manager
例:
systemctl restart nginxservice
Run a System V init script
例:
service apache2 statusping
Send ICMP ECHO_REQUEST to network hosts
例:
ping -c 4 google.comcurl
Transfer data from or to a server
例:
curl -L -o file.zip https://example.com/file.zipwget
Non-interactive network downloader
例:
wget -q https://example.com/file.tar.gzssh
OpenSSH remote login client
例:
ssh -i ~/.ssh/key.pem user@hostscp
Secure copy files between hosts
例:
scp user@host:/path/file.txt ./local/rsync
Remote file copying tool with delta transfer
例:
rsync -avz /src/ user@host:/dst/netstat
Print network connections and routing tables
例:
netstat -tulpnss
Utility to investigate sockets
例:
ss -tulwnifconfig
Configure a network interface
例:
ifconfig eth0ip
Show and manipulate routing, devices, and tunnels
例:
ip addr shownmap
Network exploration tool and port scanner
例:
nmap -sV 192.168.1.0/24dig
DNS lookup utility
例:
dig +short A google.comnslookup
Query Internet name servers interactively
例:
nslookup example.comchmod
Change file mode bits (permissions)
例:
chmod 755 script.shchown
Change file owner and group
例:
chown -R www-data:www-data /var/wwwchgrp
Change group ownership
例:
chgrp developers project/sudo
Execute a command as another user (superuser)
例:
sudo systemctl restart nginxsu
Change user ID or become superuser
例:
su - postgrespasswd
Change user password
例:
passwd usernameumask
Set or display the file mode creation mask
例:
umask 022id
Print user and group information
例:
id usernamewhoami
Print the current effective user name
例:
whoamigroups
Print the groups a user is in
例:
groups usernametar
Archive files using tape archive format
例:
tar -czvf archive.tar.gz /path/to/dirtar -x
Extract files from a tar archive
例:
tar -xzvf archive.tar.gz -C /target/gzip
Compress files using GNU zip
例:
gzip -9 large_file.loggunzip
Decompress gzip compressed files
例:
gunzip archive.tar.gzzip
Package and compress files into a ZIP archive
例:
zip -r output.zip /path/to/dirunzip
Extract files from a ZIP archive
例:
unzip archive.zip -d /target/bzip2
Compress files using bzip2 algorithm
例:
bzip2 -z large_file.txtxz
Compress files using the XZ algorithm
例:
xz -z -9 file.txtuname
Print system information
例:
uname -auptime
Tell how long the system has been running
例:
uptimefree
Display amount of free and used memory
例:
free -hlscpu
Display information about the CPU architecture
例:
lscpulsblk
List information about block devices
例:
lsblk -o NAME,SIZE,TYPE,MOUNTPOINTlspci
List all PCI devices
例:
lspci -v | grep VGAdmesg
Print or control the kernel ring buffer
例:
dmesg | tail -50journalctl
Query and display messages from the journal
例:
journalctl -u nginx --since '1 hour ago'history
Display the command history list
例:
history | grep dockerenv
Print environment variables
例:
env | grep PATHif / then / fi
Conditional execution in shell scripts
例:
if [ -f file.txt ]; then echo exists; fifor
Loop over a list of items
例:
for i in 1 2 3; do echo $i; donewhile
Execute commands while a condition is true
例:
while read line; do echo $line; done < filecase
Multi-branch conditional matching pattern
例:
case "$var" in a) echo A;; b) echo B;; esacfunction
Define a shell function
例:
greet() { echo "Hello, $1!"; }; greet Worldexport
Set environment variables for child processes
例:
export MY_VAR=valuesource
Execute commands from a file in current shell
例:
source ~/.bashrcalias
Create an alias for a command
例:
alias ll='ls -la'cron / crontab
Schedule commands to run periodically
例:
crontab -e # 0 * * * * /path/to/script.shat
Execute commands at a specified time
例:
echo 'ls /tmp' | at 14:30