InfraLab
LINUX94 cmd

Linuxコマンドチート集

ファイル管理・プロセス・ネットワーク・パッケージなど、日常で使う Linux コマンドを用途別にまとめたチート集。

更新日
2026-05-29
参照範囲
公式ドキュメント / man page / 主要ベンダーCLI
対象実装
主要 Linux / BSD / ネットワーク機器 CLI の一般的な実装
免責
OS とバージョン差分は実環境で確認してください。

このチートシートの使いどころ

Linux コマンドチートシートは、ファイル操作、権限、プロセス、テキスト処理、検索、アーカイブ、ディスク/メモリ確認を日本語で用途別にまとめた基本コマンド一覧です。対象は一般的な GNU/Linux のコアユーティリティで、ディストリビューション差分は実環境で確認します。サーバーへログインした直後の状況把握、障害時のリソース確認、ファイル探索や一括処理の起点に使えます。

94 / 94

ls

ファイルとディレクトリの一覧を表示

Example
ls -la
cp

ファイルやディレクトリをコピー

Example
cp -r src/ dest/
mv

ファイルやディレクトリを移動・名前変更

Example
mv old.txt new.txt
rm

ファイルやディレクトリを削除

Example
rm -rf directory/
touch

空ファイルを作成またはタイムスタンプを更新

Example
touch newfile.txt
cat

ファイルの内容を表示

Example
cat file.txt
less

ファイルの内容をページ単位で表示

Example
less largefile.log
head

ファイルの先頭部分を表示

Example
head -n 20 file.txt
tail

ファイルの末尾部分を表示

Example
tail -f /var/log/syslog
ln

リンク(ハード/シンボリック)を作成

Example
ln -s /path/to/target link_name
file

ファイルの種類を判定

Example
file image.png
stat

ファイルの詳細情報を表示

Example
stat file.txt
cd

ディレクトリを移動

Example
cd /var/log
pwd

現在のディレクトリを表示

Example
pwd
mkdir

ディレクトリを作成

Example
mkdir -p parent/child/dir
rmdir

空のディレクトリを削除

Example
rmdir empty_dir
find

ファイルやディレクトリを検索

Example
find / -name '*.log' -mtime -7
locate

データベースからファイルを高速検索

Example
locate nginx.conf
tree

ディレクトリ構造をツリー表示

Example
tree -L 2
du

ディレクトリのディスク使用量を表示

