Unix コマンド入門

Post on 31-May-2015

570 views 0 download

description

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

Transcript of Unix コマンド入門

Unix コマンド入門

最終更新日: Jan. 22, 2014

<akagisho@gmail.com>

2

本スライドについて

• 目的:

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

• 対象者:

– Unix / Linux 初心者

• 前提知識:

– UNIX 基礎

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

3

本スライドの注意点

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

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

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

4

ここから本編

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]

6

ファイル

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

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

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

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

• paste

• cut [file ...]

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

7

文字列の処理

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

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

• tr [-d] string1 string2

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

• nkf

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

8

ディレクトリ

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

• cd

• pwd

• mkdir [-p] directory_name

• rmdir directory

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

9

ファイルシステム

• df

• du [-h] [-s]

• dd

10

権限、属性

• chmod [-R] mode file ...

• chgrp [-R] group file ...

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

11

検索

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

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

12

ファイルの比較

• diff [-r] [-u] FILES

• md5 [file ...]

• md5sum [FILE...]

13

圧縮、解凍、アーカイブ

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

• unzip file[.zip]

• bzip2

• bunzip2

• bzcat

• gzip

• gunzip

• zcat

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

14

プロセス

• kill [-KILL] pid …

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

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

• top

• exec

• nohup

• nice

• renice

15

シェル

• exit

• bash

• .

• source

• history

16

エイリアス

• alias

• unalias

• ¥command

17

環境変数、シェル変数

• printenv

• set

• unset

• setenv

• unsetenv

• export

• env

18

リダイレクト、パイプ

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

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

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

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

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

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

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

19

コマンド制御

• xargs [-n]

• sleep

• echo [-e] [-n]

• time

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

21

システム情報

• last

• uname [-a] [-r]

• uptime

• w

22

その他

• date

• crontab

23

ユーザ、グループ

• su [-]

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

• id

• whoami

• passwd

24

ネットワーク

• wget

• curl

• ftp

• ssh

• telnet

• scp [-p] [-r]

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

25

ネットワーク

• host

• dig

• whois

26

ネットワーク

• ping

• traceroute

• netstat

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

• tcpdump

• hostname

• ifconfig

• route

27

参考書籍

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

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

28

おわり