Rabbit Slide Show

コマンドプロンプト Tips

2013-05-17

Description

Windowsの黒い画面を便利に使う方法

Text

Page: 1

コマンドプロンプト
Tips
Masafumi Yokoyama
社内勉強会 2013
2013/05/17
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 2

テーマ
Windowsの黒い画面を
便利に使う方法
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 3

agenda
OSとの関係
起動方法
Unix風コマンド
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 4

OSとの関係
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 5

テーマ
Windowsの黒い画面を
便利に使う方法
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 6

黒い画面
OSのCLI
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 7

CLI
コマンドラインインターフェース
キーボードなどから入力した文
字によって、 OS などのソフトウェ
アを操作できる仕組み
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 8

CLIに似た用語
コマンドライン
コマンドラインインタープリター
CUI キャラクターユーザーインターフェース(和製英語)
コンソール
シェル
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 9

シェル
shell
広義
OSのインターフェースソフトウェア
狭義
UnixのCLI
※シェルとシェルスクリプトは別物
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 10

Unix
ゆにっくす
OSの系統
マルチタスク・マルチユーザー
様々な種類がある
商用/フリー共に百種類以上
様々な場所で使われている
サーバー/PC/家電/車
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 11

いろいろなCLI
Unix, Linux , Mac OS X
sh, ksh, bash, zsh ...
Windows
COMMAND.COM (MS-DOS, 9x系)
cmd.exe (NT系)
Windows PowerShell
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 12

Windows NT系
いわゆる2000以降のWindows
NT, 2000, XP, Vista, 7, 8
Windows Server 2000以降
9x系とは内部構造が異なる
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 13

コマンドプロンプト
cmd.exeの通称
現代のWindowsの標準CLI
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 14

CLIでできること
Unix, Linux
全部
Windows
一部
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 15

CLIでできること
※イメージ図
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 16

CLIでできること
Windows PowerShell に
ご期待ください。
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 17

起動方法
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 18

起動方法
普通に起動
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 19

普通に起動
1. スタートメニュー
2. すべてのプログラム
3. アクセサリ
4. コマンドプロンプト
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 20

普通に起動
1. Windowsキー + r
2. cmd と入力してEnter
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 21

起動方法
普通に起動
エクスプローラーの場所を開く
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 22

エクスプローラーから
(Vista/7)
1. エクスプローラーが開いている
2. Shift + 右クリック
3. コマンドウィンドウをここで開く
を選択
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 23

エクスプローラーから
(Vista/7)
1. エクスプローラーが開いている
2. Alt + d でアドレスバーに移動
3. cmd と入力してEnter
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 24

エクスプローラーから
(XP)
1. エクスプローラーが開いている
2. Alt + d でアドレスバーに移動
3. %comspec% と入力してEnter
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 25

ComSpec
環境変数
標準CLIのフルパス
# 98
C:\WINDOWS\COMMAND.COM
# XP
C:\WINDOWS\system32\cmd.exe
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 26

Unix風
コマンド
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 27

マニュアル表示
Unix
$ man コマンド名
Windows
> コマンド名 /?
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 28

ネットワーク接続確認
Unix
$ ping IPアドレス/ホスト名
Windows
> ping IPアドレス/ホスト名
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 29

IPアドレス確認
Unix
$ ifconfig
Windows
> ipconfig
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 30

ファイル内容表示
Unix
$ cat FILE...
Windows
> type FILE...
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 31

ファイル検索
Unix
$ find DIR... -name "WILD_CARD"
Windows
> dir /b /s WILD_CARD
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 32

ディレクトリツリー表示
Windows
> tree [/c] [/f]
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 33

ファイル内検索
grep
Unix
$ grep [-n] "PATTERN" FILE...
Windows
> findstr [/n] "PATTERN" FILE...
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 34

ファイル内検索
サブディレクトリを含む
Unix
$ find DIR... | xargs grep "PATTERN"
Windows
> findstr /s "PATTERN" [DIR/]WILD_CARD
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 35

行数を数える
Unix
$ wc -l FILE...
Windows
> find /c /v "" FILE...
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 36

行数を数える
特定の文字を含む行
Unix
$ grep -c "hoge" FILE...
Windows
> find /c "hoge" FILE...
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 37

行数を数える
特定の文字を含む行
Unix
$ cat FILE... | grep -c "hoge"
Windows
> type FILE... | find /c "hoge"
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 38

差分比較
テキスト
Unix
$ diff [-u] FILE1 FILE2
Windows
> fc [/n] FILE1 FILE2
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 39

差分比較
バイナリ
Unix
$ cmp FILE1 FILE2
Windows
> fc /b FILE1 FILE2
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Page: 40

まとめ
WindowsのCLIも意外といける
クローズドな環境で威力を発揮
GUIより自動化しやすい
CLIで能率を上げよう
続きはWindowsで
コマンドプロンプトTips
Powered by Rabbit 2.0.7

Other slides