Quick List | |
|---|---|
| ls | display a list of files in the current directory |
| pwd | display the path and name of the current directory (print working directory |
| ~ | the tilde. Represents your home directory (the directory you start in when you login) |
| cd | change directory |
| cd .. | change to the directory above the current directory in the path |
| cd ~ | go back to your home directory |
| mkdir | make a new directory |
| chmod | change the mode (the rights) to directories or files |
| man | the online manual pages |
Descriptions and Examples | |
|---|---|
| ls |
list files When you get an account on a host computer like Zoo/Moose, you are given a home directory. Since there are typically many accounts on a host computer it follows that there will be many directories. You can store files in your home directory and even create sub-directories within it to organize your files. After logging in to your account you can see a list of the files and directories in your home directory using the ls (list) command. Type ls <enter>: at your prompt. The computer will list the files and directories in the current directory. Directories have a slash (/) at the end of their names. ls by itself lists normal files and directories but there are several other ways to use this command. For example, some files in UNIX have special names. They have a dot preceding their name, like .signature and .forward. You can see these files with the ls command by typing: ls -a <enter> When you create a new file or directory zoo/moose automatically set rights for the file that prevent other people from seeing its contents. You can see how the rights are set for your files by typing ls -l (that's a lower case letter "L"). More inf ormation on these rights is given below.
|
| pwd | print working directory Your home directory is probably itself a sub-directory of other directories. You can see what your directory is named and where it fits in the grand scheme of directories by using the pwd (print working directory) command. To use it, simply type pwd at your prompt and press <enter> You will see the "path" that leads to your home directory. The last item in that path is your home directory's name. On Zoo/Moose, that is probably the same as your login name.
|
| cd |
change directory You can move from one directory to another using the cd (change directory) command. There are several ways to use this command:
1) Type cd .. (that's: cd space dot dot) Then press
<enter>. 2) Type cd dirname where dirname is the name of another sub-directory. (Remember, you can type ls to see a list of files and other directories in whatever directory you are currently working in.) UNIX is not very communicative. It will not tell you that it has changed to another directory. To verify that it has, type pwd.
3) Type cd ~ <enter> (The ~ is called a tilde. You
will find it on your keyboard, probably to the left of the number 1 key at
the top of the typing keys.) The tilde has a special function. It
represents your home directory. Thus, no matter which directory you are
in, you can always return to your home directory by typing cd ~. How can you tell if it
worked? Try pwd. |
| mkdir | Make directory You can create new sub-directories within your directories with the mkdir command. Use cd to get to the directory within which you would like to have a sub-directory, then type mkdir name where name is the name youwould like to give the sub-directory. You can upper or lower case letters, dashes, and dots, but you cannot have any spaces in the name.
|
| chmod | Change file modes Whenever you create a new file or directory, or move a file to a directory, it is given certain rights. Generally, it is set so that only you can see the contents of the file. When we publish files on the Web we obviously want other people to be able to see the contents of the file. To make this possible we use the chmod command. For purposes of publishing on the web you will need to know two variations of this command: chmod 755 dirname and chmod 644 filename. These varitaions apply to directories and files, re spectively. Since it is such an important command it will be described in detail in other sections of this tutorial. |
| man | manual pages You can learn more about any of these commands by typing man command (where command is the name of the command) at your prompt. For example, to learn more about the ls command, type: man ls Beware: the man pages are meant as reference pages. That is, they are not written with ease of use and new UNIX learners in mind. This is a nice way of saying they can be rather intimidating! |


