linux commands
Commands which is basically called on terminal.
at
1分後に処理を実行
echo 'foo.sh -t bar -e' | at now + 1minute
autossh
Install.
sudo apt get install autossh
Launch on /etc/rc.local
sudo -u pi autossh -f -N -R 10022:localhost:22 -p 123 user@example.net
cron
毎日0時10分に処理を実行
PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
10 0 * * * foo.sh 2>&1 | logger -p cron.info -t "foo"
curl
レスポンスをファイルに保存します。
curl -O http://sample.com/foo.tgz
プログレスバーを抑制(-s)、ただしエラーは出力します(-S)。
curl -s -S http://sample.com/api?foo=bar
dd
dd if=/dev/zero of=/tmp/testimg bs=1024 count=1024
find
Find invalid symbolic links.
find /opt/kanesue -xtype l
See http://qiita.com/kawaz/items/ba0e75b6828bd3951e52
git
git diff
git diff HEAD
git diff --staged
git diff -w # 空白の違いを無視
remote
# 一覧
git branch -r
# 作成
git push -u origin branch_name
# 作業開始
git checkout --track origin/branch_name
# 削除
git branch -r -d origin/branch_name
git push origin :branch_name
others
CSVの差分を見る
git diff --color-words="[^[:space:],]+" x.csv y.csv
rsync
特定の拡張子だけ対象にする
rsync -avz --include "*/" --include "*.csv" --exclude "*" foo/ host:foo/
- http://tech.nitoyon.com/ja/blog/2013/03/26/rsync-include-exclude/
ファイルのチェックサムだけを比較する(タイムスタンプを見ない)
rsync -crlpgoDv foo/ bar/
特定のディレクトリ(pub,sys)だけ転送する(bash)
rsync -avz ./{pub,sys} host:foo/
特定のディレクトリ(log,tmp)を除外して転送する
rsync -crlpgoDvn --exclude 'log' --exclude 'tmp' foo/ bar/