Introduction
Introduction
Introduction
Low-level: High-level:
Application Web
kernel programming System
programming programming programming
device driver
programming
Unix/Linux kernel
(process management, memory management,
file system, I/O, etc)
Hardware (CPU, memory, disks, terminals, etc)
1993
Windows NT
Windows 3X
Dennis
Ritchie PDP-11
Ken Thompson
15 Unix System Programming, Spring 2013
GNU history
• GNU: GNU is Not Unix
• Richard Stallman (author of Emacs, and many
other utilities, ls, cat, …, on linux)
– 1983: development of a free UNIX-
like operating system
– Free Software Foundation (100s of
Programmers)
• Free software:
– freedom to run the program, for any purpose.
– freedom to study how the program works and adapt it to your
needs.
– freedom to redistribute copies so you can help others.
– freedom to improve the program and release your
improvements to the public, so that everyone benefits.
man ls
zhang
zhang
Pathname of a file/directory: location of file/directory in the file
system
How do you tell other where your prog. Is located ?
Absolute pathname: path name specified relative to root, i.e.,
starting with the root (/)
e.g., /home/staff/zhang
44 Unix System Programming, Spring 2013
What’s the absolute pathname for the “passwd” file?
Home directory
Every user has a home directory created for him/her
When you log in, you are in your home directory
In home directory, a user usually has permission to
create files/directories, remove files ..
~ to refer to current user’s home directory
~username to refer to username’s home directory
53
File permissions
drwxr-xr-x 4 zhang staff 4096 2008-01-16 15:56 ShellScriptes
Each file is associated with permission info.
Differentiate three type of users: owner user, users from
same group as owner, others
Three type of access: - in the field means no permission
Read (r): use “cat” to open a file to read, use “ls” to list
files/directories under a directory
Write (w): modify the contents of the file, create/remove files from
the directory
Execute (x): execute the file, or “cd” or “search” the directory for file