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 historyCommand 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 /tand then repeatedly press the Tab key, you’ll see items beginning with the letter tin 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
history1
cd Photos lt3 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 exclamation mark (
!
) character. For example, to run the command numbered in the history list,
you can type Share with your friends: