. . . . . . . . . ( end of section Why) <<Contents | End>>
Sections
(why): 4.01
(exam): 4.02, 4.06, 4.09
(useful): 4.02, 4.05, 4.06, 4.07, 4.09
(perhaps): 4.03
(skip): 4.04, 4.08, 4.10
Facts
In UNIX you are given a directory and you can make directories in it, and
inside them as well.(4.01).
Chapter 4 is full of things you should as soon as possible... see [ Exercises ]
It also has some things that you may want to do later or only if you need them: 4.03, 4.04
If you write programs, put your source code in directories called 'src'. This is universally pronounced 'sors'. Also use the normal rules for suffices: [ What do I name files in CS_FAQ ]
You need to think about the names of files - read 4.06.
Here is another trick I have invented. Suppose you are writing a term paper for a certain class with five parts called
what
correct
good
bad
interestingThese need to be in that order. Obviously, you make a directory called 'paper' for the class. You also (obviously) have 5 files, one for each part, but if you use the obvious names UNIX lists them in the wrong order:
bad
correct
good
interesting
whatSo number the parts:
1.what
2.correct
3.good
4.bad
5.interestingAs a result, UNIX lists them in the right order. MORE.... A wild card (*) will expand into the files in the right order as well:
echo cs360/paper/*becomes
echo cs360/paper/1.what cs360/paper/2.correct cs360/paper/3....But there is even more.... Because the numbers are unique you don't need to type in the whole file name...
echo cs360/paper/1.*is only one file.
If you have more than 9 files that need numbering -- use two digits: 01,02,03,... then you won't get this sequence 1, 10, 11, 2, 3.... If you have more than 99 files, start to think about some subdirectories(4.07).
I also keep appointments and "to do"s in a special 'todo' directory. The name is an encoded date:
19991004(october 4th 1999). This means that the directory is in the right sequence, that wild cards can select a year (1997.*.*) or a month (1997.10.*) for me. I've even written a script called
todaythat gives me the file name for today... and another script that shows me all due reminders....
You can customize 'vi' by creating a ".exrc" file. Why is it called ".exrc"??? Because: (1) "vi" is an alternate name for "ex" the extended editor, and "rc" stands for "run commands".
You'll see a lot of "rc" files in UNIX: ".cshrc", ".newsrc", ".mailrc",... By the way, the "rc" convention goes back to the Honewell computer company! (4.09)
(4.09): My Q/quickie command can be used to set up .exrc for you.
[ Exercises ]
Finding commands: which, whereis (4.10). The Korn shell has 'whence', and on some of our systems I have written 'Whereis' that ransacks the system for files. On some systems I've written my own 'whence' and 'whereis' anyway. So if the commands don't work on a machine look for
List of Standard Directory Names
Standard directory names:
wrk working files
tmp temporary files that can be removed once used
bin binary files and executable scripts
src source code for programs
lib libraries: data for other programs to use
adm Administrative files
etc for UNIX system data files
misc miscellaneous files
include header files to be included in C & C++ program
News Used by tin and other newsreaders
Mail Used by elm for handling mail
mail Used by pine for mail messages
Standard names of directories higher up the tree
usr Files need by users but owned by the system
u where we put home directories
var various variable administrative and temporary files
sbin shared binaries
share shared directories
mail for mail
local Things we put on the system
spool for things waiting to be processed
See also
Adding a directory to your PATH:
[ 08.shell.html ]
[ 08.shell.html ]
Exercises
mv foo cs360/foo
cd cs360
cd
.project Your role at work or in life
.plan Name, other Email addresses, numbers, schedule or motto.
.signature Names and addresses, ....
quickie noviceor
quickie setupdepending on whether you have used "vi" before or not.
Find a machine/system that will execute the
whence catand then ask it
whence whenceand
. . . . . . . . . ( end of section Exercises) <<Contents | End>>
Questions
Explain whose each of these is and what each of them should contain:
. . . . . . . . . ( end of section Questions) <<Contents | End>>
Submit Your Notes Here
To earn credit for completing this part of the course
you need to send me a short list of things you have learned.
A simple way to do this is to
follow this
[click here
if you can fill this hole]
link and fill in the form using.