完全無料

Linux / Bash コマンド チートシート

Linux・Bashコマンドの総合チートシート。80以上のコマンドを検索し、説明・例・コピー機能付きで参照できます。

ls
List directory contents
例:ls -la /home/user
ls -la
List all files including hidden, with details
例:ls -la ~/Documents
cd
Change directory
例:cd /var/log
pwd
Print working directory path
例:pwd
mkdir
Create a new directory
例:mkdir -p /tmp/mydir/subdir
rm
Remove files or directories
例:rm -rf /tmp/oldfiles
cp
Copy files or directories
例:cp -r /src/dir /dst/dir
mv
Move or rename files/directories
例:mv oldname.txt newname.txt
touch
Create an empty file or update timestamp
例:touch newfile.txt
find
Search for files in a directory hierarchy
例:find /home -name '*.log' -mtime -7
locate
Find files by name using a prebuilt database
例:locate nginx.conf
ln
Create hard or symbolic links
例:ln -s /path/to/target /path/to/link
df
Report disk space usage of file systems
例:df -h
du
Estimate file space usage
例:du -sh /var/log/*
stat
Display file or file system status
例:stat /etc/passwd
file
Determine file type
例:file /usr/bin/bash
cat
Concatenate and display file contents
例:cat /etc/hosts
less
View file content one screen at a time
例:less /var/log/syslog
more
View file content page by page
例:more /etc/passwd
head
Output the first part of a file
例:head -n 20 /var/log/auth.log
tail
Output the last part of a file
例:tail -f /var/log/syslog
grep
Search text using patterns
例:grep -rn 'error' /var/log/
sed
Stream editor for filtering and transforming text
例:sed 's/old/new/g' file.txt
awk
Pattern scanning and text processing language
例:awk '{print $1, $3}' access.log
sort
Sort lines of text files
例:sort -k2 -n data.txt
uniq
Report or omit repeated lines
例:sort file.txt | uniq -c
wc
Print newline, word, and byte counts
例:wc -l /etc/passwd
cut
Remove sections from each line of files
例:cut -d: -f1 /etc/passwd
tr
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 42
diff
Compare files line by line
例:diff file1.txt file2.txt
tee
Read from stdin and write to stdout and files
例:ls | tee output.txt
ps
Report a snapshot of current processes
例:ps aux | grep nginx
top
Display Linux processes in real time
例:top -u www-data
htop
Interactive process viewer (ncurses-based)
例:htop
kill
Send a signal to a process
例:kill -9 1234
killall
Kill processes by name
例:killall firefox
bg
Resume a suspended job in the background
例:bg %1
fg
Bring a job to the foreground
例:fg %1
jobs
List active jobs in the current shell
例:jobs -l
nohup
Run a command immune to hangups
例:nohup ./script.sh &
nice
Run a command with modified scheduling priority
例:nice -n 10 ./heavy_task.sh
systemctl
Control the systemd system and service manager
例:systemctl restart nginx
service
Run a System V init script
例:service apache2 status
ping
Send ICMP ECHO_REQUEST to network hosts
例:ping -c 4 google.com
curl
Transfer data from or to a server
例:curl -L -o file.zip https://example.com/file.zip
wget
Non-interactive network downloader
例:wget -q https://example.com/file.tar.gz
ssh
OpenSSH remote login client
例:ssh -i ~/.ssh/key.pem user@host
scp
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 -tulpn
ss
Utility to investigate sockets
例:ss -tulwn
ifconfig
Configure a network interface
例:ifconfig eth0
ip
Show and manipulate routing, devices, and tunnels
例:ip addr show
nmap
Network exploration tool and port scanner
例:nmap -sV 192.168.1.0/24
dig
DNS lookup utility
例:dig +short A google.com
nslookup
Query Internet name servers interactively
例:nslookup example.com
chmod
Change file mode bits (permissions)
例:chmod 755 script.sh
chown
Change file owner and group
例:chown -R www-data:www-data /var/www
chgrp
Change group ownership
例:chgrp developers project/
sudo
Execute a command as another user (superuser)
例:sudo systemctl restart nginx
su
Change user ID or become superuser
例:su - postgres
passwd
Change user password
例:passwd username
umask
Set or display the file mode creation mask
例:umask 022
id
Print user and group information
例:id username
whoami
Print the current effective user name
例:whoami
groups
Print the groups a user is in
例:groups username
tar
Archive files using tape archive format
例:tar -czvf archive.tar.gz /path/to/dir
tar -x
Extract files from a tar archive
例:tar -xzvf archive.tar.gz -C /target/
gzip
Compress files using GNU zip
例:gzip -9 large_file.log
gunzip
Decompress gzip compressed files
例:gunzip archive.tar.gz
zip
Package and compress files into a ZIP archive
例:zip -r output.zip /path/to/dir
unzip
Extract files from a ZIP archive
例:unzip archive.zip -d /target/
bzip2
Compress files using bzip2 algorithm
例:bzip2 -z large_file.txt
xz
Compress files using the XZ algorithm
例:xz -z -9 file.txt
uname
Print system information
例:uname -a
uptime
Tell how long the system has been running
例:uptime
free
Display amount of free and used memory
例:free -h
lscpu
Display information about the CPU architecture
例:lscpu
lsblk
List information about block devices
例:lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
lspci
List all PCI devices
例:lspci -v | grep VGA
dmesg
Print or control the kernel ring buffer
例:dmesg | tail -50
journalctl
Query and display messages from the journal
例:journalctl -u nginx --since '1 hour ago'
history
Display the command history list
例:history | grep docker
env
Print environment variables
例:env | grep PATH
if / then / fi
Conditional execution in shell scripts
例:if [ -f file.txt ]; then echo exists; fi
for
Loop over a list of items
例:for i in 1 2 3; do echo $i; done
while
Execute commands while a condition is true
例:while read line; do echo $line; done < file
case
Multi-branch conditional matching pattern
例:case "$var" in a) echo A;; b) echo B;; esac
function
Define a shell function
例:greet() { echo "Hello, $1!"; }; greet World
export
Set environment variables for child processes
例:export MY_VAR=value
source
Execute commands from a file in current shell
例:source ~/.bashrc
alias
Create an alias for a command
例:alias ll='ls -la'
cron / crontab
Schedule commands to run periodically
例:crontab -e # 0 * * * * /path/to/script.sh
at
Execute commands at a specified time
例:echo 'ls /tmp' | at 14:30

このツールについて

Linux bash の包括的なクイックリファレンス ガイド。よく使用されるコマンド、構文、例をカテゴリ別に整理して参照します。検索可能でモバイル対応 — このページをブックマークすると、簡単なリマインダーが必要なときにすぐにアクセスできます。

使い方

  1. 分類された参考セクションを参照してください。
  2. 検索バーを使用して、特定のコマンドまたは構文を検索します。
  3. いずれかのエントリをクリックすると、使用例と説明が表示されます。
  4. コマンドを直接コピーして、ターミナルまたはエディタで使用します。

よくある質問

このリファレンスは最新ですか?
このリファレンスでは、バージョン間で安定した、広く使用されているコマンドと構文を取り上げます。最新の追加機能やバージョン固有の機能については、公式ドキュメントを確認してください。
これはオフラインでも使用できますか?
ページが読み込まれると、インターネット接続がなくても機能します。ブックマークすると、すぐにアクセスできます。すべてのコンテンツは、追加のネットワーク リクエストを行わなくてもブラウザーでレンダリングされます。
これは包括的なものですか、それとも単なる基本ですか?
日常のタスクの 90% を処理する最も一般的に使用されるコマンドとパターンをカバーしています。ニッチな機能または高度な機能については、公式ドキュメントを参照してください。
追加を提案できますか?
リファレンスは定期的に更新されます。不足しているコマンドに気付いた場合、または提案がある場合は、お問い合わせページからお知らせください。