6 ms·
Ask HN: What's the best obscure but useful CLI tool?
- john-tells-all 4y agoentr -- when a file changes, run a command I use this on literally 100% of my projects. Normally it's "when my source changes, run tests" or sometimes "when files change, do 'terraform plan' to see what would change". Using this one command shortens developer feedback loops from a minute to microseconds! And you don't have to think about it! It's magic. `ls -1 *.py | entr pytest` `git ls-files | entr terraform plan` For more, see our friend and national treasure Julia Evans: https://jvns.ca/blog/2020/06/28/entr/ https://jvns.ca/blog/2020/06/28/entr/
- lordleft 4y agoThat is incredible, I had no idea this existed -- thanks for sharing!
- qup 4y ago20+ years of linux, didn't know about it. Will be daily-driving it now, thanks for chiming in.
- rthomas6 4y agoThat's awesome. Seems like it would pair well with Make.
- coreyp_1 4y agoI use inotifywait with make for a similar effect. I save a source file and my code is re-compiled and tests are run. I love it!
- deleted 4y ago[deleted]
- john-tells-all 4y agoabsolutely. 100% of my projects use Entr ("run thing on file change"), and Make ("use short name to run a complex script, e.g. test -> pytest").
- anthonyhn 4y agoGNU Parallel is pretty useful. You can use it to run command line programs in parallel. For example, if you wanted to gzip compress all individual files in a directory and limit the number of jobs equal to the number of CPU cores on your machine: ls | parallel --dry-run --jobs `nproc` 'gzip {}' (Note you have to remove the --dry-run switch to actually run this, --dry-run only prints out the commands parallel will run, not actually execute them)
- rthomas6 4y agoyes: literally just type y, or whatever string, over and over again. yes | annoying_interactive_install_script.sh
- hosteur 4y agojdupes I find myself using it rather frequently. It is fantastic to find duplicate files.