Lecture 1 - Intro

raspgiantsneckΔιακομιστές

9 Δεκ 2013 (πριν από 3 χρόνια και 6 μήνες)

124 εμφανίσεις

Lecture 1
-

Intro


Course Overview


Linux BASH


Windows CMD/
Powershell


CLI
vs

GUI


Misc Useful Stuff

Operating System


Hardware


the physical
components of a system



Operating System
-

???




Software


the programs we
run


Operating System


Hardware


the physical
components of a system



Operating System


What is
this? What does it do?



Software


the programs we
run


Operating System


It’s a program



Essentially, allows users to
run other programs



More details later!

Operating Systems


DOS (“Disk Operating System”)
*


Windows: 3.1, 95, 98, NT, ME, XP,
Vista, 7





*Not quite true

Operating Systems


DOS (“Disk Operating System”)
*


Windows: 3.1, 95, 98, NT, ME, XP,
Vista, 7


Apple: Snow Leopard




*Not quite true

Operating Systems


DOS (“Disk Operating System”)
*


Windows 3.1, 95, 98, NT, ME, XP,
Vista, 7


Apple: Snow Leopard


Linux:
Ubuntu
/
Kubuntu
, Red Hat,
CentOS
,
Mandriva
, etc, etc


*Not quite true

Operating Systems


DOS (“Disk Operating System”)
*


Windows 3.1, 95, 98, NT, ME, XP,
Vista, 7


Apple: Snow Leopard
,
iOS


Linux:
Ubuntu
/
Kubuntu
, Red Hat,
CentOS
,
Mandriva
, etc, etc


*Not quite true

CLI
vs

GUI


CLI


“Command Line Interface”


Text
-
based communication with
operating system


GUI


“Graphical User Interface”


Image
-
based communication
with operating system

CLIs

Is this a CLI?

CLIs

THIS...is a CLI!

CLIs


Predate GUIs



Text only


No mouse!



Still exist today!


Why?

CLIs


Predate GUIs



Text only


No mouse!



Still exist today!


Still very useful

GUIs

GUIs


More natural interface


2
nd

generation “point and click”
*



Raster
-
based feedback


Images make sense to us


New desktop managers
removing menu
-
style interfaces


*See “Samuel Colt”

CLI
vs

GUI


What can GUIs do that CLIs
can’t do?

CLI
vs

GUI


What can GUIs do that CLIs
can’t do?


Nothing!

CLI
vs

GUI


What can GUIs do that CLIs
can’t do?


Nothing!



All of this class can be done
without a GUI.

CLI
vs

GUI


What can GUIs do that CLIs
can’t do?


Nothing!



All of this class can be done
without a GUI.



90%+ of this class should be
done without a GUI.

CLIs


We will be using:


BASH



CMD

Powershell

Events


Modern OSs are event
-
driven


Keyboard presses



Mouse clicks



BOTH up and down
clicks/presses

Events


Every event has a time
-
stamp….why?

Events


Every event has a time
-
stamp….why?


So we can order our actions


OS might have a queue built up


Some events may need delayed
action


Etc, etc, etc

Events


Why record events?


Actions!


Every time YOU do something,
you probably want the OS to do
something.

Desktop Environments


Windows


Various “Windows
Explorer”s


Linux


KDE, Gnome, etc, etc


OS
-
X


Heck if I know…can probably
run Linux DEs.


CEG233: Introduction to
Windows and Linux
.

Desktop Environments


GUI interface to the OS


“Same $#!7, different DE”


Open folders


Drag & drop


Execute programs


Change system settings


Cut & paste


Highlighting


Etc, etc

Shells


CLI interface to the OS


This is the one we care about


Windows


CMD,
Powershell


Linux


cshell
,
rshell
, BASH, etc

Shells


Windows


CMD


“Traditional” shell


Powershell


Newer shell


PS scripting is much closer to
BASH scripting


Shells


Linux


sh
: Bourne Shell


ksh
:
Korn

Shell


rsh
: Remote Shell


csh
: C Shell


bash: Bourne
-
again Shell

Directory Structure

Dear students,


Please give the bearded man

a moment to draw pretty

pictures. They will help you!


Your Instructor

Picture topics


Root (of the file system)



Explicit in Linux



“Hidden” in Windows


‘C drive’ is NOT always the main
drive (mine used to be ‘F drive’)


Picture Topics


PWD/CWD



P
resent’ or ‘
C
urrent’
W
orking
D
irectory


“Where am I at (in the tree)?”


Picture Topics


Absolute paths


Explicitly state exactly where
the file is


Earth
-
> North America
-
> USA
-
>
Ohio
-
> Dayton
-
> WSU
-
> Joshi


Center
-
> JC182


Picture Topics


Relative paths


Collectively agree that we’re in
some spot, and go from there


.
-
> Joshi Center
-
> JC182


Picture Topics


.


“This” directory


Used to execute commands in
current directory (coming up
later)


..


Parent directory


Mounting


We rarely have just one
storage unit


CDs/DVDs


