Bash Tutorial: Getting Help

Getting Help

 Let’s face it: you need help.  A lot of help.  Your mom has known this for quite a while now, but you are just beginning to realize it.  So, let’s explore what you can do about it when she is not around.

 Let Me Google That For You / RTFM

Before you ask your pressing question to the world on Facebook, mailing lists, online forums, Twitter, and the corporate global e-mail address, first pause and do nothing.  Before you get down on your knees and pray for the answer to your pressing question (e.g., “What does the echo command do?”), reconsider.  Type your query into Google first.  You may be astonished to find out that your question has more often than not already been answered.  Others have been confounded by the very same mystery you are stuck on.

 Here are some websites where your question has already been answered:

http://stackoverflow.com/
http://www.tldp.org/
http://www.gnu.org/software/bash/manual/bashref.html
http://www.linfo.org/main_index.html
http://mywiki.wooledge.org/BashGuide

“That’s all well and good, Jeff,” you say, “but I’d have to lift my hand off my keyboard, move it to my mouse, launch a web browser, go to Google, type in a query, and hit enter to do that.  I have enough hassle in my increasingly short life.”  Wow, I’m surprised you’ve read this far given your fierce work ethic and indomitable spirit.  Fear not, if you have Launchy installed (and Firefox as your default browser), you can do it all from the keyboard.  Ah, all the fools and their pathetic touch screens!  Type <Alt + Space>google<Tab>Bash<Enter>.  Now <Tab><Enter>.  Bam!  You are on the Bash Wikipedia page without the hassle of using your mouse.

If you can’t figure out how to install Launchy, TRY GOOGLING IT!  If you can’t figure out how to configure it, RTFM!

 When the Internet Is Broken

If the unthinkable occurs, you can still get help from your trusty computer.  Fortunately, not everything has been assimilated by The Cloud yet.

$ man bash
$ info bash
$ help <built-in>
$ <non-built-in command> –help

When I use <foo>, I don’t mean type <foo> literally.  I mean “replace <foo> with something that is a foo”.  In this case, type something that is a Bash built-in command.  If you just type ‘help’ by itself, you will see a list of Bash’s built-in commands.

A built-in command is a command that Bash handles by itself.  Non-built-in commands are compiled binary executables or other scripts that exist as separate files on your computer.  Often they will support a –help command-line option.  Types of commands, command-line options, command-line arguments and a bunch of other related topics will be discussed in more detail later.

 Helping Yourself

Well, now you’ve learned a bunch of useful stuff, and what did you do with it?  Nothing.  You did not write it down.  You will not remember it.  Nice work, Einstein!  As Gandalf would say, “Fool of a Took.  Throw yourself in next time, and rid us of your stupidity. “  May I suggest a different approach: write down your hard-won knowledge.  When God talked to Moses, was that it?  Did he wander off and think, “Moses is a sharp guy–he can remember 10 things.”  No!  He wrote that stuff down on a couple stone tablets (the very ancient equivalent of CD-Rs).  You also have the ability to write down important things.  Suppose you learn something interesting about the echo command.  Maybe you could write that information in a file like ~/Dropbox/Notes/Linux/Commands/echo.txt.  Maybe that file is in Dropbox.  Maybe that file is indexed by Launchy so you can type <Alt + Space>echo.txt<Enter> to get to it really, really fast.  You may end up with a focused, quickly accessible database of knowledge pertaining to the things most relevant in your life.  Perhaps it is even under revision control on a machine that is backed up regularly.  Then, it really is like stone.

Another good way to help yourself is to write what I call ‘hello projects’.  These are simple one-file projects focused on the basics of a topic in some language.   Let’s say in the near future, you are learning about the basics of for loops in Bash.  You suddenly have the brilliant idea to make a hello project: ~/Dropbox/Projects/Hello/Bash/hello_for.sh.  Now, whenever you forget about the basics of for loops in Bash, you can look at a very focused simple piece of actual working code.

Over time, instead of asking people annoying questions, you will waste less of their time by answering them yourself.  I salute you for your contribution to society.

 If All Else Fails

If you have completely failed in your quest for knowledge, humble yourself before your fellow humans and ask a question.  While you will suffer humiliation for a second, you will not remain in ignorance for an eternity.  Asking random people at the mall will not work.  People over 60 may give you a blank look.  Small children (and many grownups) may start crying.  Try instead a tech-oriented co-worker, the mailing list of a local Linux User’s Group, or a relevant online form.  If you are still not getting results, try one of these: http://www.amazon.com/Mattel-30188-Magic-8-Ball/dp/B00001ZWV7/.  Or just ask your mom (at least if you are Dilbert).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s