Transcript LECT04.ppt

Operating Systems II
A Brief Look
at Common
UNIX Commands
CMSC 104, LECT04
1
UNIX Overview
•
•
•
•
Files
Commands
Directories
Resources
o books
o links from course homepage
CMSC 104, LECT04
2
UNIX Files
•
•
•
•
A file is a sequence of bytes
Created by text editor (emacs, pico)
Created by other programs
Files which contain other files are called
“directories” (sometimes called folders)
CMSC 104, LECT04
3
Filenames
•
Restrictions
o no blanks, no metacharacters, length
o case sensitive
•
Wildcards:
CMSC 104, LECT04
*
?
[ range]
4
Commands
•
•
•
•
cp, mv, ls, rm, more, cat, cd, pwd
mkdir, rmdir, passwd, man, lpr
redirection -- pipes, <, >
ctl-c, ctl-d
CMSC 104, LECT04
5
Script Files
•
For repeated command sequences
o create with editor
o mark as executable (chmod u+x <filename>)
o like a DOS “batch” file
CMSC 104, LECT04
6
Directories
•
•
•
•
Your HOME directory
All files have unambiguous names because
they have paths
However, files within the same directory must
be given unique names
Each running program has a current
directory and all filenames are implicitly
assumed to start with the name of that
directory unless they begin with a slash
CMSC 104, LECT04
7
Directories (cont’d)
/afs/umbc.edu/users/b/o/bob
junk
recipes
pie
apple
CMSC 104, LECT04
cookie
peach
choc_chip
8
Moving in the Directory Tree
•
•
•
•
•
•
. (dot) is the current working directory
. . (dot-dot) is the parent directory
UNIX command cd “change directory”
Use dot-dot to move up the tree
Use directory name to move down
Use complete directory name (path
name) to move anywhere
CMSC 104, LECT04
9
Subdirectories
•
•
Organizing your files
For example
o make a subdirectory for CS104
o make subdirectories for each project
CMSC 104, LECT04
10