Skip to content

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

Comments

I rarely use the exact samme command multiple times. But here are some bash pipe segments I enjoy.

using pv (pipeviewer) instead of cat to get a progress bar when grepping huge files.

Using httpie instead of curl so I can remember the flags.

The power of find -exec to run commands on a lot of specific files. The nice part is you can run it without exec first to see if you have the right set of files.

If you do a loop you can echo -e “$somevar\r” and then each write will overwrite the previous line so you screen doesn’t fill up but you do get a feel for the progress (to make it nice you need to pad with spaces, google for echo carriage return to learn more)

using pv (pipeviewer) instead of cat to get a progress bar when grepping huge files.

How does this work?

I'm curious about your use of `pv` with `cat` and `grep` on large files.

Some great power tips here, especially love the pv + grep combo for big files.

Find's -exec option is great when you need to automate removing old backups

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.