Databases Reference
In-Depth Information
You can also change to your home directory by using the tilde shortcut:
$ cd ~
In fact, you can leave out the tilde: cd on its own means “change to my home
directory.”
ls
Lists the files and directories in your working folder. For example, you can list the
files in your home directory by typing:
$ ls ~
Together, the cd and ls commands are the text equivalent of using a graphical file
manager—such as Konqueror or Nautilus under Linux, or the Finder under Mac OS
X—to go to different directories and view their contents.
Command completion and history
Command completion is a great time-saving feature; when you start to type the name
of a command, file, or directory, pressing the Tab key cycles through names that could
match. The best way to understand this is to try it. For example, when you type:
$ cd /t
and then repeatedly press the Tab key, you'll see items beginning with the letter “t” in
the / (filesystem root) directory. If a name has spaces, a backslash character is added
automatically before each space—for example My\ Important\ Notes.txt . Most Linux
and Mac OS X systems are configured to use the bash shell, and we assume you're using
this, too. If you're using a different shell variant, such as tcsh , you'll need to press the
Ctrl-D key combination in place of the Tab key.
Pressing the up and down arrow keys will cycle through the last commands you typed;
you can use the arrow keys to edit a previous command, and you can press the Enter
key to run a displayed command. You can see a list of recently used commands with
the history command, as below:
$ history
1 cd Photos/
2 lt
3 find . -name "*AMES*"
4 cfdisk /dev/hda
5 ssh ubuntu@192.168.1.1
You can quickly run a command again by typing the number preceded by an exclama-
tion mark ( ! ) character. For example, to run the command numbered 3 in the history
list, you can type !3 and press the Enter key.
Performing restricted operations
Certain restricted operations on a Linux or Mac OS X system are allowed only if you
have superuser , or root, privileges. On a Linux system, you can log in as the system root
 
Search WWH ::




Custom Search