|
|
Introduction to Unix As an operating system, Unix is similar in some ways to DOS, but it is much more capable and complex. Our Unix systems at Smith provide a number of applications that are full-featured but simple to use. This document describes those features, as well as listing commonly used commands. Note: You can get more help by typing the following at the system prompt: man command_name (or man man for help on help!) Please note that, unlike many other operating
systems, Unix is case-sensitive. That means that typing SSMITH as
your username is NOT the same as typing ssmith. We suggest using all lower
case letters for filenames and commands unless otherwise specified.
Back to top >> You can create directory names longer than 8 characters. Use the
underscore character (_) instead of a space for compound directory names. Remember,
Unix is case sensitive, so directoryname is not
the same as Directoryname or DirectoryName. Move into the directory in which you wish to create a subdirectory. This creates a subdirectory of the current directory, or a "child" of the "parent" directory. Creating the directory does not move you into that subdirectory, it only creates it.
Type the change directory command without a directory name specified. That is, cd. This will return you to home base and you may move to another directory from here, if you choose.
At the system prompt, type: rmdir directoryname. In order to delete a directory, it must be empty and you must be
in the parent directory. To delete files within a directory in order to empty it,
see File Management.
There are 3 kinds of permissions for 3 kinds of access. 'Owner', which is you, 'Group' which is largely unnecessary (and so this documentation will largely ignore it), and 'Other(public)' for 'Read', which is looking at a file, 'Write', which is changing, adding, or removing files, and 'eXecute' which is running files (like scripts) or getting into directories. In order to get into a directory, you must be able to 'eXecute' it. In order to see what these permissions look like, when you have used SSH to get into sophia, and you're at the [<username>@sophia ~]$ prompt (where <username> is your username), you can type ls -laF (ls for list, - to add specifications to the list: l for long, a for all, F to show types of files. (see File Management for a list of helpful commands.) You'll get a list something like this: drwx--x--x 3 user staff 4096 Apr 10 15:21 ./ In your home directory (./), the owner (which is you), will have all the permissions: rwx - Read, Write, eXecute. Other (other people) will have only x, because you want them to be able to get into the directory to see and get into public_html (which is the folder for your website), but you don't want them looking at anything else. Looking at the letters on the left: d is for directory. The first 3 characters after that owner (your) permissions, the next 3 for group, and the last 3 for Other (...everyone else). So if you look at this line: drwx--x--x 3 user staff 4096 Apr 10 15:21 ./ you can see it is a directory, that owner (you) have Read, Write, and eXecute permissions. Group and Other (public) have only eXecute, meaning they can move into that folder, but not see, change or delete it. If you look at this line: drwxr-xr-x 3 user staff 4096 Apr 10 09:50 public_html/ you're looking at the area on sophia that holds your webpages. Again, it is a directory, and again, the owner (you) has rwx, but this time, Group and Other have r-x, meaning they have Read (so they can see your pages), they DO NOT have Write (so they can't change them), and they have eXecute (so they can get into the directory.) Other information listed there is your username, the size of the file, the date the file was created, and then the actual name of the file. If there is a / after the name, it means it is a directory (just a repetition of the d in the beginning). To change permissions, you will use the chmod command. Look at this line: -rw------- 1 user staff 22869 Apr 17 15:59 mbox ‘mbox’ is your mailbox on sophia. Say you wanted Other people to read that, you would type chmod o+r mbox which basically means Change Mode (for) Other: add Read (to) mbox. If you typed ls -laF again, you would see: -rw----r-- 1 user staff 22869 Apr 17 15:59 mbox If it suddenly occurred to you that letting others read your mail would be a bad thing, you would type chmod o-r mbox which basically means Change Mode (for) Other: remove Read (from) mbox. Back to top >> To examine files in a directory:
mv file newfile Renames
file as newfile. Note: If the move or copy commands are about to write over an existing file, the system will prompt you to confirm the command.
rm filename Deletes (removes)
files NOTE: You can use the wildcard character * to operate on groups of files. For example, rm *.txt would delete all files with the extension *.txt in the current directory. Be careful when using the wildcard character, so that you don't inadvertently alter more files than you intend. For example, rm * would delete all the files in the current directory! Back to top >> |
||
|
|
|
|
Maintained by Information Technology Services // Main Office (413) 585-3770 For user support, call (413) 585-4487 // Send comments to tara@email.smith.edu |