Live data from Hacker News

Linux Terminal Tools [pdf]

ketancmaheshwari.github.io

21–30 of 57 posts

Re: Linux Terminal Tools [pdf]

#22

This function will fail when given an argument with a space, which would be quite frustrating for a beginner, which is presumably the target audience for such a document: > mcd() { mkdir -p $1; cd $1 } It should be more like: > mcd() { mkdir -p "$1"; cd "$1"; } The trailing ";" is also required in bash for oneline blocks like this. Same goes for most of the other functions on page 70. "$@", etc. Just trying to make t…

Ah thank you! I will fix it.

[deleted]

Re: Linux Terminal Tools [pdf]

#24

Should include CTRL-Q and CTRL-S, as I've encountered students who accidentally hit CTRL-S instead of CTRL-X and then stare at a hung terminal wonder WTF just happened.

It's a learning moment for users who press Ctrl-s to save their work due to muscle memory from other environments. That's when they get a crash course in Ctrl-q and screen/tmux.

CTRL-S in a terminal command-line? That doesn't seem likely as you're never in a "save-mode thought" on the CLI.

Funny, I used to have ctrl-s muscle memory, then 10 years of primarily developing on mac got me used to cmd-s since mac keyboards are so annoying. now when i switch between mac/win/linux it's just a constant mess of pressing the wrong special key combos. Almost as bad switching between scripting languages and forgetting if a function starts with func, proc, sub, def, etc... (yes, I know you can swap special keys on mac: i tried it and it creates way more headaches than it solves.)

Re: Linux Terminal Tools [pdf]

#25

This function will fail when given an argument with a space, which would be quite frustrating for a beginner, which is presumably the target audience for such a document: > mcd() { mkdir -p $1; cd $1 } It should be more like: > mcd() { mkdir -p "$1"; cd "$1"; } The trailing ";" is also required in bash for oneline blocks like this. Same goes for most of the other functions on page 70. "$@", etc. Just trying to make t…

Ah thank you! I will fix it.

  function mkcd() {
    mkdir -p "$@" && cd "$1";
  }
supports multiple dirs and cd to the first one

  mkcd a b c

Re: Linux Terminal Tools [pdf]

#27
It's a shame that a whole generation of people who want to be IT literate think that this is "Linux". This is Unix.

Would we name a map book "A Toyota Roadmap", as if we don't know that there are other cars, and that a map applies to cars, not just to Toyotas specifically? Sure, a map would be different for push scooters (Windows), but a map would be the same for cars and small trucks.

It seems petty, but it becomes difficult to make a distinction between what's generally Unix and what's actually specifically Linux when we just call everything Linux.

Re: Linux Terminal Tools [pdf]

#29

It's a shame that a whole generation of people who want to be IT literate think that this is "Linux". This is Unix. Would we name a map book "A Toyota Roadmap", as if we don't know that there are other cars, and that a map applies to cars, not just to Toyotas specifically? Sure, a map would be different for push scooters (Windows), but a map would be the same for cars and small trucks. It seems petty, but it becomes…

I think by that analogy the title should have been "Computer Operating Systems Terminal Tools". The tools presented in the slides have been tested on a Linux System, which motivated the title name.

Re: Linux Terminal Tools [pdf]

#30

This function will fail when given an argument with a space, which would be quite frustrating for a beginner, which is presumably the target audience for such a document: > mcd() { mkdir -p $1; cd $1 } It should be more like: > mcd() { mkdir -p "$1"; cd "$1"; } The trailing ";" is also required in bash for oneline blocks like this. Same goes for most of the other functions on page 70. "$@", etc. Just trying to make t…

If we're being picky then you probably also want `mkdir -p -- "$1"` in case they want to create a directory named `-m`, `-v`, etc.

Surprisingly `--` isn't mentioned in the mkdir manpage on my system, but it works. E.g. `mkdir -- -p` does what you'd want.

Post reply on HN