Unix コマンド入門

28
Unix コマンド入門 最終更新日: Jan. 22, 2014 <[email protected]>

description

Unix / Linux を使用するうえで最低限知っておくべきコマンドとオプションを紹介する。

Transcript of Unix コマンド入門

Page 1: Unix コマンド入門

Unix コマンド入門

最終更新日: Jan. 22, 2014

<[email protected]>

Page 2: Unix コマンド入門

2

本スライドについて

• 目的:

– Unix / Linux を使用するうえで最低限知っておくべきコマンドとオプションを紹介する

• 対象者:

– Unix / Linux 初心者

• 前提知識:

– UNIX 基礎

• http://www.slideshare.net/akagisho

Page 3: Unix コマンド入門

3

本スライドの注意点

• 紹介する内容がすべての環境で通用するとは限らない

– OS やバージョンによっては、使用できなかったり動作が変わる場合がある

• 引数の表記はman に合わせている

Page 4: Unix コマンド入門

4

ここから本編

Page 5: Unix コマンド入門

5

ファイル

• cp [-P] [-R] source_file target_file

• mv [-i] source target

• rm [-R] [-f] file ...

• unlink file

• touch file

• ln [-s] source_file [target_file]

Page 6: Unix コマンド入門

6

ファイル

• cat [-n] [file ...]

• less [-N] [-S] [filename]

• head [-n] [file ...]

• tail [-f] [-F] [-n] [+n] [file ...]

• paste

• cut [file ...]

• wc [-l] [file ...]

Page 7: Unix コマンド入門

7

文字列の処理

• sort [-n] [-r] [FILE]...

• uniq [-c] [input_file [output_file]]

• tr [-d] string1 string2

• sed [-e] [file ...]

• nkf

• awk [ 'prog' | -f progfile ] [ file ... ]

Page 8: Unix コマンド入門

8

ディレクトリ

• ls [-a] [-c] [-d] [-h] [-i] [-l] [-s] [-1] [file ...]

• cd

• pwd

• mkdir [-p] directory_name

• rmdir directory

• du [-s] [-h] [file ...]

Page 9: Unix コマンド入門

9

ファイルシステム

• df

• du [-h] [-s]

• dd

Page 10: Unix コマンド入門

10

権限、属性

• chmod [-R] mode file ...

• chgrp [-R] group file ...

• chown [-R] owner[:group] file ...

Page 11: Unix コマンド入門

11

検索

• find path … [-name] [-type] [-exec]

• grep [-E] [-F] [-i] [-r] [-v] [pattern] [file ...]

Page 12: Unix コマンド入門

12

ファイルの比較

• diff [-r] [-u] FILES

• md5 [file ...]

• md5sum [FILE...]

Page 13: Unix コマンド入門

13

圧縮、解凍、アーカイブ

• zip [-R] [zipfile [file ...]]

• unzip file[.zip]

• bzip2

• bunzip2

• bzcat

• gzip

• gunzip

• zcat

• tar [-c] [-f] [-v] [-x] [-z]

Page 14: Unix コマンド入門

14

プロセス

• kill [-KILL] pid …

• killall [-KILL] [procname ...]

• ps [-a] [-w] [-x]

• top

• exec

• nohup

• nice

• renice

Page 15: Unix コマンド入門

15

シェル

• exit

• bash

• .

• source

• history

Page 16: Unix コマンド入門

16

エイリアス

• alias

• unalias

• ¥command

Page 17: Unix コマンド入門

17

環境変数、シェル変数

• printenv

• set

• unset

• setenv

• unsetenv

• export

• env

Page 18: Unix コマンド入門

18

リダイレクト、パイプ

• コマンド名 < ファイル名

• コマンド名 > ファイル名

• コマンド名 >> ファイル名

• コマンド名 > ファイル名 2>&1

• コマンド名 >& ファイル名

• コマンド1 | コマンド2

• コマンド名 | tee ファイル名

Page 19: Unix コマンド入門

19

コマンド制御

• xargs [-n]

• sleep

• echo [-e] [-n]

• time

Page 20: Unix コマンド入門

20

端末

• clear

• Ctrl-L (Ctrl を押しながら L)

• Ctrl-C, Ctrl-Z

• Ctrl-D

• Ctrl-R

• Ctrl-A, Ctrl-E

• Ctrl-W, Ctrl-U

• Alt-b, Alt-f

Page 21: Unix コマンド入門

21

システム情報

• last

• uname [-a] [-r]

• uptime

• w

Page 22: Unix コマンド入門

22

その他

• date

• crontab

Page 23: Unix コマンド入門

23

ユーザ、グループ

• su [-]

• sudo [-i] [-s] [-u]

• id

• whoami

• passwd

Page 24: Unix コマンド入門

24

ネットワーク

• wget

• curl

• ftp

• ssh

• telnet

• scp [-p] [-r]

• rsync [-a] [-v] [-z] [--dry-run]

Page 25: Unix コマンド入門

25

ネットワーク

• host

• dig

• whois

Page 26: Unix コマンド入門

26

ネットワーク

• ping

• traceroute

• netstat

• arp [-a] [-n] [-r]

• tcpdump

• hostname

• ifconfig

• route

Page 27: Unix コマンド入門

27

参考書籍

• UNIX コマンドブック第3版

– http://www.amazon.co.jp/dp/4797352787

Page 28: Unix コマンド入門

28

おわり