Unix
Unix
What’s UNIX?
An operating system claimed to be
“standard” “from microcomputers to
supercomputers”
Invented by AT&T Bell Labs in late 60’s
Currently there are different versions of
UNIX such as SunOS, Linux, DEC
OSF/1, AIX, HP-UX 10, Solaris, IRIX,
SCO UNIX, etc.
Why we need UNIX?
c3063xxx
public_html
index.html
What is a Directory?
c3063xxx
public_html
index.html
New_file_or_directory
What is directory?
users tmp
bin etc backup
usern
user2 file1
user1 …… public_html
index.html
What’s a directory?
Files are grouped in the directory
structure. The file-system is
arranged like hierarchical tree
(inverted)structure.
The top of the tree is called “root”
which usually contains several sub-
directories. In UNIX “/”(forward
slash) is used to present the “root”.
Pathnames
Absolute Relative
Pathnames pathnames
In the previous If you are already
tree in the users
/users/usern/file1 directory, the
is an absolute relative pathname
pathname. for file1 is
usern/file1.
Specifying Paths
users tmp
bin etc backup
usern
user2 file1
user1 …… public_html
index.html
Specifying Paths
users tmp
bin etc backup
usern
user2 file1
user1 …… public_html
index.html
More UNIX commands
pwd –let you know the absolute pathname of
your current working directory (Print Working
Directory)
cd [dir] – change directory
..” is the relative
cd .. –go back to parent directory. “
pathname to the parent directory.
“.” -stands for current (working) directory.
“~” – the tilde ~ character can refer your home
directory
More UNIX commands
mkdir directories – create one or more
directories. You can specify them by
absolute or relative pathnames.
cp
cp file1 file2 – copy file1 to file2. If there’s
already a file2, the old one will be
overwritten.
cp file(s) directory – file(s) will be copied to
the directory.
More UNIX commands
Here’s an example
Suppose you type in ls -l and the result is
Group Other
permissions Permissions
Permissions
read=4;write= 2;execute=1
rwx r-x r--
4 + 2 + 1 4 + 0 + 1 4 + 0 + 0
7 5 4
Permissions