Grasping the basics of Bash
Where and Who?
If you get lost in the directory structure while in the command line, you can use pwd, which is short for "present working directory" to get your bearings. If you have been switching accounts and want to be sure, for example, that you are not running a dangerous command as root, then the whoami command will tell you the name of the account that you are currently using. If, however, you find yourself continually forgetting the current account name, you might want to research how to add it to your command prompt (Figure 2).
As you enter commands, Bash also has several ways to save time and reduce typing. Unless a full path is given, any files or sub-directories that you type are assumed to be in the present directory. However, if you want to be absolutely sure (which is never a bad idea), you can use ./ to indicate the present directory. For instance, if you are in a user account named bruce, then typing /home/bruce/download is the same as typing ./download. If your sub-directories are several levels deep, then this piece of shorthand can significantly reduce your typing.
There are also several different shortcuts that you can use with the cd (change directory) command:
- cd .. – Moves you to the directory directly above the current one.
- cd - – Returns you to the previous directory.
- cd ~ – Returns you to the home directory for the current account.
- cd ~[directory name] – Changes to the directory specified within the home directory for the current account.
These last two shortcuts explain why you often see references to the home directory reduced to a tilde. For example, if you see a reference to ~/.bashrc, it is indicating the .bashrc configuration file in your home directory.
Finding Command Help
As you work at the command line, you will undoubtedly come across unfamiliar commands, many with more options than you can easily remember. If all you want is a quick explanation of a command, you can use apropos or what is. The only trouble is that, while these commands can serve as reminders for veteran users, their output is often cryptic to the less experienced. For example, if you enter apropos chmod, the definition you receive is "change file mode bits," which is geeky enough to scare off most beginners (Figure 3).
You can get more detailed information by typing man followed by the name of the command. However, the quality of so-called man pages varies wildly. Although some pages, especially more recent ones, read easily enough, others are written for an expert audience. In fact, some may have remained almost unchanged for a decade or more.
In theory, info pages – the explanatory notes you receive when you enter info followed by a command name – are more user-friendly than man pages. And, in practice, they often are. However, they are sometimes little better than the worst man pages and can vary almost as much. Moreover, the original impetus to help info pages evolve into a replacement for man pages seems to have weakened in recent years, and the quality varies.
Often, the most useful help you can find is to use the -h or --help option for a command, which produces a short summary of options. What is missing, however, is any sort of built-in help that allows you to enter a description of the action you would like to perform and receive a list of possible commands. Unfortunately, the options here are the only ones available to you without searching on the web.
Mozilla’s script blocker add-on could be putting malware sites on the whitelist.
The Internet community officially banishes the notoriously unsafe Secure Sockets Layer protocol.
Popular desktop environment continues the Gnome 2 legacy – with new support for the Gnome 3 toolkit.
The Obama White House has issued a memorandum telling all US government agencies they must use HTTPS for all websites and web communication.
New program will dial up security for the Firefox browser.
Red Hat's community distro embraces the cloud.
New partnership will bring more and better CS training to US schools
Criminals offer online help over Tor network
Sophisticated malware is still present on Joomla and WordPress sites around the world.
Future versions of Ubuntu's code service will support the popular Git version control system used with Linux and other open source projects.