What is an Operating System?
An operating system
is a program that provides an interface between:
Hardware Examples
Examples of Operating Systems
What is Unix?
Files & Directories
Unix files and directories are very much like files and directories
(folders)
in Windows and MacOS.
Basic Commands
All commands must be typed exactly right,
or they will fail
(or do something other than what you want).
Unix is case sensitive:
it matters very much whether a letter is upper case (capital)
or lower case (small).
man
command
man pwd
displays the online documentation for the command
pwd
.
man -k
word
gives a listing of all the commands related to word.
date
pwd
C:PROGS\MYPROGS>
cd direc
direc
.
cd
in MS-DOS.
ls
dir
in MS-DOS.
ls -l
mv srcfile dstfile
srcfile
to a file named dstfile
(i.e., change its name).
mv
to move a file from one directory to another:
mv srcfile dstdirec
move
in MS-DOS.
cp srcfile dstfile
srcfile
to a new file named dstfile
(or, if dstfile
already exists,
replace its contents with the contents of srcfile
).
copy
in MS-DOS.
rm thisfile
thisfile
.
del
in MS-DOS.
mkdir newdirec
newdirec
as a subdirectory of the current working directory.
rmdir olddirec
olddirec
.
cat thisfile
thisfile
to the terminal.
cat srcfile1 srcfile2 > dstfile
srcfile1
and srcfile2
(dump them out one after the other)
and put the concatenated output into dstfile
.
more thisfile
thisfile
to the terminal
in a controlled way.
time
command
Standard I/O
Full Name | Abbrev | Meaning | Comment |
Standard Input |
stdin
|
A user typing at the keyboard | |
Standard Output |
stdout
|
Outputting to the terminal screen | Buffered: Regardless of when output statements occur in the program, outputting doesn't happen until a bunch of text has been saved up. |
Standard Error |
stderr
|
Outputting to the terminal screen | Unbuffered: Outputting happens as soon as an output statement is executed. |
Redirecting I/O
Instead of input coming from a live user at the keyboard,
or output going to the terminal screen,
they can be redirected
from or to a file.
program > outputfile
program
goes into outputfile
,
instead of appearing on the terminal screen.
program < inputfile
program
come from inputfile
,
instead of being typed live by the user at the keyboard.
program < inputfile > outputfile
program
come from inputfile
,
and the output
goes into outputfile
.
program >> outputfile
program
is appended to the end of outputfile
.
Root Directory
The root directory
(which is denoted by a slash /
)
is the topmost directory;
all other directories are subdirectories of it.
It's like the "My Computer" icon in Windows,
or like the desktop in MacOS.
Directory Paths
The full name of a directory, starting from the root,
is called a path.
The full name of a file is its path, a slash and its filename.
So,
if a user
neem1883
has a home directory
/coe/fsr/facst0/neem1883
in which there's a subdirectory
CS1313
,
and in the CS1313
subdirectory
is a file named
my_number.c
,
then the path of
my_number.c
is
/coe/fsr/facst0/neem1883/CS1313
and the file's full name is
/coe/fsr/facst0/neem1883/CS1313/my_number.c
Special Directories
/
neem1883
is denoted
~neem1883
~
.
..
../..
Wildcards
Asterisks indicate parts of a filename that could be anything.
*.c
.c
*number*
number
somewhere in the name
[a-z]*
File Permissions
The person who owns a file or directory gets to decide
who can read it,
who can write to it,
and, if it's an executable, who can execute (run) it.
chmod
References
Paul DuBois,
Using csh & tcsh.
O'Reilly & Associates, 1995.
Daniel Gilly,
Unix in a Nutshell, System V edition.
O'Reilly & Associates, 1992.
Rebecca Thomas & Jean Yates,
A User Guide to the Unix System.
Osborne/McGraw-Hill, 1982.