Typing in
ls -l
will result, once we have something stored in this working directory, in a
more complete listing of the contents of the directory, i.e., the names of the
files, their last update dates, their sizes, and their permissions (more on that
later).
mkdir = (m)ake (d)irectory
Now type
mkdir bathroom
and you will create a subdirectory under my_house.
If you now type
ls
you will see that bathroom is there!
cd = (c)hange(d)irectory
cd = (c)hange (d)irectory
Type in
cd bathroom
and then type in
pwd
to see what directory you are in.
The computer should respond:
/my_house/bathroom
using the assumptions listed above (your situation will be different).
cd = (c)hange(d)irectory ../..
To go backward, type
cd ../..
and then
pwd
to see that you are back where you started.
In any directory, there are always two special entries, one called `.',
and the other called `../..'.
The latter refers to that directory for which the current one is a sub-directory.
The former refers to the current directory itself.
Thus,
cd .
is a statement with no effect, since it asks the computer to change directory
to the current directory, i.e., no change at all.
cp = (c)o(p)y
If you have created a file, call it `toothpaste.pl' you can make a
copy of it by issuing the command
cp toothpaste.pl toothpaste2.pl
which will create a copy of the file, called `toothpaste2.pl'.
This second name could have been anything you like, such as `toothpaste.pl_safety'.
Usually, the second part of the name (beyond the `.', i.e., the extension)
often is used to identify the main processor which will handle the file, while
the first part of the name (the identifier before the `.') is used to remind
you of what this file contains.
Cryptic names are not enouraged, since our memories are highly fallible.
To help us remember what we have, the following command is
useful
head
Issuing a command such as
head toothpaste.pl
will result in the first few lines of the file `toothpaste.pl' to be printed out
on your console.
If you included descriptive comments in these first few lines of every Perl program
you wrote, you would have an easy way of refreshing your memory about the contents
of the files in your current directory.
tail
This command prints the last few lines of your file onto the console, which may
or may not be helpful. i.e.,
tail toothpaste.pl
cat
This command prints the all the lines of your file onto the console.
cat toothpaste.pl
rm
remove is the Unix funtion for deleting
files, i.e., removing them.
du = (d)isk (u)sage
This command prints out the amount of storage that subdirectories
are taking in this file.
du -a will do the same
(including listing files themselves)
throughout all the subdirectories
recursively, to the end of each subdirectory tree, which gives you a clear
understanding of what is where.
44 ../../prelims
68 ../../perl
14 ../../home_stuff
54 ../../question
220 ../..
is a typical du result, while
8 ../../intro.pl
12 ../../intro1.pl
4 ../../intro2.pl
6 ../../prelims/prelim2.pl
8 ../../prelims/prelim1.pl
12 ../../prelims/prelim3.pl
16 ../../prelims/prelim4.pl
0 ../../prelims/du_list.pl
44 ../../prelims
2 ../../perl/perl1.pl
2 ../../perl/perl4q1.pl
18 ../../perl/perl2.pl
22 ../../perl/perl4.pl
18 ../../perl/perl5.pl
4 ../../perl/perl5q1.pl
68 ../../perl
4 ../../intro3.pl
4 ../../madlib.pl
6 ../../madlib2.pl
6 ../../home_stuff/login.pl
2 ../../home_stuff/read_students.pl
2 ../../home_stuff/students_fall_96.dat
2 ../../home_stuff/read_students_1.pl
14 ../../home_stuff
6 ../../question/q1.pl
2 ../../question/q1_help.pl
2 ../../question/q1_real.pl
2 ../../question/q1_help_real.pl
22 ../../question/perl4.pl
4 ../../question/perl5q1.pl
6 ../../question/q1a.pl
4 ../../question/q1a_real.pl
4 ../../question/q1aa_real.pl
54 ../../question
220 ../..
is a typical du -a result.
Piping the command to an output file, i.e., sending the output to a
file for future use, possible printing, etc., can be done using
du -a >filename.output.
man
This command will tell you the internal Unix description of a command, i.e.,
man du will tell you more than you want to know about the
`du' command.
apropos
This command is very useful when you don't know where to look.
apropos disk will give you a list of commands which may concern
disks.