Live data from Hacker News

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

news.ycombinator.com

31–40 of 44 posts

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

#31

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?

yes, on the high end of things :)

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

#33
post #5

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…

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

How does this work?

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

#35
post #33
post #5

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…

> using pv (pipeviewer) instead of cat to get a progress bar when grepping huge files. How does this work?

This seems to be a nice introduction:

https://www.geeksforgeeks.org/linux-unix/pv-command-in-linux...

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

#36
post #35
post #33

Earlier quoted context omitted.

> using pv (pipeviewer) instead of cat to get a progress bar when grepping huge files. How does this work?

This seems to be a nice introduction: https://www.geeksforgeeks.org/linux-unix/pv-command-in-linux...

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

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

#39
post #5

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…

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

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

#40

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…

That’s an impressive collection. Definitely not basic! Love how practical these are for real-world ops work, especially the MySQL .ibd optimizer loop and swap memory check.
Post reply on HN