athena% attach 29.123 athena% cd /mit/29.123/www
athena% man attach or athena% man cd
athena% ls pathThe following examples assume that you started the session by typing:
athena% attach 29.123 athena% cd /mit/29.123/wwwThis designates your current directory as:
athena% pwd /afs/athena.mit.edu/course/29/29.123/www
athena% ls exams index.html images test.htmlTo more easily distinguish between files and directories, use the -F option. This displays a / at the end of the directory name (ls -F path):
athena% ls -F exams/ index.html images/ test.html
athena% ls -l drwx------ 1 jqprof mit 2048 Jun 1 12:22 exams drwx------ 1 jqprof mit 2048 May 23 06:00 images -rw------- 1 jqprof mit 13744 Jun 1 14:09 index.html -rw------- 1 jqprof mit 21034 May 23 16:04 test.htmlEntries with a d at the extreme left are directories. As above, make them easier to identify with the -F option (ls -lF [path]):
athena% ls -lF drwx------ 1 jqprof mit 2048 Jun 1 12:22 exams/ drwx------ 1 jqprof mit 2048 May 23 06:00 images/ -rw------- 1 jqprof mit 13744 Jun 1 14:09 index.html -rw------- 1 jqprof mit 21034 May 23 16:04 test.html
athena% ls -lFt -rw------- 1 jqprof mit 13744 Jun 1 14:09 index.html drwx------ 1 jqprof mit 2048 Jun 1 12:22 exams -rw------- 1 jqprof mit 21034 May 23 16:04 test.html drwx------ 1 jqprof mit 2048 May 23 06:00 imagesIf you prefer to see them in reverse order (latest last), add r to the flags (ls -lFtr [path]).
To create a new directory in the current directory, the command is mkdir:
athena% mkdir directory-nameFor example:
athena% mkdir imagesYou can also use mkdir to create a subdirectory in a different place, by specifying the path as well as the new directory's name:
athena% mkdir path/new-directory-name
athena% mv file-or-directory target-pathFor example, to move a file named test.html from the current directory into the directory /mit/29.123/www/exams:
athena% mv test.html /mit/29.123/www/examsTo rename a file or directory, the format is:
athena% mv old-name new-nameFor example, to change a file's name from test.html to index.html:
athena% mv test.html index.htmlWhen moving a directory, note that:
athena% mv color /mit/29.123/www/imagesmoves the directory named color into images (so that color becomes a subdirectory of images); otherwise, it would change the name of the directory from color to images.
Unless you need to remove large files immediately because you are over disk quota, it is a good idea to use delete instead of rm to protect yourself against accidentally removing files.
For example, to delete a file named oldindex.html in the current directory:
athena% delete oldindex.htmlIf you realize this was a mistake, to undelete it:
athena% undelete oldindex.htmlIf you are sure you want to permanently remove the file:
athena% rm oldindex.htmlTo remove a directory, you can also use the command delete as long as the directory doesn't contain any files. If it does contain files, and you want to delete the directory and all of its contents, use delete -r, for example:
athena% delete -r examsTo remove a directory permanently use the command rmdir (the directory must be empty of files):
athena% rmdir exams
The structure under OldFiles is the same as in the locker itself. For example, the snapshot of the 29.123 Web site would be in the directory:
/mit/29.123/OldFiles/wwwand the index page would be in
/mit/29.123/OldFiles/www/index.htmlYou can check the age of a file in OldFiles using ls -l:
athena% ls -l /mit/29.123/OldFiles/www/test.html -rw------- 1 jqprof mit 13744 May 31 16:13 /mit/29.123/OldFiles/www/test.html
OldFiles is set to be read-only, so you must copy files to another part of the course locker in order to work on them. If yesterday you had a file named test.html and accidentally deleted it today, you could get back yesterday's version as follows:
athena% cp /mit/29.123/OldFiles/www/test.html /mit/29.123/wwwNote that this command would overwrite /mit/29.123/www/test.html if it already existed. To copy the file over with a new name for comparison or testing, specify a different name, for example:
athena% cp /mit/29.123/OldFiles/www/test.html /mit/29.123/www/test-old.html
athena% fs lq pathFor example:
athena% fs lq /mit/29.123 Volume Name Quota Used % Used Partition course.29.123 20000 11627 87% 73%The column labels identify the following:
athena% ls -lF pathFor example, to view the contents of the www directory:
athena% ls -lF /mit/29.123/www/ drwx------ 1 jqprof mit 2048 Jun 1 12:22 exams/ drwx------ 1 jqprof mit 2048 May 23 06:00 images/ -rw------- 1 jqprof mit 13744 Jun 1 14:09 index.html -rw------- 1 jqprof mit 21034 May 23 16:04 test.html
The fifth column (to the left of the date) shows the size of files in bytes; for example test.html is 21,034 bytes, or just over 21KB. Names with a / at the end are directories. The size shown for a directory does not indicate the total space used by its contents; for that information, see the next item.
athena% du -sk pathFor example, to view total space used by the www directory:
athena% du -sk /mit/29.123/www 3060 /mit/29.123/wwwThis tells you that www is using 3060KB (just over 3MB), while the following tells you that the exams subdirectory of www is using 216KB.
athena% du -sk /mit/29.123/www/exams 216 /mit/29.123/www/exams
athena% du -sk path/* | sort -n(The "|" symbol is used in Unix to "pipe" the result of one command to another, in this example, to sort the list generated by the du command. ) For example:
athena% du -sk /mit/29.123/www/* | sort -n 14 test.html 22 index.html 216 exams 2808 imagesThis shows the total space used by each file and subdirectory of the specified directory. In this example, the subdirectory using the most space is images (2808kb, almost 3MB).
For a directory containing many files, you may not want to view the entire list. Use the command tail to limit the number of files displayed to the largest ten files:
athena% du -sk path/* | sort -n | tailUse the command more to scroll through a long list:
athena% du -sk path/* | sort -n | moreIf you wish to see the list in reverse order, use sort -rn or sort -rn | head in the commands above.
When an existing course locker is reused in later terms, the FLs try to notify the people already on the ACLs as a courtesy, but it is up to new course staff to follow up with previous course staff regarding the disposition of any existing files. We are happy to assist you with archiving existing files in an inherited locker, and clearing out or archiving your own files at the end of the term.