Commands which is basically called on terminal.
1分後に処理を実行
echo 'foo.sh -t bar -e' | at now + 1minute
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
毎日0時10分に処理を実行
PATH=/usr/local/bin:/bin:/usr/bin
10 0 * * * foo.sh 2>&1 | logger -p cron.info -t "foo"
レスポンスをファイルに保存します。
curl -O http://sample.com/foo.tgz
プログレスバーを抑制(-s)、ただしエラーは出力します(-S)。
curl -s -S http://sample.com/api?foo=bar
dd if=/dev/zero of=/tmp/testimg bs=1024 count=1024
Find invalid symbolic links.
find /opt/kanesue -xtype l
See http://qiita.com/kawaz/items/ba0e75b6828bd3951e52
git diff
git diff HEAD
git diff --staged
git diff -w # Ignore white spaces.
To remove merged branches.
git branch --merged | egrep -v "(^\*|master|main|develop)" | xargs git branch -d
How to rename master
to main
.
git branch -m master main
git push -u origin main
For github: Settings -> Branches -> Rename default branch
For bitbuchet: Repository Settings -> Repository Details -> Advanced -> Main branch
See also How to Rename the master branch to main in Git.
# 一覧
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
CSVの差分を見る
git diff --color-words="[^[:space:],]+" x.csv y.csv
特定の拡張子だけ対象にする
rsync -avz --include "*/" --include "*.csv" --exclude "*" foo/ host:foo/
ファイルのチェックサムだけを比較する(タイムスタンプを見ない)
rsync -crlpgoDv foo/ bar/
特定のディレクトリ(pub,sys)だけ転送する(bash)
rsync -avz ./{pub,sys} host:foo/
特定のディレクトリ(log,tmp)を除外して転送する
rsync -crlpgoDvn --exclude 'log' --exclude 'tmp' foo/ bar/
Remove lines which contain specific string from multiple files.
find . -name "*.html" | xargs sed -i '/foobar/d'