ambassadors of technology
|
August Ada Byron was born December 10, 1815 the daughter
of poet Lord Byron. Five weeks after Ada
was born, Lady Byron asked for a seperation from Lord Byron,
and was awarded sole custody of Ada, who she brought up to
be a mathematician and scientist. Ada heard Charles Babbage's
ideas for the Analytical Engine in
November, 1834. Luigi Menabrea wrote a summary of what
Babbage described, and published an article in French about the
development. Ada, in 1843, married to the Earl of Lovelace, and
the mother of three, translated Menabrea's article. When she showed
Babbage her translation, he suggested she add her own notes, which
turned out to be about three times the length of the original article.
Letters between Charles and Ada flew back and forth. In her article,
published in 1843, Lady Lovelace predicted
that such a machine might be used to compose complex
music, to produce graphics, and would be used for both practical
and scientific use. Ada suggested to Babbage writing a plan for
how the engine might be used to calculate Bernoulli numbers. This
plan is now considered as the first "computer program".
A software language developed by the US DOD was named "ADA"
in her honor in 1979.
|
Every operating system includes a facility to store documents you create,
programs configuration information, etc. This information is stored in
logical units called files, and the facility that stores them is called
the file system.
The unix file system has provisions for a special kind of file called a
directory. Directories are special because, although they cannot contain
any data themselves, they can contain other files (including other
directories). If you are familiar with the Windows or Macintosh operating
systems, you may know about directories already, although you may refer to
them as folders. Windows and MacOS borrowed the idea of directories from
unix.
Every process in unix has a current working directory. This includes
your shell. Files you create will be stored in your current working directory,
unless you explicitly specify for them to be stored elsewhere. When you first
log in to a unix system, your current working directory is your home
directory, a special directory set aside for you to put your files in.
To find out what your shell's current working directory is, you can use the
pwd (print working directory) command.
Monolith[100]% pwd
/home/brad
This tells me that my current working directory is the directory called `brad'
inside the directory called home. This happens to be my home directory.
To find the names of the files in your current working directory, you can
use the ls command.
Monolith[101]% ls
the contents of my home
directory is enormous but normally
all the files in it
would list here
To change your current working directory you can use the `cd' command.
Monolith[102]% cd /usr/bin
This changes my working directory to the directory `bin' inside the
directory `usr'. I could also have typed:
Monolith[103]% cd /usr
to get to the `usr' directory, and
Monolith[104]% cd bin
to get to the bin directory inside the current working directory, which is now
`usr' (because of the last command I typed).
The entire filesystem starts at the root directory (/). This is why I put
a slash in front of `usr', but not in front of `bin': I wanted to change
my working directory to the bin directory inside the usr directory inside the
root directory. /usr/bin happens to be where most of the programs that come with the unix
distribution are.
Each directory contains two special entries . and .., which refer to the
current directory and the parent directory (the parent is the directory
that contains the current directory). So to change your working directory to
the directory that contains your current working directory, you could
type
Monolith[106]% cd ..
To get back to my home directory, I could type
Monolith[106]% cd /home/brad
or I could simply type
Monolith[107]% cd
When you save a file, you choose a name for that file. The file system
stores the data you're saving and marks it with the filename you chose. It
also marks the file with the date and time you modified it. If the filename
you chose contains no slashes, the file is stored in your current working
directory. Otherwise it's stored in the directory you've specified. For
example:
- /fileshare/myfile
Stores a file called myfile in the directory fileshare, which is in the root
directory.
- letters/cover.txt
Stores a file called cover.txt in the letters directory, which in turn is in
the current working directory (not the root directory, note the absence of the
slash at the beginning).
- testprn.ps
This stores a file called testprn.ps in the current working directory.
Two commands exist for copying and moving files around in the file system,
cp and mv.
Monolith[108]% cp rock.mp3 /fileshare/mp3/
this copies the file rock.mp3 from the current working directory to the
mp3 directory inside the fileshare directory.
Monolith[109]% mv rock.mp3 /fileshare/mp3/
This moves the file rock.mp3 from the current working directory to the
mp3 directory inside the fileshare directory. rock.mp3 no longer exists
in the current working directory.
Monolith[110]% cp /fileshare/mp3/rock.mp3 .
This copies the file rock.mp3 from the mp3 directory inside the fileshare
directory to "." (the current working directory).
Filenames are case sensitive in unix, unlike MacOS and Windows, so MyFile,
myFile, myfile, MyFiLe and MYFILE are all different files. A filename must
be unique to the directory the file is in.
A file can have multiple names in the file system. You can create a new
name for a file by using the ln command.
Monolith[111]% ln myphonebook /fileshare/bradsphonebook
Creates a file in /fileshare called bradsphonebook that contains the same
data as the file myphonebook in the current working directory.
You can also create soft links, which are a special kind of file that link
to another file (like Windows shortcuts or MacOS aliases). These are usually
preferrable to hard links (the type mentioned before) because you can't
hard-link a directory, nor can you hard link a file on one disk to another.
Monolith[112]% ln -s /fileshare .
This creates a softlink to the directory /fileshare in the current working
directory (also called fileshare, since I didn't specify a different name).
Unix-style file systems store several bits of information besides file names
and modification dates:
- The user that owns the file
- The group that owns the file
- Permissions on the file for the user who owns it
- Permissions on the file for the group who owns it
- Permissions on the file for the everyone else
You can see these attributes by using the -l command line option to ls:
Monolith[113]% ls -l
total 33
drwxr-xr-x 2 root wheel 512 Oct 4 08:59 fs
-rw-r--r-- 1 root wheel 9012 Oct 2 16:49 index.html
-rw-r--r-- 1 brad users 21137 Oct 2 13:42 kenden.jpg
Monolith[114]%
The first entry is for `fs'. The `d' in the drwxr-xr-x means that
`fs' is a directory. The `rwx' means `fs' is readable,
writable, and executable by the owning user. The `r-x' right after that means
`fs' is readable and executable, but not writable, by the owning
group. The final `r-x' means `fs' is readable and executable, but not
writable by everyone else.
These attribute bits actually mean something different on files versus
directories:
|
Attribute
|
Regular Files
|
Directories
|
|
Read
|
File can be opened and copied.
|
Contents of directory can be listed (eg, with ls).
|
|
Write
|
File can be overwritten/modified or deleted.
|
Contents of directory can be altered.
|
|
Execute
|
File can be executed (a program or shell script).
|
Files inside directory (that have read permission enabled) can be opened.
|
Following that, the `root' means the file is owned by the user `root'. `root'
is the system administrator on any given unix system. The group that owns the
file comes next, `wheel'. Following that is the last modification date and
time. Unlike DOS and Windows, unix does not store the creation date and time
of a file.
All these attributes (with the exception of the modification time) can be
modified. To change the owner of a file, you can use the `chown' command.
Monolith[115]% chown brad.users kenden.jpg
This makes the file `kenden.jpg' owned by user `brad' and group `users'.
You can only change the ownership of a file if you are root.
You can also change permissions of files using the `chmod' command.
Adding and removing permissions on a file is quite easy using this command.
The first parameter to chmod tells chmod who to add or remove permissions for,
and following a + or -, what permissions to add or remove. In this first
parameter, `u' means owning user, `g' means owning group, and
`o' means other users. r, w, and x mean read, write and
execute,
respecively.
Monolith[116]% chmod o-w kenden.jpg
This removes write permission on the file `kenden.jpg' for all users other
than the owner and the members of the owning group.
Monolith[117]% chmod u+rw kenden.jpg
This adds read and write permission for the owner of the file.
Monolith[118]% chmod g+r-w kenden.jpg
This adds read permission and removes write permission for members of the
owning group.
If you happen to be well versed in the octal numbering system, you can change
the modes of files using octal numbers:
Monolith[119]% chmod 0644 kenden.jpg
This makes kenden.jpg readable and writable by the owner, and read-only
to everyone else.
The second octal digit (the six) is the permissions for the owner. The
third (the first four) is for the owning group, and the fourth (the secnd four)
is for everyone else. If you think about which bits are set in each number,
it makes sense:
| octal | binary | meaning |
| 0100 | 000 001 000 000 | file executable/ directory browsable by owner (unreadable executable files aren't very useful) |
| 0200 | 000 010 000 000 | writable by owner |
| 0300 | 000 011 000 000 | writable and executable by owner |
| 0400 | 000 100 000 000 | readable by owner |
| 0500 | 000 101 000 000 | readable and executable by owner |
| 0600 | 000 110 000 000 | readable and writable by owner |
| 0700 | 000 111 000 000 | executable and readable and writable by owner |
| 0050 | 000 000 101 000 | readable and executable by group |
| 0005 | 000 000 000 101 | readable and executable by everyone else |
| 0644 | 000 110 100 100 | readable and writable by owner, read only for everyone else |
and so on and so forth ...
The first octal digit (the zero) is for special purpose stuff like making
directories sticky (ie, anyone can write to them but noone can delete anyone
else's files or change them), or making programs set-user-id (meaning that the
program runs with the permissions of the owner). See chmod(1) in the
manual for more details.