:(){ :|:& };:
This is an “I need a long coffee break” command, right?
Ask HN: What are your favorite one-liner shell commands you use?
21–30 of 44 posts
Re: Ask HN: What are your favorite one-liner shell commands you use?
#22Re: Ask HN: What are your favorite one-liner shell commands you use?
#23All files in this git repository containing the string "foo" git grep foo | cut -d: -f1 | uniq
rg -l foo | uniqRe: Ask HN: What are your favorite one-liner shell commands you use?
#24I have a super neat one but it's on my work machine. Not strictly a one-liner but definitely a CLI QoL improvement. It allows me to type a partial command, for e.g. up to where a file path might be, hit a hotkey to invoke (e.g.) fzf, and finally have fzf's output inserted where my cursor was in the command. Uses some vars that readline exposes. I haven't taken it beyond inserting paths yet, but you could imagine you…
Install Tailscale on your machines, and your work machine is always just one ssh command away.
Re: Ask HN: What are your favorite one-liner shell commands you use?
#25I have a super neat one but it's on my work machine. Not strictly a one-liner but definitely a CLI QoL improvement. It allows me to type a partial command, for e.g. up to where a file path might be, hit a hotkey to invoke (e.g.) fzf, and finally have fzf's output inserted where my cursor was in the command. Uses some vars that readline exposes. I haven't taken it beyond inserting paths yet, but you could imagine you…
> but it's on my work machine Install Tailscale on your machines, and your work machine is always just one ssh command away.
Re: Ask HN: What are your favorite one-liner shell commands you use?
#26I have had the alias `huh` for years, which is just `pwd; whoami` just to confirm I am where I think I am, and I am who I think I am
Re: Ask HN: What are your favorite one-liner shell commands you use?
#27docker ps
docker kill
git switch
git commit
git push
Re: Ask HN: What are your favorite one-liner shell commands you use?
#28All files in this git repository containing the string "foo" git grep foo | cut -d: -f1 | uniq
Re: Ask HN: What are your favorite one-liner shell commands you use?
#291) Whenever building anything; 2>&1 | tee build.log | grep 2) Do everything within GNU Screen window with CTRL-A + Shift-H to log all output to logfile i.e. "screenlog. ". Both lifesavers when working with multiple systems and codebases. 3) Always use "set -o vi" with bash so that i can use vi/vim keybindings across everything.
tmux users can use it's `capture-pane` command, either before or after the fact if history is set big enough. There are several helpful flags worth researching.
e.g. `tmux capture-pane -pS - > ~/tmux.log` in a shell to save the history of that pane, or just `prefix+: capture-pane ...` from within tmux
Re: Ask HN: What are your favorite one-liner shell commands you use?
#30Daily, and with enough general usability to share? I have a few. They are basic. You can probably figure out what industry I work in. df -h /; echo "----"; for fattable in $(find /var/lib/mysql/ -name *.ibd -size +1G -exec ls -lh {} \; | awk '{ print $9 }' );do echo BEFORE " " $(ls -lh $fattable| awk '{ print $5" " }'); db=$(echo $fattable| cut -d/ -f5); otable=$(echo $fattable| cut -d/ -f6| cut -d. -f1); echo mysql…