Live data from Hacker News

An Illustrated Guide to Useful Command Line Tools

wezm.net

51–60 of 108 posts

Re: An Illustrated Guide to Useful Command Line Tools

#51

I always find exotic command-line tools cool but they never stick because Im constantly sshing/using/targeting a variety of systems I don't own that don't have them readily istalled

If you have access to the build tools, you can compile and install stuff in your home directory.

A bit tedious, but you would still get to use your favourite tools.

Re: An Illustrated Guide to Useful Command Line Tools

#52
post #49

As much as I do use a number of these tools, there's something to be said for being able to use any box you ssh or log into that has the default tools available on any *nix system. ls, cat, find, etc. I'm hypocritical a bit in that I do use rg, and fd, but I just can't bring myself to deviate too far from the 'default'.

I often use the term “standard” in place of “default” there.

Re: An Illustrated Guide to Useful Command Line Tools

#53
I’m gonna sound like an old person here. As much as these tools are gorgeous and ergonomic, remember that the others are standard, which means they’re available (almost) everywhere.

Still though, these alternatives seem great for productivity locally, even if they’re not usable in a script.

Re: An Illustrated Guide to Useful Command Line Tools

#54

I’m gonna sound like an old person here. As much as these tools are gorgeous and ergonomic, remember that the others are standard, which means they’re available (almost) everywhere. Still though, these alternatives seem great for productivity locally, even if they’re not usable in a script.

I’ve actually found myself using these to get me much more proficient in the Shell overall. fd in particular is so much easier to use I find myself doing things like:

  fd .log$ -x mv {} {.}.bak

  (Rename *.log to *.bak)
Can I do that with xargs, awk, and find? Yes, but every time I have to look up the man page to at least one of them and it’s enough friction that I might just open it in finder if it’s a handful of files.

Having some of these utilities around is a crutch that let me leverage the entire ecosystem much more when I don’t have it. And when I do log into a shared enviroment and don’t have my crutch, then it’s easy to fill in the missing puzzle piece because it’s one part that’s missing and I’ve got the rest of the environment down.

Of course if all you do is shared environments I wouldn’t suggest these, but I would encourage people to use these to get more familiar with the CLI ecosystem.

Re: An Illustrated Guide to Useful Command Line Tools

#55
post #51

I always find exotic command-line tools cool but they never stick because Im constantly sshing/using/targeting a variety of systems I don't own that don't have them readily istalled

If you have access to the build tools, you can compile and install stuff in your home directory. A bit tedious, but you would still get to use your favourite tools.

Encryptable, portable home directories is one of the goals of systemd. I can’t wait until one day when I just ssh in and it’s all there

Re: An Illustrated Guide to Useful Command Line Tools

#56

in order to avoid having to unlearn commands like cat and ls, I use aliases to invoke bat and exa. Here's a screenshot of my fish config: https://twitter.com/mxschumacher/status/1168993005744918528

I would do

  alias ls "exa"
  alias ll "exa -ll"
That way you get the nice shorter output which comes in handy for piping ls things like:

  ls -d | xargs ls
Lists the files in subdirectories.

Re: An Illustrated Guide to Useful Command Line Tools

#57
post #42
post #39

Earlier quoted context omitted.

Catting a file will your terminal make interpret escape codes in the file. For instance: $ echo -e "\033]0;${USER} is an unfriendly person\007" > test-file.txt Then, many days later: $ cat test-file.txt will change your terminal title. With less, you _can_ interpret escape codes, but usually you don't, and I consider this the correct default.

Tried it -- didn't work. Single-quoting didn't work either. Terminal is urxvt. What is clear is that $ cat test-file.txt does not print the initially-echoed text, but it is escaped and up to nefarious tasks.

The escape sequence is terminal specific. urxvt is likely different from xterm in this regard.

Re: An Illustrated Guide to Useful Command Line Tools

#58
post #39

Earlier quoted context omitted.

Catting a file will your terminal make interpret escape codes in the file. For instance: $ echo -e "\033]0;${USER} is an unfriendly person\007" > test-file.txt Then, many days later: $ cat test-file.txt will change your terminal title. With less, you _can_ interpret escape codes, but usually you don't, and I consider this the correct default.

in your example it is not cat who "interprets" the escapes, but echo

Neither one interprets the sequence, but cat will print the file unfiltered to stdout, and stdout is processed by your terminal, and then the terminal will interpret it. less filters before printing to the terminal.

Re: An Illustrated Guide to Useful Command Line Tools

#59

I’m gonna sound like an old person here. As much as these tools are gorgeous and ergonomic, remember that the others are standard, which means they’re available (almost) everywhere. Still though, these alternatives seem great for productivity locally, even if they’re not usable in a script.

I’ve actually found myself using these to get me much more proficient in the Shell overall. fd in particular is so much easier to use I find myself doing things like: fd .log$ -x mv {} {.}.bak (Rename *.log to *.bak) Can I do that with xargs, awk, and find? Yes, but every time I have to look up the man page to at least one of them and it’s enough friction that I might just open it in finder if it’s a handful of files…

bash/zsh: for f in *.log; do mv "$f" "${f/%log/bak}"; done

a bit more generic, `for` loops and parameter expansion are good to know for proficiency, and also I dislike typing curly braces.

Re: An Illustrated Guide to Useful Command Line Tools

#60
post #59

Earlier quoted context omitted.

I’ve actually found myself using these to get me much more proficient in the Shell overall. fd in particular is so much easier to use I find myself doing things like: fd .log$ -x mv {} {.}.bak (Rename *.log to *.bak) Can I do that with xargs, awk, and find? Yes, but every time I have to look up the man page to at least one of them and it’s enough friction that I might just open it in finder if it’s a handful of files…

bash/zsh: for f in *.log; do mv "$f" "${f/%log/bak}"; done a bit more generic, `for` loops and parameter expansion are good to know for proficiency, and also I dislike typing curly braces.

Hah, thankfully I refreshed. Was about to post something similar.

No need for xargs, awk or find

Post reply on HN