Linux コマンド集

コマンド入力履歴全削除

1
cat /dev/null > ~/.bash_history && history -c && exit

/var/log/ ログファイル全クリア

1
find /var/log/ -type f -name \* -exec cp -f /dev/null {} \;

/var/log/ ログファイル全削除

1
find /var/log -type f -delete

/var/log/ ログファイルすべての.gzとローテーションされたファイルを削除

1
2
3
4
5
6
#確認
find /var/log -type f -regex ".*\.gz$"
find /var/log -type f -regex ".*\.[0-9]$"
#削除
find /var/log -type f -regex ".*\.gz$" -delete
find /var/log -type f -regex ".*\.[0-9]$" -delete