【チートシート】cmdとterminal

コマンドプロンプト (Windows) ターミナル (Unix系)
現在のディレクトリを表示 cd pwd
ディレクトリを変更 cd directory_name cd directory_name
ディレクトリに移動 cd .. cd ..
ディレクトリの内容を表示 dir ls
新しいディレクトリを作成 mkdir directory_name mkdir directory_name
ディレクトリを削除 rmdir directory_name rmdir directory_name or rm -r directory_name
ファイルの内容を表示 type filename cat filename
ファイルをコピー copy source_file target_file cp source_file target_file
ファイルを移動または名前変更 move source_file target_file mv source_file target_file
ファイルを削除 del filename rm filename
テキストをファイルに書き込む echo text > filename echo text > filename
システムのIPアドレスを表示 ipconfig ifconfig or ip a
現在のユーザーを表示 echo %USERNAME% whoami
システムの再起動 shutdown /r /t 0 sudo reboot
システムのシャットダウン shutdown /s /t 0 sudo shutdown now
実行中のプロセスを表示 tasklist ps or top
プロセスを強制終了 taskkill /F /PID pid_number kill -9 pid_number
ネットワーク接続を確認 ping hostname_or_ip ping hostname_or_ip
ネットワーク経路を表示 tracert hostname_or_ip traceroute hostname_or_ip
ポートと接続を表示 netstat netstat or ss
環境変数の一覧を表示 set printenv
コマンドのヘルプを表示 help command man command
コマンドの実行結果を次のコマンドに渡す command1 | command2 command1 | command2
コマンドを続けて実行 コマンド1 & コマンド2 コマンド1 && コマンド2