LoginSignup
1
2

More than 5 years have passed since last update.

個人的に良く使いたいけどすぐ忘れるLinuxコマンド集

Last updated at Posted at 2017-10-23

メインで使ってるLinuxがCentOS7なので固有のコマンドとかあるかも?

文字列検索系

ディレクトリ下のファイル全体から指定文字列を検索

$find ./ | xargs grep hoge
$find ./ -type f -print | xargs grep hoge

findコマンドのオプション何つけなきゃいけなかったっけ・・・

grep hogeの前何だっけ・・・

って二重に思い出せない

-type f オプションでファイルのみを対象に検索

プロセス系

Pythonとかnodeのプロセスを絞り込んで表示したい

$ps -x | grep node

またもやgrep。最近よく使うから忘れなそう

サーバー系

boot時にデーモンを自動起動したい(CentOS6向けぽいけど7で使用)

最初の一回だけ

# run as root
$chmod u+x /etc/rc.d/rc.local

で実行権限を与えてあげる。
これをしないとCentOS7では動かないっぽい(Systemdとかなんとか・・・)

で、rc.localにコマンドを追記していく

 $echo "command" >> /etc/rc.d/rc.local

 # DiCE設定の時に使った奴
 $echo /usr/local/bin/DiCE/diced -d -l >> /etc/rc.d/rc.local

サーバーのHDD使用量等確認

$df {-h}

やりたいと気にぱっと出てこないよね。

随時更新。

1
2
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
1
2