LoginSignup
3
3

More than 5 years have passed since last update.

Command for Linux

Last updated at Posted at 2015-09-11

curl コマンド

1. URL先のファイルをダウンロード

curl -O -L <URL>

find コマンド

1. 名前検索&後続コマンドに引数を渡す

find <FINDDIR> -name "<WORD>" -exec <COMMAND> {} \;
例:拡張子logのファイルのみ権限剥奪
find /var -name "*.log" -exec chmod 600 {} \;

2. タイムスタンプ検索&後続コマンドに引数を渡す

find <FINDDIR> -mtime <INTEGER> -exec <COMMAND> {} \;
例:タイムスタンプが7日以前のファイルを排除
find /tmp -mtime 7 -exec rm -rf {} \;

netstat コマンド

1. ルーティングテーブル参照

netstat -rn

2. コネクションテーブル参照

netstat -tuapn

tcpdump コマンド

1. インタフェース指定&特定プロトコルを除外する

tcpdump -n -i <INTERFACE> not port <PROTOCOL>
例:eth0よりSSHおよびARPパケットを絶やす
tcpdump -n -i eth0 not port ssh and not arp

2. 外部ファイルへキャプチャデータを書き込む

tcpdump -w <FILENAME>
例:aiueo.pcapにパケキャプを叩き込む
tcpdump -n -i bond0 host 8.8.8.8 -w /tmp/aiueo.pcap

3. 外部ファイルからキャプチャデータを読み込む

tcpdump -r <FILENAME>
例:aiueo.pcapを覗く
tcpdump -r /tmp/aiueo.pcap
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3