Notes - UNIX I

Wednesday, June 03, 1998
Reviewed: finger, who, date, cal

Last Updated: Monday, June 08, 1998 at 3:15 PM

Previous Day's Notes | Back to main page | Next Day's Notes

Lefthand refers to The Waite Group's UNIX Primer Plus - Sams.
Primer refers to UNIX In A Nutshell - O'Reilly & Associates.
Mastering the Shell refers to UNIX Applications Programming: Mastering the Shell - Sams.
Secrets refers to UNIX Secrets - IDG Books.

Communicating With Other Users
Command:
talk cn6

61, 325-326, 440 (Primer)
2-104 (Lefthand)

[CTRL-C] generally cancles command in progress. To end a command that is waiting on keyboard input, type [CTRL-D].

If talk isn't possible (due to configuration differences), write can be used for dialog, (though this technique is quit cumbersome and even annoying at times):

Command:
write cn6

429(Primer)
2-121 (Lefthand)
295 (Secrets)

write cn6[ENTER]
Type message here.[CTRL-D]

This message brought to you by Dr. G:
A FILE is a STREAM O' BYTES!!
Live it, love it, learn it!!

Command:
mesg [y,n]

325-326, 440(Primer)
2-72 (Lefthand)

mesg n
Makes yourself not available for talk/write (receiving or sending). Can also use: mesg no.
mesg y
Makes yourself available for talk/write (receiving or sending). Can also use: mesg yes.
Command:
wall

2-119 (Lefthand)

wall[RETURN]

Type message here.[CTRL-D]

Will send message to ALL users logged in at the time.

Command:
pine

327, 329-341, 344, 358-360 (Secrets)

First, there was mail, then elm . Then there was pine, which stands for "pine is not elm". (According to its developers, PINE stands for "Program for Internet News and E-mail")

System Status

pwd - print working directory
cd /etc[RETURN] - change directory (to /etc)
cd[RETURN] - change directory to home dir

df - shows space available in the user's file system.
du - show disk utilization in the user's file system.

stty - changes the way the terminal interacts with the UNIX system.

To set the backspace key to erase, type the following:
stty erase ^H (hit backspace key to make ^H)
Until we learn later how to modify our account, this step must be taken every session on clyde.

The easiest way to make a plan: create a file named .plan that contains your plan.
Example:
cat > .plan Type your plan here. Hit [CTRL-D] to exit/save.

You can finger anyone (connected by network, Internet, etc.) if you know their name & server.

File Structure

The "inverted tree" depicting file structure as designed by Dennis Ritchey for MULTIC that was carried over to UNIX.

Real operating systems use a right slash [/], while others use a left slash [\].
root starts every file system. There can be multiple file structures on one device as well as one file structure on multiple devices.

File structure is simply a way to address locations on devices.
cd var/adm[RETURN]
(A space must be placed between cd and parameter. UNIX is "whitespace delimited" (whitespace: one or more tabs or spaces)).



Command:
ls

75-79, 437-438 (Primer)
2-67 (Lefthand)
41-42, 115-118 (Mastering the Shell)
35-36, 38, 43, 82-88, 93,
104-111, 123-124, 133, 135-136,
241, 296, 302, 455 (Secrets)

Used to list the contents of a directory.

75-79, 437-438 (Primer)
2-67 (Lefthand)
41-42, 115-118 (Mastering the Shell)

ls -l
Long format listing (includes permissions, owners, size, modification time, etc.)
ls -a
List all files, including the normally hidden . files.
ls -i
List the inode for each file.
Permissions:
3 types of permissions: r (read), w (write), x (execute)
3 levels of permission: user, group, other
Each level of permission has 3 possible types of permissions:
drwxr-xr--
d
File/Dir
rwx
User
r-x
User's Group
r--
Other
d = directory r = able to read to this file/dir
w = able to write this file/dir
x = able to execute this file
r = able to read to this file/dir
w = permission denied
x = able to execute this file
r = able to read to this file/dir
w = permission denied
x = permission denied

Be careful to make only truly executable files. UNIX will try to run all executable files designated as so!

The rest of the colums using ls -l are:
  • # of links that file has
  • who owns the file
  • size of file
  • date and time (or year, if more than one year old)
    OR last time file was accessed
  • actual filename
Directories are always multiples of 512 (which is the classical size of directories).

Files are broken into blocks.

Command:
ls -la
UNIX doesn't have extensions. You can use 255 characters for a file name. A period is just another character, except when the 1st character of a filename, when it "hides" the file. These files are called "dotted" files.
This message brought to you by Dr. G:
Dotted files are exempt from file matching metacharacter expansion.
Live it, love it, learn it!!

Command:
touch

75-79, 437-438 (Primer)
2-67 (Lefthand)
41-42, 115-118 (Mastering the Shell)

(make is used to create large compiled things - it will compile anything younger tahn a certain date - can force make to compile a file by touching that file, causing it to fall in the "compilable" date, thus being recompiled.)

2-70, 19-2 (Lefthand)
250, 648 (Secrets)

Command:
history

2-70, 19-2 (Lefthand)
272-276, 279-280, 425, 447(Primer)

A numbered list of previous commands and provides a shorthand notation letting you repeat or modify previous commands (-per Primer, pg. 425).

Command:
mkdir

90, 200-201, 438-439 (Primer)
2-91 (Lefthand)
130, 295 (Secrets)

-r Allows file readibility.
-w Allows file write-ability (can change contents of fileand erase-ability!).
-r Allows file executability (can use file matching metacharacters into directory). [What the hell does that mean??]

Command:
rmdir

90, 200-201, 438-439 (Primer)
2-91 (Lefthand)
130, 295 (Secrets)

Remove directory. Clyde is configured to promt before removing a directory!

Command:
rmdir -r

90, 200-201, 438-439 (Primer)
2-91 (Lefthand)
130, 295 (Secrets)

Recursive removal. On Clyde, will expand directory and prompt user to enter "y" or "n" in asking if the user wishes to remove for each file/dir. Be careful! Some systems aren't configured to prompt first! Try to use rm -r as little as possible.

All file structures have two special directories:
. This means "here - this directory where I am now".
.. This means "go up one level in directory heirarchy".

../../.. Means "move up three levels in heirarchy".

Command:
cp

196, 202-206, 213, 437(Primer)
2-19 (Lefthand)
128-129 (Secrets)

Copy. (Notice this OS doesn't print "1 file copied" after making a copy of a file. It assumes you actually know what you are doing. Imagine that!)

Command:
cat Ferengi.Rules

79-81, 85-87, 436 (Primer)
2-10 (Lefthand)
42-44 (Mastering the Shell)
114-116, 122, 139 (Secrets)

Concatenates and displays file (Ferengi.Rules).

Command:
more

75-79, 437-438 (Primer)
2-7382-83, 438 (Lefthand)
114-116 (Secrets)

displays file content with --MORE-- option (allowing easier reading).
[SPACEBAR] -Scrolls down one page at a time.
[ENTER] -Scrolls down one line at a time.
q -Quit

Command:
less

759-760 (Secrets)

displays file content with --MORE-- option (allowing easier reading).
less is more -only backwards!!

Previous Day's Notes | Back to main page | Next Day's Notes


Lefthand refers to The Waite Group's UNIX Primer Plus - Sams.
Primer refers to UNIX In A Nutshell - O'Reilly & Associates.
Mastering the Shell refers to UNIX Applications Programming: Mastering the Shell - Sams.
Secrets refers to UNIX Secrets - IDG Books.

Last Updated: Monday, June 08, 1998 at 3:15 PM