$ ps -eo pid,cmd,lstart
PID STARTED ARGS
1 Tue Sep 19 13:06:32 2017 /sbin/launchd
50 Tue Sep 19 13:06:34 2017 /usr/sbin/syslogd
51 Tue Sep 19 13:06:34 2017 /usr/libexec/UserEventAgent (System)
...
以下の例は、拡張子をheicからjpgに変換するワンライナーである。
echo mvとやると、ドライランで実行できる。表示を確認してからechoを外して実行すれば安全。
$ for file in *.heic; do echo mv "$file" "${file%.heic}.jpg"; done
mv IMG_0808.heic IMG_0808.jpg
...
--- 出力確認後、echoを外す ---
$ for file in *.heic; do mv "$file" "${file%.heic}.jpg"; done
参考ページ:mac os x terminal batch rename
mkdir hoge; cd $_
How to get the start time of a long-running Linux process?
前提として、インターネットから隔離されたネットワークでSSH接続をする際に毎回パスワード入力を強いられる時を想定している。 秘密鍵認証は関係ない。
手順
ssh-keygenで秘密鍵を生成するssh-copy-id ユーザー名@IPアドレスで秘密鍵をリモートに転送するssh ユーザー名@IPアドレスでパスワード抜きでログインできるか確認するssh-add -K /path/to/private_key を実行する毎回新しいホストに対して手で設定してられないので、以下のシェルスクリプトを任意の場所に置いた上で、~/.zshenvでsshのエリアスを設定している。
#!/bin/sh
ssh-copy-id $1 1>/dev/null 2>/dev/null; ssh $1
# ssh
alias ssh=~/sh/ssh-auto-login.sh
Using an ssh-agent, or how to type your ssh password once, safely.
- Generate a set of keys, with
ssh-keygen.- Install your keys on remote servers, with
ssh-copy-id.- Start an
ssh-agentto use on your machine, with evalssh-agent.ssh-addyour key, type your password once.- Profit! You can now ssh to any host that has your public key without having to enter a password, and use
ssh -Ato forward your agent.
SSH Key - Still asking for password and passphrase
ssh-add -K /path/to/private_key