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.
Upcoming switch to HTML5-only ads is further evidence the Flash is entering its final days.
US government invests $19 billion on enhancing security and replacing ancient computer systems.
But you can still be a non-voting “individual supporter” if you pay the money
Several current systems could fall victim to the attack
Latest Linux engine comes with better graphics and support for Intel's new power-saving chips.
Hackers send a message of beauty and liberation to server logs
Citrix gets excited about new Pi-Powered XenDesktop client system
Linux on Azure cert heralds a new era for Redmond.
Proposals for presentations at the CeBIT Open Source Forum will be accepted through 24 January 2016.
Adobe looks for a new start; renames its embattled Flash tool.