Professional Documents
Culture Documents
Background on UNIX
1.2. History
UNIX Intro.
•1.1. What is UNIX?
The UNIX Operating System (OS) is a large
program (mostly coded in C) that turns the
computer into a useable machine.
UNIX Intro.
1.2. (Brief) History
UNIX Intro.
1.3. Why Use UNIX?
multi-tasking / multi-user
lots of software
networking capability
graphical (with command line)
easy to program
portable (PCs, mainframes,
super-computers)
continued
UNIX Intro.
free! (LINUX, FreeBSD, GNU)
popular
profitable
1996 Sales: US$34.5 Billion, up 12%
not tied to one company
active community
UNIX Intro.
2. Starting / Finishing
UNIX Intro.
2.1. Your Account
UNIX Intro.
2.3. Password Tips
UNIX Intro.
2.4. Logout from your Account
logout
or
^D Press CONTROL and D
together
or
exit
UNIX Intro. 1
3. Typing UNIX Commands
UNIX Intro. 1
3.1. The Shell
The UNIX user interface is called the shell.
The shell does 4 jobs repeatedly:
display
prompt
read execute
command the shell command
process
command
UNIX Intro. 1
3.2. Typing Commands
Try these:
date
cal 3 1997
who
ls -a
man cal Press spacebar to continue;
^C (CONTROL and C) to stop
clear
UNIX Intro. 1
3.3. Control Characters
Erasing characters
DELETE delete last character
^H delete last character
(press CONTROL and H together).
UNIX Intro. 1
Very useful control characters
^C terminate command
^S suspend output
^Q resume output
UNIX Intro. 1
3.4. Changing your Password
UNIX Intro. 1
4.1. Date Commands
cal Calendar
cal 1997
cal 3
cal 7 1962
cal 9 1752 Not a mistake. Why?
UNIX Intro. 1
4.2. You and the System
UNIX Intro. 1
5. UNIX Help
UNIX Intro. 1
5.3. UNIX Books
A Student’s Guide to UNIX, Harley Hahn,
McGraw-Hill, 1993.
UNIX Intro. 2
6.1. An upside-down Tree
A simplified UNIX directory/file system:
/
/ root directory
/bin commands
export
user
s3910120’s home
home dir.
s3910120
proj1
hobby.c
UNIX Intro. ... 2
6.4. Pathnames
UNIX Intro. 2
Absolute Pathnames
UNIX Intro. 2
Relative Pathnames
The sequence of directory names below the
directory where you are now to the directory
of interest.
UNIX Intro. 2
6.5. Commands and Pathnames
For example:
/usr/games/fortune
cat /etc/passwd List the password file
UNIX Intro. 2
7. Working with Directories
7.1. Moving between Directories
UNIX Intro. 2
pwd Print name of current
working directory
UNIX Intro. 3
7.2. Special Directory Names
UNIX Intro. 3
Examples
UNIX Intro. 3
7.3. Investigate the System
Use cd
cat file List file
cd /etc
cat passwd
ls Directory listing
ls List current dir.
ls /etc List /etc
ls -F -F option shows types
UNIX Intro. 3
7.4. Making / Deleting /
Renaming Directories
UNIX Intro. 3
Create a lab directory in your home directory:
cd ~
mkdir lab
UNIX Intro. 3
Delete the week1 directory:
rmdir week1
UNIX Intro. 3
8. Working with Files
UNIX Intro. 3
8.1. Creating a Text File
A quick way:
cat > file
UNIX Intro. 3
8.2. Listing Files
UNIX Intro. 3
less file Like more but more
powerful
UNIX Intro. 4
8.3. Filename Conventions
UNIX Intro. 4
8.4. Other Basic Commands
UNIX Intro. 4
8.5. Printing
UNIX Intro. 4
8.6. I/O Redirection
Most commands output to the screen
ls
Output can be redirected to a file with‘>‘:
ls > dir.txt
cal 1997 > year1997
UNIX Intro. 4
Concatenate two files:
cat f1 f2 > fs
UNIX Intro. 4
9. Communicating with People
9.3. Talking
UNIX Intro. 4
9.1. Information on Others
UNIX Intro. 4
w What are people doing?
w -sh A shorter report
UNIX Intro. 5
9.2. Fingering People
UNIX Intro. 5
write user Send a message to user
on this machine
write ad
UNIX Intro. 5
10. Electronic Mail (E-mail)
mail ad@fivedots.coe.psu.ac.th
Subject: Shoe Problem
What colour are my shoes? I
cannot see them at the moment
because of my desk.
- Jim
^D
UNIX Intro. 5
On fivedots, can write:
mail ad
UNIX Intro. 5
10.2. Some Writing Commands
UNIX Intro. 5
~e Start vi within mail.
UNIX Intro. 5
For important messages, I create the
message outside of mail, and then insert
the file with ~r
mail weerapant@central.coe.psu.ac.th
Subject: Salary Increase
~r salary.txt
^D
UNIX Intro. 5
10.3. Writing Hints
Use :) to be nice
I want more money :)
UNIX Intro. 5
10.4. Reading E-mail
UNIX Intro. 6
10.5 Some Reading Commands
RETURN display current message.
17 display message number 17. It
becomes the current message.
e View next message inside vi
? Help
UNIX Intro. 6
h List mail headers. The current message
is marked with ‘>‘.
r Reply to message.
Type ^D to end input.
UNIX Intro. 6
10.6. Reading old E-mail
UNIX Intro. 6
10.7. When has E-mail Arrived?
UNIX Intro. 6