8 ms·
> Learn basic Bash. Actually, type man bash and at least skim the whole thing; it's pretty easy to follow and not that long Skimming The Grapes of Wrath would
by smith-kyle 7y ago
> Learn basic Bash. Actually, type man bash and at least skim the whole thing; it's pretty easy to follow and not that long
Skimming The Grapes of Wrath would be shorter. Thank you, but no thank you.
- heinrichhartman 7y agoHow large is it? Like 40p when you put it on a printer? Let me help you with this: man -t bash > man.ps && lpr man.ps Then, grab a coffee, sit in the sun and spent some quality time with your tools. :)
- acqq 7y agoThe man pages are the worst form of information ever for anybody trying to really solve any real-life problem which is not specified as "learn all unnecessary switches and once-useful but used-by-nobody-today options of a command X." It happened to me often enough that even when I knew what I wanted to achieve and which command X could do that I would first try to read darned man page and fail to find the solution, but then just googling gave enough of material to a) have something to try b) have a discussion of the cases where that "something" doesn't fulfill the use most use cases of those who asked (the "natural need") including, of course, the use case I've had. I have a completely opposite attitude. Bash is horrible on many levels. Bash man page is only a part of horribleness. The main problem for all man pages is that they are mostly as if written for those who already know about every unnecessary detail of both the tool in question and all related tools or environmental issues, but who searches for some even more obscure detail among all obscure details that they already know. Not to mention the descriptions that aren't: e.g. the complete explanation of the option --frob-blonk FILE would be something like "this option uses the FILE as the frob blonk" oh, how helpful. I use bash every day, but I've at least managed to reduce its use to the minimum that keeps me still sane.
- mFixman 7y agoSkimming the bash manpage every once in a while is important to stay out of information bubbles. There are too many developers who rely only on Google/Stack Overflow to find and write answers to questions, and it's common to repeat bad, incomplete, or outdated information. I can think of a lot of times when the most accepted SO answer for many questions was "copy and paste this gigantic block of code" instead of using an existing command.
- acqq 7y agoMost of information there is not worth having in my "brain cache" at all, and especially not worth refreshing it regularly. Life is too short to even trying to remember the things like what's the difference between .bash_profile .profile .bashrc .inputrc and .bash_login (bonus point for remembering what is redirected to what in the files themselves in which distribution) or what the hell is a "login shell" and what is not. And there are many such details that are effectively useless for 99.99% of the users but they just have to survive the suffering to fix the darn thing when they have some issue. I'm sure even most of the readers here can't give a one line answer what is the "right" and "general" way to preset a darn variable for a shell. By design of all these artifacts we work with, it necessarily leads to a page-length discussion of which shells exist and what their differences are and whatnot. Such a waste of everybody's mental energy on a global level.
- 0xADEADBEE 7y agoI think it's a bit unfair you're being downvoted because you raise some good points. A lot of people agree POSIX is a mess and you've highlighted a fraction of reasons related to that. Would any of the downvoters care to elucidate? Maybe I'm missing something obvious.
- __del__ 7y agoNot a downvoter, but I assume the reason is that many people do understand these mechanisms without evicting too much from their brain cache. Files like .bash_profile, .bash_login, .profile, .zprofile, /etc/profile, /etc/profile.d/whatever.sh all serve the same purpose, the primary aspect of which is to apply things like environment variables at login. Display managers and [login] shells source these things in a predictable precedence order so that environment variables are correctly inherited by children of GUI environment processes and login shells. Login shells? Well yeah, the point of a login shell is that it invokes login-related tasks like setting environment variables from a profile. That's intentionally separate from the behavior of interactive shells because the environments of interactive shells may have been modified intentionally and shouldn't be "reset" to the values applied at login. edit: also .inputrc is the readline configuration file for things like shortcut keys in all programs which use readline (not just bash) and .bashrc is for customizations specific to interactive shells
- 0xADEADBEE 7y agoI'd agree with this. I can't stand prolix documentation when I'm just trying to get something done (I'll never understand why people extol the Python docs!). I used bropages [0] for a while but it isn't as expansive as it should be, presumably on account of a lack of traffic. I'm happy to read more expansive pages in my own time but when I'm 'in the zone' as it were, the last thing I want to do is read through why something works. Perhaps it's a gap in the market? Or more likely I'm in the minority!
- acqq 7y agoThe Python docs are, on the contrary, quite good when compared to the GNU man pages. There is an advantage of the context: the GNU *nix tools have to reflect how the things grew, totally independently, accidentaly and ad-hoc. Python is much narrower topic and the development mostly had some concept of the "overall goal."
- corey_moncure 7y agoThe Python docs opened the door to programming as a career for me in my late 20s. I/O, concurrency, polymorphism, it's all there. Thanks Python.
- jjeaff 7y agoSometimes I just want to reach through the monitor and smack the nerd that ends every answer on a forum or SO with, "you just type awk -@dee(++ | grep %%s, man pages are your friend. " When you don't know what to look for, it is not as simple as "looking something up".
- acqq 7y agoThe worst are these who don’t answer the question at all but “helpfully”’give you the link to the man page. If the answer contains an example which matches the question it is useful. (And I too actually consider awk much simpler than e.g. bash)
- semitext 7y agoTLDR is a pretty cool project that cuts out the verbosity of man pages. https://tldr.sh/ https://tldr.sh/
- leethargo 7y agoThanks for `man -t`! It's actually 78 pages on my system (Debian, bash 4.4.12). I've heard that OpenBSD has the best man pages that are more pleasant to read and more informative/concise.
- pfortuny 7y agoOpenBSD man pages are what engineering documents should be. The contrast with Linux's is astounding.
- cpach 7y agoThis reminds me of a writeup by John Carmack. Last year he did a programming retreat where he set up a OpenBSD dev environment and tried to use the base system and the included documentation as much as possible rather than using ports and WWW†. That would probably not be so nice on a Linux system. https://www.facebook.com/permalink.php?story_fbid=2110408722526967&id=100006735798590 https://www.facebook.com/permalink.php?story_fbid=2110408722... † Anyone else here that remembers the days when man pages and Windows help files used to be referred to as online documentation? As opposed to printed manuals.
- muxator 7y agoThe MSDN CDs where an endless source of amusement. The reference manuals were very good and search actually worked well. Did not feel crippled at all.
- wodenokoto 7y agoI don't know. From `man wc` WC(1) BSD General Commands Manual WC(1) NAME wc -- word, line, character, and byte count When in actuality `wc` outputs lines, words bytes ...
- monista 7y agoYou probably referring to FreeBSD man, OpenBSD is slightly different: https://man.openbsd.org/wc.1 https://man.openbsd.org/wc.1
- nikeee 7y agoUsing bash's process substitution, you could also use this: lpr <(man -t bash) See: https://unix.stackexchange.com/a/64011 https://unix.stackexchange.com/a/64011
- vram22 7y agoOr, if you're fine with reading it online, but don't want to run the man bash command each time (for whatever reason), and/or want to strip out the formatting characters once and for all, and/or want to use the search and other editing features of your favorite text editor on the contents of the man page, for faster navigation, copying-and-pasting snippets into scripts, etc., you can use this small shell script: m, a Unix shell utility to save cleaned-up man pages as text: https://jugad2.blogspot.com/2017/03/m-unix-shell-utility-to-save-cleaned-up.html https://jugad2.blogspot.com/2017/03/m-unix-shell-utility-to-... Edit: Also check out the stuff about the word mu in the latter part of the post :)
- u801e 7y agoIn vim, I can run: :r !man bash | col -b the col utility will strip backspace characters with the -b switch (along with reverse line feeds).
- vram22 7y agoRight. But check what my script called m does :) It uses col, but also redirects the cleaned-up output to a file named cmd.m (so you don't have to run that man command for the same command - like bash or other - each time), where cmd is the cmd you give to man as an arg. That file cmd.m is stored under your ~/man dir, which gets created first, with mkdir -p. More refinements possible, of course, but this was just a quick and dirty script I whipped up. For example, could check more for permission and other kinds of errors, not create the ~/man dir each time but only once, etc.
- uolot 7y agoYou can also display man pages in vim by default: export MANPAGER="/bin/sh -c \"col -b | vim -c 'set ft=man ts=8 nomod nolist nonu noma' -\""
- danielecook 7y agoHere is a function for mac os that outputs a pdf of a man page function pman() { man -t ${1} | open -f -a /Applications/Preview.app }
- nnain 7y agoLovely!
- zeveb 7y agoEven better than the man page, just print out the reference manual: sudo apt install -y bash-doc && lpr /usr/share/doc/bash-doc/bashref.pdf 178 pages of awesome.
- vondur 7y agoI’d probably add the ps2pdf command before sending it to my non postscript printer. The output of pdf to a non postscript printer would be interesting.
- wyclif 7y agoI have no doubt there's great value in learning basic bash, but I use zsh and almost all the features I use are exactly the same commands in both bash and zsh, so I think you'd probably be okay learning one or the other thoroughly.
- kissgyorgy 7y agoThis is the attitude we can't have nice things! Seriously, how many times do you use your shell every single day?
- qwsxyh 7y agoVery rarely. I hate the command line and actively avoid it.
- ramraj07 7y agoOf course if your day to day job actually allows you to fully avoid bash, then by all means ignore it!
- sureaboutthis 7y agoI always question what one's work day involves and how committed they are to their work when they say they hate the command line and avoid the shell. It says, to me, that they really don't want to delve very deeply into how computers work and don't care. If they care, but cannot understand, then I question their competence and whether they need to find another line of work.
- c0vfefe 7y agoWeb developer checking in - no, I don't really care about the depths of how computers work. I care about competently developing the web applications my employer asks me to, for which the command line is scarcely necessary.
- sureaboutthis 7y agoI'm a web developer, too. I care to know where I can speed things up or minimize things. How the code I write affects how my web applications run and which technologies I should consider or dismiss based on how it might affect the hardware we run with. Too often, the solution of some is only to throw more hardware at the problem.
- beobab 7y agoIf you read, execute and understand all the code in "The Advanced Bash Scripting Guide", you will suddenly find yourself in the top 10% of people who use bash. https://www.tldp.org/LDP/abs/html/ https://www.tldp.org/LDP/abs/html/ (as a pdf: http://tldp.org/LDP/abs/abs-guide.pdf http://tldp.org/LDP/abs/abs-guide.pdf )
- bryanrasmussen 7y agoI'm pretty sure if you read, execute and understand all the code in most advanced guides to a language you will suddenly find yourself in the top 10% of the users of that language. But the understand is the hard part.
- deleted 7y ago[deleted]
- obituary_latte 7y agoWonder why they advise cat /dev/null > file to empty a file rather than echo > file
- Dr_Emann 7y agoBecause echo-ing into a file will make a file with 1 byte in it: a single newline character.
- oreo83 7y agoecho -n >file
- chaosite 7y agoWell, `echo > file` won't empty the file, it will have a newline in it. At the very least you'll need `echo -n > file`.
- luckman212 7y ago
- sureaboutthis 7y agoCause there's gotta be a button on this thing for that thing, right?--Homer Simpson Learning the fundamentals of your tools is a...fundamental of doing this job. If you don't want to know how your tools work, I question one's competence or desire to do this job.
- schwurb 7y agoHomer was wrong in his assumption. If there however does exist a button, and it works, and there is no danger associated with ignorance about its internals, then there is nothing wrong with using the button. After all, someone put it there. > If you don't want to know how your tools work, I question one's competence or desire to do this job. I in turn question one's competence when, instead of getting the job done, hours upon hours are spent on irrelevant parts of configuration or getting some ideal solution to work where something less elegant would perfectly suffice. Unfortunately, the folks insisting on 'mastering' ones tools tend to often be in that category. As an analogy: I don't care if the craftsmen that fixes my house uses his hammer holding it upside down. I only care that my house is properly fixed and stays so. How that was achieved, I could not care less about.
- sureaboutthis 7y agoIf one is spending hours upon hours on irrelevant parts, I, again, question their competence. If one doesn't care that the carpenter building his house is using a hammer upside down, that's a whole 'nother bunch of issues I won't go into here.
- schwurb 7y ago> If one doesn't care that the carpenter building his house is using a hammer upside down, that's a whole 'nother bunch of issues I won't go into here. I'd love to see at least a small allusion to what nature the issues are made of. Because, to iterate, I'd rather have a well-built house build by an absolutely unconventially working carpenter than a mediocre house build by someone that knows how to use a hammer according to the textbook. If I want to see nice processes and fantasies fulfilled, I watch movies. In real life, I care about results.
- dllthomas 7y agoSome friends and I read the whole thing aloud, start to finish, pausing to discuss and experiment, over a handful of lunches. The Grapes of Wrath would be longer, and the Bash man page has fewer turtles.
- harry8 7y ago5931 lines here. 25 lines per page of a novel seems reasonable. ~240 pages for man bash Google says the grapes of wrath has 464 pages. I call that a similar ballpark. If I had an English exam with Steinbeck as one of the set texts just once I would read every word of it. I have a shell exam every damn day I work rest and play. Do you? Is skimming seeming more reasonable in that light?
- jammygit 7y agoAn aside: I highly recommend reading the grapes of wrath