UNIX Tutorial One
UNIX Tutorial One
There may be no files visible in your home directory, in which case, the UNIX prompt will be returned. Alternatively, there may already be some files inserted by the System Administrator when your account was created. ls does not, in fact, cause all the files in your home directory to be listed, but only those ones whose name does not begin with a dot (.) Files beginning with a dot (.) are known as hidden files and usually contain important program configuration information. They are hidden because you should not change them unless you are very familiar with UNIX!!! To list all files in your home directory including those whose names begin with a dot, type % ls -a
ls is an example of a command which can take options: -a is an example of an option. The options change the behaviour of the command. There are online manual pages that tell you which options a particular command can take, and how each option modifies the behaviour of the command. (See later in this tutorial)
To change to the directory you have just made, type % cd unixstuff Type ls to see the contents (which should be empty)
Exercise 1a
Make another directory inside the unixstuff directory called backups
1.5 Pathnames
Exercise 1b
Use the commands cd, ls and pwd to explore the file system. (Remember, if you get lost, type cd by itself to return to your home-directory)
% ls unixstuff to list the conents of your unixstuff directory. Now type % ls backups You will get a message like this backups: No such file or directory The reason is, backups is not in your current working directory. To use a command on a file (or directory) not in the current working directory (the directory you are currently in), you must either cd to the correct directory, or specify its full pathname. To list the contents of your backups directory, you must type % ls unixstuff/backups
Summary
Command ls ls -a mkdir
Meaning list files and directories list all files and directories make a directory
cd directory change to named directory cd cd ~ cd .. pwd change to home-directory change to home-directory change to parent directory display the path of the current directory