Ah, delta is missing! Right from the docs, it's "[a] syntax-highlighting pager for git, diff, and grep output". [1] https://github.com/dandavison/delta (edit: nevermind, somehow I missed it)
Ah, htmlq [1] is a missing one that's not on the list! Straight from the repo: "Like jq, but for HTML." I find it useful for quickly hacking scripts together and exploring data. Very useful for the iterative process of finding good CSS selectors with the data that I can get without javascript running. --- [1] https://github.com/mgdm/htmlq
New(ish) command line tools
111–120 of 252 posts
Re: New(ish) command line tools
#112Re: New(ish) command line tools
#113direnv is such a godsend that I shill for it on every team and in every company now, it's such a great tool.
I read through the direnv docs, but I'm trying to think of how I'd use it. Can you or anyone else give me some examples? Even just listing which directories you have .env or .envrc files in, and what environment variables you use in them.
Example server pattern to default to production:
if "PROJECT_IS_DEBUG" in os.environ:
DEBUG = True
ALLOWED_HOSTS = ["*"]
else:
# production configuration by default
All for a one-time configuration setup. A further boon of this workflow is that systemd natively supports an EnvironmentFile configuration, so you can re-use the same configuration format from development to production.Re: New(ish) command line tools
#114I got tired of piping head into tail and found it simpler.
Examples:
line file.txt 5 to 9
cat file.txt | line —column 4 to 20
I thought “line” was very Unix sounding and kinda cute, but like a lot of these projects would never make its way into the gnu utils so I thought what’s the point. That and of course to a beginner Awk user, those kind of operations are child’s play. I thought about csv and printing lines between matching words, but it’s all about KISS.
Re: New(ish) command line tools
#115A simple trick I only figured recently is following logs with fuzzy search: tail -f /var/log/foo.log | fzf +s Or something similar for output from a dev server: make serve | fzf --ansi +s
Re: New(ish) command line tools
#116I made a tool back in college called “line” for outputting ranges of line or column numbers. I got tired of piping head into tail and found it simpler. Examples: line file.txt 5 to 9 cat file.txt | line —column 4 to 20 I thought “line” was very Unix sounding and kinda cute, but like a lot of these projects would never make its way into the gnu utils so I thought what’s the point. That and of course to a beginner Awk…
Re: New(ish) command line tools
#117I made a tool back in college called “line” for outputting ranges of line or column numbers. I got tired of piping head into tail and found it simpler. Examples: line file.txt 5 to 9 cat file.txt | line —column 4 to 20 I thought “line” was very Unix sounding and kinda cute, but like a lot of these projects would never make its way into the gnu utils so I thought what’s the point. That and of course to a beginner Awk…
I'd much prefer an ecosystem of interlocking small commands with uniform options than using classic UNIX do-everything tools such as awk. These generally have terrible syntax that's impossible to remember. If I'm gonna drop to a sublanguage other than the shell, I'll use something sane like Python.
The main challenge to doing this well is having good taste and experience. It may be that if you really tried to do this, you'd face tons of UX challenges, and you'd find that tools like awk really were in the sweet spot already.
Re: New(ish) command line tools
#118A simple trick I only figured recently is following logs with fuzzy search: tail -f /var/log/foo.log | fzf +s Or something similar for output from a dev server: make serve | fzf --ansi +s
This is amazing! Is it possible to do the following somehow? - automatically have this for any command that outputs more than 10 lines? - automatically exit when the main command (for example a dev server) exits? - print the output of the main command to stdout after this is done?
https://gist.github.com/jpouellet/5278239
Mine blinks a little light if a command finishes after 30 seconds, and sends me an email if something takes over a minute.
Re: New(ish) command line tools
#119direnv is such a godsend that I shill for it on every team and in every company now, it's such a great tool.
I read through the direnv docs, but I'm trying to think of how I'd use it. Can you or anyone else give me some examples? Even just listing which directories you have .env or .envrc files in, and what environment variables you use in them.
Projects I'm on also tend to wind up with an etc/ directory that configures things like PATH and tab completions for a good baseline experience - think of it as standardizing and isolating the snippets many projects tell you to put in your ~/.bashrc to work on the project.
Direnv makes it easy to automatically load those, too.
It really did revolutionize the way I work, by making it trivial to make projects much more self-contained, the way I'd always wanted them to be but hadn't been quite sure how to achieve.
I've only used Nix for managing my personal installed package on OS X so far, but I believe direnv works really well in tandem with Nix - use a Nix file to define your project's dependencies and use direnv to automatically activate all those dependencies whenever you're in the project's directory.
Re: New(ish) command line tools
#120 tail -f /var/log/nginx/access.log | cut -d' ' -f1 | logtop
as a live updating replacement for a |sort|uniq -c|sort -gr|head