How to Learn Unix Tools
blog.nindalf.com
blog.nindalf.com
I don't know how younger people force themselves to learn to use the command line. I had a windows 98 at home at the time and the university enviroment seemed primitive in comparison, but I had no choice.
And were lucky, we had X-terminals!
I typed the HTML for my student website by hand in a minimal and ancient Vim build, because student websites were hosted on some kind of Unix mainframe.
It probably took me 2 hours to write 5 sentences! I was so proud of myself that I added a footer to the effect of:
> This page was typed painstakingly in Vim. "What doesn't kill you makes you stronger."
I'm sure I would have eventually forced myself to learn Vim anyway if I never had access to this Unix system, but it was definitely important and formative to start off this way.
As soon as it was upgraded, we reverted to the normal workflow of pressing Enter first, the correcting typos, paginating instead of searching, debugging live instead of in our heads, etc. I don't think we were more of less productive either way, they're just different ways of working.
When I were a lad we had a teletype terminal in Pollock Halls (Edinburgh) to complete our assignments (well there were some VT100s but with deadlines coming up you had to take what was free!).
Anyway what I'm trying to say is just as I'm glad I didn't have to use punch cards, I'm glad that the youth don't have to deal with that kind of nonsense.
Why when I was a lad had to get up 10 minutes before we went to sleep, mill our own paper AND punch the cards, and if you left an instruction out it was no supper for a week.
I guess there will be many Powershell users in future for that reason alone.
Then it's just plugging it into a switch port.
Just use them. And keep on using them.
Resources like those suggested are good, but each will suit people differently - the one thing that all people who are expert at these tools have in common is that they've all used them a lot!
Use Docker, libvirt, Digital Ocean, multipass, Virtualbox, or whatever you want, but find a place where you can use the stuff without worrying too much about the consequences :)
The last bit is very crucial. Be prepared to relearn it after a prolonged break. So taking notes may be of some practical help.
I wish *NIX land had some uniform convention for options naming and a targeted help system to go with it, so one could lookup an option directly (preferrably in shortened form, no need to spell out the whole word). OpenVMS HELP was a good example of user-friendly command-line help system, well, but that's another story...
https://en.wikipedia.org/wiki/The_Unix_Programming_Environme...
It may be a bit dated in some inconsequential details, but it is an extremely refreshing and fun read.
It’s free, even though the webpage makes it look you might need to buy a subscription (edit: you need to pay beyond chapter 2). It takes half a day to a whole workday to work through, but for me it was a great investment of time.
https://www.learnenough.com/command-line-tutorial/manipulati...
Though 3$ is probably a small price to pay for standalone version.
For administration the UNIX System Administration Handbook by Nemeth, Snyder, Seebass, and Hein is how I got started. Newer editions of this book cover Linux specifically.
2. play a man page quiz with a friend: - read a random command and ask for the description - read a random description and ask which command it is for.
I've done both as an undergraduate. The HP-UX manual set remain on the shelves right next to me. Over the years, I found letting candidates compose a pipeline of commands to solve a problem is a great way to make interviews more fun ("How would you solve this problem without writing a program, by combining existing ones?").
Though being able to explain the mental model of how you want to go about manipulating the output, extraction of the information or data you need, be it through json manipulation, regex, line/column parsing etc is valuable.
Please don't do this by default unless you're sure such a command supports that flag otherwise you're literally just running unknown commands with unknown consequences.
The first port of call should always be `man` and not `--help` like the article suggests. Aside from that, the article looks good.
-?, —-help -> help info
-h -> set the host you are connectingMany applications that are installed outside the scope of a package manager, especially tools distributed as a single binary, lack a manpage.
There are almost no man pages at my job and the software is very old so good luck Googling. I practically default to --help here. I figure if --help somehow screws something up then they deserve it.
No they're not. Not every command line tool uses flags, some use ordered parameters. So parameter 1 might be a file name to write to rather than a flag. Just look at how messy it is working with tools like `cp` and the `--` flag to get an idea of the problems some programs face differentiating between files and flags.
Other tools might not take any command line parameters at all. So it's entirely forgiveable for them not to check if any parameters were supplied.
Then there is the issue that some programs accept `-h` and others `-?` as a shorthand. Some programs have `-h` as short for `--host`.
Plus even if I were to agree with your point, which I don't, it's entirely moot because it's not the author of the tool that is the one who has to fix any issues that might happen to a host system due to someone blindly running commands.
So whichever way you cut it, blindly throwing flags at executables and expecting a favourable outcome every time can be risky.
> Many applications that are installed outside the scope of a package manager, especially tools distributed as a single binary, lack a manpage.
That point wasn't forgotten by me. But if you've downloaded an application outside the scope of the package manager then you should at least have some idea how it functions and thus know whether it's safe to run `--help`. If not, you probably know where to look online to find that information out.
Like I said in my OP, I've got nothing against people using `--help` et al. I use them myself. But it shouldn't be the first thing you recommend UNIX newbies to do when they're figuring out a command. It's usually something you do when you're already familiar with what a command does but need a nudge as to what flags you need to supply.
I’ve also seen plenty of enterprise UNIX era software not follow GNUisms (which ‘-—help’ technically is). It’s all good and well if your just running GNU/Linux with modern DevOps tooling but don’t expect ‘-—help’ to work on every Solaris or BSD application. Not to mention relics like Informix and it’s tools.
Also anything hacked together in house should be treated with caution too. Open those files in $EDITOR and/or examine the README (if you’re lucky enough to have one) first because there’s no telling how lazy your predecessor might have been.
So yeah, over my career I’ve ran into numerous instances where ‘—-help’ might have had unforeseen consequences.
When I was 16 and just starting to get into Linux, I got a tiny little paperback, "reference to Unix programs" or something. It was literally just a list of every single Unix program and a shortened version of its man page. I read it cover to cover. After that, if I needed to do something on the command line, I knew there was a program to do it and what its capabilities were. After a couple weeks I didn't need the reference anymore.
I can't remember the book anymore, but this is basically what it was like: https://dspinellis.github.io/unix-v4man/v4man.pdf See if you can find a version newer than 1973, though... O'Reilly's Unix In A Nutshell isn't bad.
Read your man pages cover to cover. It's for the same exact reason you learn a bunch of "useless BS" in school: to save you time down the road because you'll know where to go for the solution.
I have made my workflow very minimal such as I use firefox for browsing and terminal for pretty much everything
Maybe it’s just my opinion but happy to hear your thoughts on this.
I use vim extension on firefox btw
(on a NetBSD,) alphabetically went through /bin, /usr/bin, /sbin, /usr/sbin, /usr/games and read each of the program's man pages. Yeah, took a while. Also read POSIX.2
The things you do with your free time ...
But it was ok, NetBSD doesn't have zsh installed by default (and neither bash, only csh, sh and (pd? m?)ksh). When I did that, I was primed to use tcsh at $WORK. Switched to ksh later (and remained on there for a loooong time).
Anyways. I failed to make an actual point. My point was the following: The BSD manpages are _excellent_. IMO way better than the linux/GNU manpages (or info pages) of comparable utilities. It shows, again IMO, that the BSDs are a complete, single-tree distribution where documentation, userland and kernel go hand in hand and are equally well groomed.
So maybe, for learning "UNIX", go get yourself a nice little {Net,Free,Open}BSD install and toy around with the elder ways.
I honestly agree that reading through the man-pages a good idea (after you've acquired some basic knowledge already of course), and as a Linux user I'm a bit envious of many things BSD, the documentation included.
I used to spend my time in #sed and #awk, and try to answer any short question that came up in the channel. They came up at a good pace, I don't know if this is still the case.
It was a really good exercise, and it has an additional social aspect you will not get from reading books (which is a great resource too).
Indeed. I get 3% CPU usage on my xterm, 5% when in full screen. Still too much for a barely 6 year-old laptop, but nothing to worry about.
EDIT: if you add the "-a" option (asyncronous scroll), CPU usage falls below 1%. I wonder what Terminal.app does to be so outrageously inefficient.
I have all of this except the transparent background. But that should be a compositor thing, independent of the window contents. That's bizarre, pushing a few thousand characters to the screen shouldn't, by far, reach 80% CPU usage. There's something in your system that's really botched up.
It could be a mix of both, of course.
The tools in Plan 9 are also much simpler, with fewer options (and also a few differences), but it's a very useful subset, you will rarely need anything else.
I feel like the effort the GNU project put into creating a competing standard for documentation would have been better spent improving the tooling around the standard man page mechanisms instead.
I feel like info pages are more suitable for explaining the features of larger pieces of software. Can you imagine what a mess the man page for emacs would be, if it were to try to explain all its functionality? Instead the man page of emacs only gives a brief description of the software and explains the command line options and all the functionality is explained in an info document.
I think of info as an alternative to /usr/share/doc, not man pages.
The most import features of info that are missing from man:
1. pagination 2. cross-referencing 3. structure
https://www.gnu.org/software/gawk/manual/gawk.html
There's alot of information in there that is not in the manpage.
(I'm painfully aware of this as I tend to rely mostly on the manpage, and learn things every time (which is rare) I read the GNU docs.)
At the same time, the info interface and navigation remain completely opaque and nonintuitive to me.
Info uses a dedicated document viewer, which, unless you use that frequently is novel and ideosycratic when used.
(This can be changed, but more painfully than with man.)
Info is a hypertext documentation system admittedly. It happens to have been invented pretty much simultaneously with another you may have heard of, the World Wide Web. A system with slightly greater user familiarity. And Free Software implementations.
Debian's 'dwww' is an interesting marriage of multiple docuentation formats. It presents manpages, info pages, Debian package information, and additional documentation, all categorised and indexed, and accessible through a web browser from your local system.
Including, as it happens, console mode browsers (lynx, w3m, elinks, links2, etc.). Which tends to amp up and standardise access to all of the above.
dwww is the one thing which makes info actually useful. Which is a shame as there really is some quite good info documentation, it's just buried under what is for most people, an impenetrable interface.
man man | awk '/^[A-Z]+/ { begin = 0 } /^EXAMPLES|^NAME/ { begin = 1 } (begin == 1) { print }'
manpage !manpage
Debian Manpages !debman
manpages. org !mnp
MirBSD Manpages !mbsdman
Ubuntu Manpage !uman
Errr... isn't all of science is based on trial and error?