Live data from Hacker News

New(ish) command line tools

jvns.ca

51–60 of 252 posts

Re: New(ish) command line tools

#52
broot completely changed the way I navigate directories on the CLI over the past year.

I was an 'ls' purist before, I've tried various CLI file managers in the past and they all felt like they added too much friction, with the one exception of nnn which I briefly used before finding broot, which just feels really fluid and natural.

Re: New(ish) command line tools

#53
post #18

Mosh isn't a replacement for SSH, it uses it. > The mosh client logs in to the server via SSH This is a cool list overall though.

Semantics, semantics. If you mosh into a system, you wouldn't also ssh into it. In that sense, the use of mosh replaces the use of ssh and mosh would be used in similar scenarios.

Re: New(ish) command line tools

#54

I could really use a better workflow to refine grep matches. Has anyone made a tool that combines grep (regex search) with fzf (multiple positive/negative patterns)? What I really want is something like: grep pattern1 **/* | grep pattern2 | grep -v exclude_these | grep -v also_exclude The problem is this loses filenames and context lines in the output. I want to apply several positive and negative regexes, and only a…

Just posting this without trying it out...grep -nH gives you line numbers and full filepath context, and as another commenter said, -ve allows you to string multiple excludes, so grep -inH -ve not_this -ve nor_this -ve nor_that.

Re: New(ish) command line tools

#56
post #2

I wrote dug, a cli tool I made to help visualize DNS propagation but is a great learning tool. Didnt make this list though sadly. https://github.com/unfrl/dug https://dug.unfrl.com

Seems your tweet was posted about the time the post was made? dug looks like it will be very useful, thank you

Re: New(ish) command line tools

#57

I could really use a better workflow to refine grep matches. Has anyone made a tool that combines grep (regex search) with fzf (multiple positive/negative patterns)? What I really want is something like: grep pattern1 **/* | grep pattern2 | grep -v exclude_these | grep -v also_exclude The problem is this loses filenames and context lines in the output. I want to apply several positive and negative regexes, and only a…

I glue together ripgrep with fzf and bat like this:

    rg --line-number --no-heading --color=always --smart-case "$@" | fzf -d ':' -n 2.. --ansi --no-sort --preview-window 'down:20%:+{2}' --preview 'bat --style=numbers --color=always --highlight-line {2} {1}'
I get a small preview of the file in the bottom 20% of my terminal, and I can use fzf's matching to further filter, or to exclude things

I capture the output and then `cut` it up to get filename and line number, which then get used to open the file/line in vim

Re: New(ish) command line tools

#58

I could really use a better workflow to refine grep matches. Has anyone made a tool that combines grep (regex search) with fzf (multiple positive/negative patterns)? What I really want is something like: grep pattern1 **/* | grep pattern2 | grep -v exclude_these | grep -v also_exclude The problem is this loses filenames and context lines in the output. I want to apply several positive and negative regexes, and only a…

If your grep has -P, then you could do all in one go with lookahead assertions...

    grep -P '(?=.*pattern1)(?=.*pattern2)(?!.*exclude_these)' **/* 
Maybe not the most beautiful or easy to have at the fingertips, but could be worse.
Post reply on HN