Professional Documents
Culture Documents
Chapter 3
Chapter 3
System
A relative path name never begins with a slash (/) character. However, it
does use slashes (/) within the path name as delimiters between object
names (for example, directory name or file name).
If you are in a directory and you want to move down to access another
directory in the hierarchy, you do not have to enter an absolute path
name. Simply enter the path starting with the name of the next directory
down in the tree structure.
3.4 The UNIX File
7
System
/ root directory that contains all
/bin and /usr/bin binary files for common commands.
/sbin and /usr/sbin binaries reserved for sys. Admin.
/usr files and applications for users
/etc system configuration files
/dev all of the device files
/home stores users’ home directories
/tmp temporary files
/var variable files, logs, and print
/lib and /usr/lib queues
/usr/include library files used by programs
/usr/share/man standard header files used by C programs
this is where man pages are stored
15
CY 371: Linux OS lab Done by: Eng. Walaa Ayyad
3.12 cp: Copying
16
Files
cp [options] source(s) destination
🞑 This
command copies a file, preserving the original (source) and creating an
identical copy (destination).
If you already have a file with the new name, cp will
overwrite and destroy the duplicate.
The destination can be a directory.
🞑 In this case, the source is copied inside the destination directory
Ex: cp fork.c progs/fork.c.bak fork.c copied to fork.c.bak under
progs
cp fork.c progs fork.c retains its name under progs
When it is used to copy multiple source files, the
destination MUST be a directory and MUST already exist
CY 371: Linux OS lab Done by: Eng. Walaa Ayyad
cp
17
options
🞑 -i:
prompt user when the file already exists in
the destination
🞑 -R: copy directories recursively (to work
correctly, destination must NOT exist
before running the command)
🞑 -v: print files that are being copied