More hard drives


Thumb drives


Network storage


In order to access them, we
need to add them to the tree

Windows File System


C:
\
Program Files


C:
\
Program Files (x86)


Where user programs are
installed



C:
\
Windows


Where the OS and essential
programs are


Windows File System


C:
\
Users & …


C:
\
Documents and Settings


Home Directories


Your own “private” storage real
estate.


Each user account has one (by
default)


They might exist for users that
don’t‘


Users can get deleted and still leave
their home directory


Linux File System


/bin


Contains commands useful to
all users (cat,
cd
, echo,
ls
, …)


/boot


(Almost) everything needed to
boot the OS


/dev


List of all devices on the system

Linux File System


/etc


System configuration files


/home


Self
-
explanatory


/lib


Contains kernel modules and
libraries needed by commands
in /bin and /
sbin

Linux File System


/media


“New” mount point


/
mnt


“Old” mount point


/opt


Intended

for 3
rd

party software


/proc


Somewhat unique…ignore it


Virtual file system in its own right

Linux File System


/root


Home directory of ‘root’ account


/
sbin


Commands used for
administration


/
usr


Contains user binaries, libraries,
header files, help docs, etc


There’s more in the weeds...

Permissions


Files


Read: Can I see the contents?



Write: Can I change the
contents?



Execute: Can I run the contents
as a script or program?


Not applicable to “data” files

Permissions


Directories


Read: Can I list the
names

of
the files in the directory?


NO FURTHER INFO



Write: Can I add/remove files
to/from directory



Execute: Can I list the directory
and related info?


Permissions: UGO


User


Who “owns” the file?


Group


What collection of folks allowed
to do something with the file


Other


If you aren’t one of the above,
you’re this one.


ls


l’ Example

drwxr
-
xr
-
x 10 admirald7s Installers 4096 2011
-
10
-
12 11:33 jdk1.6.0_27


ls


l’ Example

d ……………………...
-
> File type (in this case, a directory)


Could be ‘
-
’, ‘d’, ‘c’, ‘l’, ‘b’

rwxr
-
xr
-
x ……………
-
> permissions


User, then Group, then Others

10 …………………….
-
> Number of sub
-
directories and links


admirald7s …………
-
> user


Installers ……………
-
> group


4096 ………………..
-
> Size of directory


Only things in the
immediate

directory (not recursive)

2011
-
10
-
12 11:33 …..
-
> Timestamp of last modification



jdk1.6.0_27 …………
-
> Name of the file/directory

Basic commands


bash


Bourne
-
Again Shell


bg


background


cat


show each file in sequence


chmod

change file permission


chown

change the owner of a file


cmp


compare two files


df


show mounted volumes, etc


diff


show differences between two files


du


show disk usage


echo


echo
/print arguments given


emacs

the all
-
powerful text/binary editor


env


lists the current environment variables


fg


foreground


file


guess what kind a file is

Basic Commands


grep


print lines matching a pattern


kill


kills a running program


ln


creates a link between two files; try

ln


s


ls


list contents of directory; try

ls


lisa


ltrace


show library calls made


links


WWW/News/Mail browser


ps


shows current processes


set


set
/get the value of shell variables


sftp


transfer files securely to/from a remote


machine


source

execute the commands in a file


ssh


remote login securely


strace

show sys calls made


time


times the following command

Basic Commands


top


like
ps
, but with continuous updates


umask

get/set the file mode creation mask


vi


text editor


w


who is on the system


wc


word count, etc


There are more!




Green are easy commands



Black are medium commands



Red are commands that are or can be
dangerous

is you
don’t know what you’re doing.




Learning Basic
Commands


NEVER execute unknown
commands


Research the command first



Use the man pages


e.g., “man
wc
”, “man time”, or
even “man
man


Commands fodder


Whitespace


Spaces, tabs, etc



Tokens


Not for arcade games



Environmental
Variables


Variables that help the OS


PATH


LD_LIBRARY_PATH


USERNAME


TEMP

& TMP


OS


Etc


No different than ‘
int

x = 5;’

PATH



ls’

is just another
program/script



When we type ‘
ls’
, how does
the system know where that
command is?

PATH



ls’

is just another
program/script



When we type ‘
ls’
, how does
the system know where that
command is?


‘PATH’ variable

Misc Stuff I Forgot


File extensions


Windows uses them to
determine file type



Linux doesn’t care about them
at all

RVH’s Lab
Disclaimer(s)

1.
Labs can be vague

2.
This is semi
-
intentional

3.
RVH will give piece
-
meal
help

4.
You WILL have to figure
things out on your own

General Lab
Requirements


No output, no credit!



Make it easy to figure out
what text goes with which
step

Lab 2 Pre
-
Material


Get a flash drive


At least 4GB


Empty (or with contents you
don’t care about)


If you come with a U3 drive, you
will walk away with a non
-
U3
drive.

Lab 1 Material


By ‘use’, I mean ‘use in a
meaningful way’.



“.
bashrc
” does NOT exist
on these systems until you
create it.