Intro UNIX
Intro UNIX
INTRODUCTION
r . S i nha l uti o ns
Amit
K r ant So
E x u be
Nex-G .
td
Pvt. L
set -o vi
echo ".profile was read"
more
http://www.ee.surrey.ac.uk/Teaching/Unix/
Google will give you many links
Directories may
bin users tmp
contain plain files
or other directories
dkl kangli
Leads to a tree
structure for the
filesystem foo.txt csci1730
Root directory: /
bar.c abcd
foo.txt csci1730
Relative path
start at working directory bar.c abcd
.. refers to level above; . refers to working dir.
If /users/dkl/csci1730 is working dir, all these
refer to the same file
../foo.txt ~/foo.txt ~dkl/foo.txt
January 21, 2012
Types of files
19
Directory (d)
A directory is actually a file
Points to another set of files
cat <filename(s)>
“concatenate”
more <filename(s)>
Output the contents of a file one screen at a time
Allows forward and backward scroll and search
System calls
Interface to the kernel
Program
Code
Library fread
retval = close(fd)
Close an open file descriptor
Returns 0 on success, -1 on error