Skip to content

Instantly share code, notes, and snippets.

@iketiunn
Last active September 11, 2018 03:26
Show Gist options
  • Save iketiunn/f5a8d436c5546ee9f2f76dd18b9c4512 to your computer and use it in GitHub Desktop.
Save iketiunn/f5a8d436c5546ee9f2f76dd18b9c4512 to your computer and use it in GitHub Desktop.
bash-snippet / bash
# Redireact stdout to date-named file
λ echo '123' >> "$(date -d 'yesterday 01:00' '+%Y-%m-%d').log"
λ ls
2018-09-10.log
# 1. Kill with ps & pid
λ ps -eaf | grep [w]get
saml 1713 1709 0 Dec10 pts/0 00:00:00 wget ...
λ kill 1713
# 2. pgrep
λ pgrep wget
1234
λ kill 1234
# 3. pkill || killall
λ pkill wget
# 4. jobs
λ jobs
[1]+ Running sleep 100 &
λ kill %1
[1]+ Terminated sleep 100
# 5. fg
#Fake job, sleep.
λ sleep 100 &
[1] 4650
#Get the job's number.
λ jobs
[1]+ Running sleep 100 &
#Bring job #1 back to the foreground, and then use Ctrl+C.
λ fg 1
sleep 100
^C
λ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment