Live data from Hacker News

An Illustrated Guide to Useful Command Line Tools

wezm.net

11–20 of 108 posts

Re: An Illustrated Guide to Useful Command Line Tools

#11

Can someone explain the misuse of cat, which bat solves?

I guess the author was thinking of how cat's original purpose is to concatenate multiple files, not show just one file. (But I certainly don't think using cat in the latter way is a misuse.)

There's also a commonly noted "unnecessary use of cat" where people do this:

  cat file.txt | grep foo
instead of this:

  
but that's not relevant to bat (which can be used unnecessarily in the same way).

Re: An Illustrated Guide to Useful Command Line Tools

#12
post #8

Earlier quoted context omitted.

They are referring to using cat to print out a file to the terminal. I'm not sure that's a "misuse", but personally I've never done it, using "more" or "less" instead. "bat" really is a replacement for more/less, only with additional features such as syntax highlighting in source code.

I use: cless() { pygmentize -O style= "$1" 2>/dev/null | less } I have programs that depend on pygmentize so I am not sure I will use bat anytime soon when I already have pygmentize and less , or at least not for it having syntax highlighting.

That use is the exact reason why LESSPIPE exists, check out man less & https://www-zeuthen.desy.de/~friebel/unix/lesspipe.html

Re: An Illustrated Guide to Useful Command Line Tools

#13
Lots of cool stuff in here. I’m going to have a long look at Restic and Syncthing.

I’d like to know why Skim instead of FZF. They are pretty similar but I’ve been using the latter for years and would like to know of any possible advantages to it.

Re: An Illustrated Guide to Useful Command Line Tools

#14
post #8

Earlier quoted context omitted.

They are referring to using cat to print out a file to the terminal. I'm not sure that's a "misuse", but personally I've never done it, using "more" or "less" instead. "bat" really is a replacement for more/less, only with additional features such as syntax highlighting in source code.

I use: cless() { pygmentize -O style= "$1" 2>/dev/null | less } I have programs that depend on pygmentize so I am not sure I will use bat anytime soon when I already have pygmentize and less , or at least not for it having syntax highlighting.

I just use nano -v.

Re: An Illustrated Guide to Useful Command Line Tools

#15

Earlier quoted context omitted.

I use: cless() { pygmentize -O style= "$1" 2>/dev/null | less } I have programs that depend on pygmentize so I am not sure I will use bat anytime soon when I already have pygmentize and less , or at least not for it having syntax highlighting.

That use is the exact reason why LESSPIPE exists, check out man less & https://www-zeuthen.desy.de/~friebel/unix/lesspipe.html

Maybe, but I already had pygmentize, I already had less, and this small function took me less than 10 seconds to type in and start using immediately (and I use a particular style that pygmentize provides so that is a plus). :P In any case, thanks for sharing.

Re: An Illustrated Guide to Useful Command Line Tools

#18
I quite like this list, there are a number of utilities here that I already use on a daily basis. There are also a few utilities that I like that weren't on this list, or some alternatives to what was shown. Some off the top of my head:

- nnn[0] (C) - A terminal file manager, similar to ranger. It allows you to navigate directories, manipulate files, analyze disk usage, and fuzzy open files.

- ncdu[1] (C) - ncurses disk analyzer. Similar to du -sh, but allows for directory navigation as well.

- z.lua[2] (Lua) - It's an alternative to the z utility mentioned in the article. I haven't done the benchmarks, but they claim to be faster than z. I'm mostly just including it because it's what I use.

[0] https://github.com/jarun/nnn [1] https://dev.yorhel.nl/ncdu [2] https://github.com/skywind3000/z.lua

Re: An Illustrated Guide to Useful Command Line Tools

#19

Can someone explain the misuse of cat, which bat solves?

Google "UUOC" - it's famous.

Edit: Sorry downvoter, thought I was being helpful - no-one mentioned the acronym yet. There's a lot online about it, more than I'm qualified to explain. Entertaining reading too. I remember reading about the UUOC Awards years ago..

Re: An Illustrated Guide to Useful Command Line Tools

#20

Earlier quoted context omitted.

That use is the exact reason why LESSPIPE exists, check out man less & https://www-zeuthen.desy.de/~friebel/unix/lesspipe.html

Maybe, but I already had pygmentize , I already had less , and this small function took me less than 10 seconds to type in and start using immediately (and I use a particular style that pygmentize provides so that is a plus). :P In any case, thanks for sharing.

Oh, I forgot to mention that LESSPIPE is a mechanism to automatically pipe the contents of a file when opening in less, and that the linked LESSPIPE script has an option to use pigmentize for syntax highlighting.

It’s a tool for enhancing less & pygmentize, not replacing them.

Well, just providing info for everyone. I’m not trying to force you using that script :-)

Post reply on HN