Linux コマンドリファレンス
基本コマンド & RHEL系コマンド完全ガイド
すべて
基本コマンド
ファイル操作
システム管理
ネットワーク
RHEL系
基本コマンド
ls
ディレクトリの内容を一覧表示
ls [オプション] [ディレクトリ]
ls -la
ls -lh /home
ls --color=auto
基本コマンド
cd
ディレクトリを移動
cd [ディレクトリ]
cd /home/user
cd ..
cd ~
基本コマンド
pwd
現在のディレクトリパスを表示
pwd
pwd
ファイル操作
cp
ファイルやディレクトリをコピー
cp [オプション] コピー元 コピー先
cp file1.txt file2.txt
cp -r dir1 dir2
cp -p file.txt backup/
ファイル操作
mv
ファイルやディレクトリを移動・リネーム
mv 移動元 移動先
mv file1.txt file2.txt
mv file.txt /home/user/
mv dir1 dir2
ファイル操作
rm
ファイルやディレクトリを削除
rm [オプション] ファイル名
rm file.txt
rm -rf directory
rm -i *.txt
ファイル操作
mkdir
ディレクトリを作成
mkdir [オプション] ディレクトリ名
mkdir newdir
mkdir -p path/to/dir
mkdir -m 755 dir
ファイル操作
cat
ファイルの内容を表示
cat [オプション] ファイル名
cat file.txt
cat -n file.txt
cat file1 file2 > combined.txt
ファイル操作
grep
テキストパターンを検索
grep [オプション] パターン ファイル名
grep "error" log.txt
grep -r "pattern" /path/
grep -i "case" file.txt
ファイル操作
find
ファイルやディレクトリを検索
find パス 条件
find /home -name "*.txt"
find . -type f -size +100M
find /var -mtime -7
システム管理
ps
実行中のプロセスを表示
ps [オプション]
ps aux
ps -ef
ps -u username
システム管理
top
システムリソースとプロセスをリアルタイム表示
top [オプション]
top
top -u username
top -p PID
システム管理
df
ディスク使用量を表示
df [オプション] [ファイルシステム]
df -h
df -i
df /home
システム管理
du
ディレクトリのディスク使用量を表示
du [オプション] [ディレクトリ]
du -sh *
du -h --max-depth=1
du -a /var/log
システム管理
chmod
ファイルの権限を変更
chmod [オプション] モード ファイル名
chmod 755 script.sh
chmod +x file
chmod -R 644 /path/
システム管理
chown
ファイルの所有者を変更
chown [オプション] 所有者[:グループ] ファイル名
chown user:group file.txt
chown -R user /path/
chown :group file
ネットワーク
ping
ネットワーク接続をテスト
ping [オプション] ホスト名/IP
ping google.com
ping -c 4 192.168.1.1
ping -i 2 server.com
ネットワーク
wget
ファイルをダウンロード
wget [オプション] URL
wget https://example.com/file.zip
wget -O newname.zip https://example.com/file.zip
wget -r https://example.com/
ネットワーク
curl
データ転送ツール
curl [オプション] URL
curl https://api.example.com
curl -O https://example.com/file.zip
curl -X POST -d "data" https://api.com
RHEL系
yum
パッケージ管理(RHEL/CentOS 7以前)
yum [オプション] コマンド [パッケージ名]
yum install package-name
yum update
yum search keyword
RHEL系
dnf
パッケージ管理(RHEL/CentOS 8以降)
dnf [オプション] コマンド [パッケージ名]
dnf install package-name
dnf update
dnf list installed
RHEL系
rpm
RPMパッケージ管理
rpm [オプション] パッケージファイル
rpm -ivh package.rpm
rpm -qa | grep package
rpm -e package-name
RHEL系
systemctl
systemdサービス管理
systemctl [コマンド] [サービス名]
systemctl start httpd
systemctl enable firewalld
systemctl status sshd
RHEL系
firewall-cmd
firewalld設定管理
firewall-cmd [オプション]
firewall-cmd --list-all
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --reload
RHEL系
semanage
SELinux設定管理
semanage [オブジェクト] [オプション]
semanage port -l
semanage fcontext -a -t httpd_exec_t "/path/to/file"
semanage boolean -l
RHEL系
subscription-manager
Red Hat サブスクリプション管理
subscription-manager [コマンド] [オプション]
subscription-manager register
subscription-manager list --available
subscription-manager attach --auto