コマンドプロンプト Tips
-
Upload
masafumi-yokoyama -
Category
Documents
-
view
857 -
download
3
description
Transcript of コマンドプロンプト Tips
![Page 1: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/1.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
コマンドプロンプトTips
Masafumi Yokoyama社内勉強会2013
2013/05/17
![Page 2: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/2.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
テーマ
Windowsの黒い画面を便利に使う方法
![Page 3: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/3.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
agenda
OSとの関係
起動方法
Unix風コマンド
![Page 4: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/4.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
OSとの関係
![Page 5: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/5.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
テーマ
Windowsの黒い画面を便利に使う方法
![Page 6: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/6.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
黒い画面
OSのCLI
![Page 7: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/7.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
CLIコマンドラインインターフェース
キーボードなどから入力した文字によって、OSなどのソフトウェアを操作できる仕組み
![Page 8: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/8.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
CLIに似た用語
コマンドライン
コマンドラインインタープリター
CUI キャラクターユーザーインターフェース(和製英語)
コンソール
シェル
![Page 9: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/9.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
シェルshell
広義
OSのインターフェースソフトウェア
狭義
UnixのCLI
※シェルとシェルスクリプトは別物
![Page 10: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/10.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
Unixゆにっくす
OSの系統マルチタスク・マルチユーザー
様々な種類がある
商用/フリー共に百種類以上
様々な場所で使われている
サーバー/PC/家電/車
![Page 11: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/11.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
いろいろなCLI
Unix, Linux , Mac OS X
sh, ksh, bash, zsh ...
Windows
COMMAND.COM (MS-DOS, 9x系)
cmd.exe (NT系)
Windows PowerShell
![Page 12: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/12.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
Windows NT系
いわゆる2000以降のWindowsNT, 2000, XP, Vista, 7, 8
Windows Server 2000以降
9x系とは内部構造が異なる
![Page 13: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/13.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
コマンドプロンプト
cmd.exeの通称
現代のWindowsの標準CLI
![Page 14: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/14.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
CLIでできること
Unix, Linux
全部
Windows
一部
![Page 15: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/15.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
CLIでできること※イメージ図
![Page 16: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/16.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
CLIでできること
Windows PowerShellにご期待ください。
![Page 17: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/17.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
起動方法
![Page 18: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/18.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
起動方法
普通に起動
![Page 19: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/19.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
普通に起動
スタートメニュー1.
すべてのプログラム2.
アクセサリ3.
コマンドプロンプト4.
![Page 20: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/20.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
普通に起動
Windowsキー + r1.
cmdと入力してEnter2.
![Page 21: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/21.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
起動方法
普通に起動
エクスプローラーの場所を開く
![Page 22: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/22.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
エクスプローラーから(Vista/7)
エクスプローラーが開いている1.
Shift + 右クリック2.
コマンドウィンドウをここで開くを選択
3.
![Page 23: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/23.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
エクスプローラーから(Vista/7)
エクスプローラーが開いている1.
Alt + d でアドレスバーに移動2.
cmdと入力してEnter3.
![Page 24: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/24.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
エクスプローラーから(XP)
エクスプローラーが開いている1.
Alt + d でアドレスバーに移動2.
%comspec%と入力してEnter3.
![Page 25: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/25.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
ComSpec
環境変数
標準CLIのフルパス
# 98C:\WINDOWS\COMMAND.COM
# XPC:\WINDOWS\system32\cmd.exe
![Page 26: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/26.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
Unix風コマンド
![Page 27: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/27.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
マニュアル表示
Unix
$ man コマンド名
Windows
> コマンド名 /?
![Page 28: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/28.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
ネットワーク接続確認
Unix
$ ping IPアドレス/ホスト名
Windows
> ping IPアドレス/ホスト名
![Page 29: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/29.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
IPアドレス確認
Unix
$ ifconfig
Windows
> ipconfig
![Page 30: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/30.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
ファイル内容表示
Unix
$ cat FILE...
Windows
> type FILE...
![Page 31: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/31.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
ファイル検索
Unix
$ find DIR... -name "WILD_CARD"
Windows
> dir /b /s WILD_CARD
![Page 32: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/32.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
ディレクトリツリー表示
Windows
> tree [/c] [/f]
![Page 33: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/33.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
ファイル内検索grep
Unix
$ grep [-n] "PATTERN" FILE...
Windows
> findstr [/n] "PATTERN" FILE...
![Page 34: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/34.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
ファイル内検索サブディレクトリを含む
Unix
$ find DIR... | xargs grep "PATTERN"
Windows
> findstr /s "PATTERN" [DIR/]WILD_CARD
![Page 35: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/35.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
行数を数える
Unix
$ wc -l FILE...
Windows
> find /c /v "" FILE...
![Page 36: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/36.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
行数を数える特定の文字を含む行
Unix
$ grep -c "hoge" FILE...
Windows
> find /c "hoge" FILE...
![Page 37: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/37.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
行数を数える特定の文字を含む行
Unix
$ cat FILE... | grep -c "hoge"
Windows
> type FILE... | find /c "hoge"
![Page 38: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/38.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
差分比較テキスト
Unix
$ diff [-u] FILE1 FILE2
Windows
> fc [/n] FILE1 FILE2
![Page 39: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/39.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
差分比較バイナリ
Unix
$ cmp FILE1 FILE2
Windows
> fc /b FILE1 FILE2
![Page 40: コマンドプロンプト Tips](https://reader034.fdocument.pub/reader034/viewer/2022052303/5561534cd8b42a780d8b50ba/html5/thumbnails/40.jpg)
コマンドプロンプトTips Powered by Rabbit 2.0.7
まとめ
WindowsのCLIも意外といける
クローズドな環境で威力を発揮
GUIより自動化しやすい
CLIで能率を上げよう
続きはWindowsで