Live data from Hacker News

Ask HN: What are your favorite one-liner shell commands you use?

news.ycombinator.com

21–30 of 44 posts

Re: Ask HN: What are your favorite one-liner shell commands you use?

#24

I 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?

#25
post #24

I 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.

I am not allowed to install legitimate development tools..

Re: Ask HN: What are your favorite one-liner shell commands you use?

#29

1) 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.

> GNU Screen window with CTRL-A + Shift-H to log all output to logfile

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?

#30

Daily, 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…

Some kinda shared hosting?
Post reply on HN