Example
du -sh /var/*
chmod

ファイルのアクセス権限を変更

Example
chmod 755 script.sh
chown

ファイルの所有者を変更

Example
chown user:group file.txt
chgrp

ファイルのグループを変更

Example
chgrp developers project/
umask

デフォルトのファイル作成権限を設定

Example
umask 022
setfacl

ACL(アクセス制御リスト)を設定

Example
setfacl -m u:user:rwx file
getfacl

ACL(アクセス制御リスト)を表示

Example
getfacl file.txt
ps

実行中のプロセスを表示

Example
ps aux | grep nginx
top

リアルタイムでプロセス情報を表示

Example
top -u username
htop

対話的なプロセスビューア

Example
htop
kill

プロセスにシグナルを送信

Example
kill -9 1234
killall

名前でプロセスを終了

Example
killall nginx
bg

停止中のジョブをバックグラウンドで再開

Example
bg %1
fg

バックグラウンドジョブをフォアグラウンドに

Example
fg %1
nohup

ログアウト後もプロセスを実行し続ける

Example
nohup ./script.sh &
nice

優先度を指定してプロセスを実行

Example
nice -n 10 ./heavy_task.sh
systemctl

systemdサービスの管理

Example
systemctl restart nginx
ip

ネットワークインターフェース・ルーティングの管理

Example
ip addr show
ping

ネットワーク接続を確認

Example
ping -c 4 google.com
curl

URLからデータを転送

Example
curl -X POST -d '{"key":"val"}' https://api.example.com
wget

ファイルをダウンロード

Example
wget https://example.com/file.tar.gz
ss

ソケット統計情報を表示

Example
ss -tulnp
netstat

ネットワーク接続・ルーティングテーブルを表示

Example
netstat -tulnp
traceroute

パケットの経路を追跡

Example
traceroute google.com
dig

DNS情報を照会

Example
dig example.com MX
nslookup

DNS名前解決を実行

Example
nslookup example.com
iptables

ファイアウォールルールを管理

Example
iptables -L -n
scp

SSH経由でファイルをコピー

Example
scp file.txt user@host:/path/
rsync

ファイルを効率的に同期

Example
rsync -avz src/ user@host:dest/
df

ファイルシステムのディスク使用量を表示

Example
df -h
mount

ファイルシステムをマウント

Example
mount /dev/sdb1 /mnt/usb
umount

ファイルシステムをアンマウント

Example
umount /mnt/usb
fdisk

ディスクパーティションを管理

Example
fdisk -l
lsblk

ブロックデバイスの一覧を表示

Example
lsblk
mkfs

ファイルシステムを作成(フォーマット)

Example
mkfs.ext4 /dev/sdb1
fsck

ファイルシステムの整合性チェックと修復

Example
fsck /dev/sda1
whoami

現在のユーザー名を表示

Example
whoami
id

ユーザーID・グループIDを表示

Example
id username
useradd

新しいユーザーを作成

Example
useradd -m -s /bin/bash newuser
userdel

ユーザーを削除

Example
userdel -r username
usermod

ユーザーアカウントを変更

Example
usermod -aG docker username
passwd

ユーザーのパスワードを変更

Example
passwd username
su

別のユーザーに切り替え

Example
su - root
sudo

管理者権限でコマンドを実行

Example
sudo apt update
groups

ユーザーが所属するグループを表示

Example
groups username
apt update

パッケージリストを更新(Debian/Ubuntu)

Example
sudo apt update
apt install

パッケージをインストール(Debian/Ubuntu)

Example
sudo apt install nginx
apt remove

パッケージを削除(Debian/Ubuntu)

Example
sudo apt remove nginx
apt upgrade

インストール済みパッケージを更新(Debian/Ubuntu)

Example
sudo apt upgrade
apt search

パッケージを検索(Debian/Ubuntu)

Example
apt search nodejs
yum install

パッケージをインストール(RHEL/CentOS)

Example
sudo yum install nginx
yum remove

パッケージを削除(RHEL/CentOS)

Example
sudo yum remove nginx
yum update

パッケージを更新(RHEL/CentOS)

Example
sudo yum update
dnf install

パッケージをインストール(Fedora)

Example
sudo dnf install nginx
uname

システム情報を表示

Example
uname -a
hostname

ホスト名を表示・設定

Example
hostname -I
uptime

システムの稼働時間を表示

Example
uptime
date

日時を表示・設定

Example
date '+%Y-%m-%d %H:%M:%S'
free

メモリ使用量を表示

Example
free -h
lscpu

CPU情報を表示

Example
lscpu
dmesg

カーネルメッセージを表示

Example
dmesg | tail -20
journalctl

systemdジャーナルログを表示

Example
journalctl -u nginx -f
env

環境変数を表示

Example
env | grep PATH
export

環境変数を設定

Example
export PATH=$PATH:/usr/local/bin
grep

テキストパターンを検索

Example
grep -rn 'error' /var/log/
sed

ストリームエディタ(テキスト置換・変換)

Example
sed -i 's/old/new/g' file.txt
awk

テキスト処理・パターンスキャン

Example
awk '{print $1, $3}' file.txt
sort

テキスト行をソート

Example
sort -k2 -n file.txt
uniq

重複行を削除・検出

Example
sort file.txt | uniq -c
wc

行数・単語数・バイト数をカウント

Example
wc -l file.txt
cut

テキストのフィールドを切り出し

Example
cut -d':' -f1 /etc/passwd
tr

文字の変換・削除

Example
echo 'HELLO' | tr 'A-Z' 'a-z'
diff

ファイルの差分を表示

Example
diff file1.txt file2.txt
tee

標準入力をファイルと標準出力に分岐

Example
echo 'log' | tee output.log
xargs

標準入力からコマンドライン引数を構築

Example
find . -name '*.log' | xargs rm
対応ツール
Related