Live data from Hacker News

Learn just enough Linux to get things done

alexpetralia.com

21–30 of 138 posts

Re: Learn just enough Linux to get things done

#21
Mentioning strace in an article titled "Learn just enough Linux to get things done" seems so out of place as to be absurd, even in an "Advanced" section. Anyone who needs the rest of this advice is going to be absolutely baffled by strace.

Otherwise, decent little primer.

Re: Learn just enough Linux to get things done

#22
post #3

In my project, I maintain 3 documents. The first one is a similar list of basic linux knowledge that people should learn when arriving on the project. The second is "UnixTipsAndPitfalls" where people should add new entries when they encounter usefull commands. The third one is about tar.

> The third one is about tar. Why do people have such a difficult time with tar? The only tar commands I've ever needed (or seen other people need) are `tar cf ...` or `tar xf ...` (occasionally I'll need to chuck a z in there if the file is/needs to be gzipped), are other people just using far more complex tar commands than I am?

The most complex I have is this one in a deployment script:

    ssh -n -C -x ${DELIVERY_USERNAME}@${DELIVERY_HOSTNAME} tar ch 
    -C ~${DELIVERY_USERNAME}/${VERSION_PATH}/Escape/AIR_Delivery/PWP_Delivery
    Configuration_Files Executables Libraries Scripts
    | tar x -C ${install_appli} --transform 's,^Executables,bin,;s,^Configuration_Files,config,;s,^Scripts,config,;s,^Libraries/PWP_Configuration_Application.jar,config/PWP_Configuration_Application.jar,;s,^Libraries,lib,'

Re: Learn just enough Linux to get things done

#23
post #19

Earlier quoted context omitted.

> These systems must become more accessible to the average human. I disagree. Firstly, all the commands you mentioned are pretty simple to understand given that they have a manpage and lots of help available online. Secondly, not everything needs to dumbed down for the average user. A large part of the power comes from all the tools and flags available and the combination possibilities. Dumbed down tools are limiting…

Problem is, as I've already mentioned elsewhere, that the manpages do a pretty poor job in a number of places. Yes, I do use them but I guess most Linux users learned most of what they use from colleagues and Internet, not the official documentation.

I rarely use `man`. Most of the time I find what I'm looking for with --help, and if I don't, I end up doing a web search. Sometimes I end up at the HTML version of a man page, somewhere like linux.die.net, which is much more comfortable to read than the terminal.

Re: Learn just enough Linux to get things done

#24
One example of this is the popular version control system (VCS) called git. Developers could have written this software to work on Windows, but they didn't. They wrote it to work on the command line for Linux because it was the ecosystem which already had all the tools they needed.

I think the real (and even stronger) reason is that Linus Torvalds specifically built Git to serve as the VCS for the Linux codebase.

Re: Learn just enough Linux to get things done

#25

Mentioning strace in an article titled "Learn just enough Linux to get things done" seems so out of place as to be absurd, even in an "Advanced" section. Anyone who needs the rest of this advice is going to be absolutely baffled by strace. Otherwise, decent little primer.

Even 'netstat | head -n20' is out of place for introductory Linux.

Re: Learn just enough Linux to get things done

#26
post #24

One example of this is the popular version control system (VCS) called git. Developers could have written this software to work on Windows, but they didn't. They wrote it to work on the command line for Linux because it was the ecosystem which already had all the tools they needed. I think the real (and even stronger) reason is that Linus Torvalds specifically built Git to serve as the VCS for the Linux codebase.

That and the fact that Mercurial worked on Windows renders this line very poorly researched. Then again, perhaps the author, like the title, learned just enough to write the article.

Re: Learn just enough Linux to get things done

#27
post #8
post #3

In my project, I maintain 3 documents. The first one is a similar list of basic linux knowledge that people should learn when arriving on the project. The second is "UnixTipsAndPitfalls" where people should add new entries when they encounter usefull commands. The third one is about tar.

Over years I've heard a lot of complains on tar being hard to use, but in real-life I really ever had to use only these two commands: tar zcvf and tar zxvf. It's actually quite easy to remember: tar Zip Compress Verbose File, and tar Zip eXtract Verbose File.

It's even easier than that! Less memorization, more understanding.

You can think of Tar arguments as either subcommands or options. The dashes are optional

The "subcommands" are x (extract), c (create), t (list), among others.

The "options" are f (read from named file rather than stdin), v (verbose mode), and z (run gzip on the archive before processing).

The fact that these options can be written without leading dashes, and all smashed together in a single argument, is legacy silliness for saving a few keystrokes. Don't confuse yourself with it, and don't confuse other people by teaching it to them, instead of teaching them how to actually use the command (which is really not hard at all).

So when I write Tar commands, I like to think along these lines. Instead of "tar zcvf foo.tar.gz", I write "tar -c -zv -f foo.tar.gz". After doing that about 3 times, it all sank in. Nowadays I'm much more intimidated by Git than Tar.

In the version of tar on the machine I'm posting from (GNU tar 1.27.1), this structure is obvious from right there in the man page:

    SYNOPSIS
       Traditional usage
           tar {A|c|d|r|t|u|x}[GnSkUWOmpsMBiajJzZhPlRvwo] [ARG...]
    
       UNIX-style usage
           tar -A [OPTIONS] ARCHIVE ARCHIVE

           tar -c [-f ARCHIVE] [OPTIONS] [FILE...]

           tar -d [-f ARCHIVE] [OPTIONS] [FILE...]

           tar -t [-f ARCHIVE] [OPTIONS] [MEMBER...]

           tar -r [-f ARCHIVE] [OPTIONS] [FILE...]

           tar -u [-f ARCHIVE] [OPTIONS] [FILE...]

           tar -x [-f ARCHIVE] [OPTIONS] [MEMBER...]

Re: Learn just enough Linux to get things done

#28
And not even one mention of man pages... That is was my main resource for learning new (remembering old) commands. Maybe it's out of date now due to google, but if you're already in the terminal man is the way to go. Also, I feel like cat and less should have separate explanations as they have diverging utilities.

Re: Learn just enough Linux to get things done

#29
post #18

Earlier quoted context omitted.

> The third one is about tar. Why do people have such a difficult time with tar? The only tar commands I've ever needed (or seen other people need) are `tar cf ...` or `tar xf ...` (occasionally I'll need to chuck a z in there if the file is/needs to be gzipped), are other people just using far more complex tar commands than I am?

Because people assume they should RTM and if memory serves me right it is a whole lot more confusing than your post :-)

Doesn't look any more complex than most man pages: https://linux.die.net/man/1/tar

Re: Learn just enough Linux to get things done

#30
post #24

One example of this is the popular version control system (VCS) called git. Developers could have written this software to work on Windows, but they didn't. They wrote it to work on the command line for Linux because it was the ecosystem which already had all the tools they needed. I think the real (and even stronger) reason is that Linus Torvalds specifically built Git to serve as the VCS for the Linux codebase.

>I think the real (and even stronger) reason is that Linus Torvalds specifically built Git to serve as the VCS for the Linux codebase.

Mercurial was built for exactly the same reason (VCS for Linux), at the same time. Yet it has always been cross-platform.

Linus wrote it for Linux because he didn't care about whether it would work in Windows. No other reason.

Post reply on HN