Live data from Hacker News

New(ish) command line tools

jvns.ca

171–180 of 252 posts

Re: New(ish) command line tools

#171
My favourite non-standard tool is pv[0]. In it's simplest use case, pv is a replacement for cat that also outputs a progress bar to stderr. You can use it to add a progress bar (or multiple) to just about any pipeline. I love it because I know if the one-liner I wrote is about to finish in a couple minutes or if it will be a while and I should either write something more efficient, or do something else while I'm waiting.

[0] https://linux.die.net/man/1/pv

Re: New(ish) command line tools

#172

I really like the approach of pipe-rename ( https://github.com/marcusbuffett/pipe-rename ) for renaming many files. It's especially convenient for people who can efficiently edit many lines in their favorite text editor (so everybody here, I guess). Main problem: you maybe don't do this kind of operation frequently enough to remember how it's called or how you aliased it.

ls | % {rename-item $_ -newname $('myfile_' + ($_.BaseName -replace '\D') + '.md' )} No need to remember anything.

? I would be much more likely to remeber ls | renamer than figure out how to write such a command.

Re: New(ish) command line tools

#173
post #20

I'd like a command line tool that could transform `history` into a list of alternate tool recommendations. Bonus if it could also generate recommended aliases and functions according to your habits.

Doesn't recommend tools, but rags[0] will look through your history to recommend aliases.

https://github.com/max-heller/rags

Re: New(ish) command line tools

#174
post #3

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

When I was working with google cloud it would have been nice to have gcloud change project depending on the folder I was in.

Kind of imagine if git didn't change repo when you switched directory, that was how it felt.

Re: New(ish) command line tools

#176
I think tig warrants more than just a passing mention.

For me it's the best complement for a command line focused git usage, because it offers a far better (but still streamlined) experience for staging chunks than "git add -i", through its "tig status" TUI interface.

One thing that I never bothered to research if it can be modified and the defaults bother me a little is that it does not use vim keybindings (gf for loading a commit, for example).

Re: New(ish) command line tools

#177

I really like the approach of pipe-rename ( https://github.com/marcusbuffett/pipe-rename ) for renaming many files. It's especially convenient for people who can efficiently edit many lines in their favorite text editor (so everybody here, I guess). Main problem: you maybe don't do this kind of operation frequently enough to remember how it's called or how you aliased it.

My approach is something like $ ls / find # tweak until I have a list of things to rename $ for file in $(ls / find...); do echo "mv $file $(echo $file | sed ... )"; done # this prints mv commands for renaming, I can inspect them as needed $ for file in $(); do...; done | sh # execute the renaming It is inspectable, easy to cancel (just don't pipe to shell), incremental... just needs wrangling with bash etc. which is…

Thanks! I do this but go in and remove the echo. For some reason I hadn’t thought to pipe to a shell interpreter.

Re: New(ish) command line tools

#178

A 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

Speaking of logs, angle-grinder is amazing: https://github.com/rcoh/angle-grinder

That looks awesome. Something I'd love help with, I use pdsh to tail logs from multiple servers at once, but the ways I can manipulate the logs feel really limited because of how pdsh works. Does anyone know of a better solution for that? Like, from a head node, aggregate/tail the contents of the same log file on multiple servers. Bonus points if it uses 'genders' too to get the list of servers.

Re: New(ish) command line tools

#180

A 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

fzf is a wonderful little tool. I use this script so much: git branch | fzf | xargs git checkout

Excuse my ignorance, but what does this command do?
Post reply on HN