26.10.2012 Views

SUSE LINUX Documentation - Index of

SUSE LINUX Documentation - Index of

SUSE LINUX Documentation - Index of

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

98 Start-Up<br />

To list the contents <strong>of</strong> home directories <strong>of</strong> other users, enter ls ~username . In the<br />

example directory tree in Figure 3.4, “Excerpt from a Standard Directory Tree”<br />

(page 94), one <strong>of</strong> the sample users is tux. In this case, ls ~tux would list the contents<br />

<strong>of</strong> the home directory <strong>of</strong> tux.<br />

NOTE: Handling Blanks in Filenames or Directory Names<br />

If a filename contains a space, either escape the space using a back slash (\)<br />

in front <strong>of</strong> the blank or enclose the filename in single or double quotes. Otherwise<br />

Bash interprets a filename like My Documents as the names <strong>of</strong> two files<br />

or directories. The difference between single and double quotes is that variable<br />

expansion takes place within double quotes. Single quotes ensure that the shell<br />

sees the quoted string literally.<br />

3.1.4 Useful Features <strong>of</strong> the Shell<br />

Entering commands in Bash can include a lot <strong>of</strong> typing. In the following, get to know<br />

some features <strong>of</strong> the Bash that can make your work a lot easier and save a lot <strong>of</strong> typing.<br />

History and Completion<br />

By default, Bash “remembers” commands you have entered. This feature is called<br />

history. To repeat a command that has been entered before, press ↑ until the previous<br />

command appears at the prompt. You can also move forward through the list <strong>of</strong><br />

previously entered commands by pressing ↓ . You always have the chance to edit this<br />

command, for example, changing the name <strong>of</strong> a file, before you execute the command<br />

by pressing Enter . To edit the command line, just move the cursor to the desired position<br />

using the arrow keys and start typing. Use Ctrl + R to search in the history.<br />

Completing a filename or directory name to its full length after typing its first letters<br />

is another helpful feature <strong>of</strong> Bash. To do so, type the first letters then press →| . If<br />

the filename or path can be uniquely identified it is completed at once and the cursor<br />

moves to the end <strong>of</strong> the filename. You can then enter the next option <strong>of</strong> the command,<br />

if necessary. If the filename or path cannot be uniquely identified (because there are<br />

several filenames starting with the same letters), the filename or path is only completed<br />

up to the point where again several options are possible. You can then obtain a list <strong>of</strong><br />

them by pressing →| a second time. After this, you can enter the next letters <strong>of</strong> the<br />

file or path then try completion again by pressing →| . When completing filenames

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!