<<

Some

„ The original SpaceWar game (sometimes spelled Space War or Spacewar!) was created in1962 on the PDP-1 MIT. Computing Environment „ First computer to have a CRT display and a keyboard.

„ SpaceWar was not only the first game ever made, but also did several other things: „ The first controller for SpaceWar was a trackball, essentially making it the first mouse. „ In 1969, Ken Thompson wanted to play SpaceWar of a PDP-8 computer, so he wrote an called UNIX to get it running.

1 CIT593 2

Unix

„ Generic name for a of operating system(OS) „ Linux (a.k.a GNU) is similar to Unix „ First version in 1969 by Ken Thompson by AT& Bell Laboratories

„ Multiuser and interactive; ppgrogressive for its „ However it is not proprietary OS like Windows or Solaris

„ Is written mostly in ‘’, and a little bit in assembly „ Users can obtain it freely, modify it and redistribute freely „ Has been ported to many different processors „ Source

„ Two basic versions have evolved „ Derived from Unix System (owned by AT&T) „ nonnon--windowswindows labs in CIS are Linux „ Derived from Berkeley Software Distribution , or BSD

„ In 1980’s, SunOS branched out from BSD

„ Recent versions of SunOS are called SolarisTM

CIT593 3 CIT593 4

1 Shell Shell (contd..)

„ Shell provides interface between OS and user „ Several different shells exist „ Thus Unix/Linux is driven „ Grappghical also exist e.g. KDE „ is popular w/ Linux

„ Default shell upon login in Linux machines is bash shell

„ Can use csh (pronounced “sea shell”) shell „ Command interpreter with syntax similar to C language

„ Enhanced version is (t = tenextenex))

kernel ¾ allows step up/down through history list using arrow keys

¾ Completes / search with ‘tab’ key

„ To switch from bash mode to csh/tcsh: type “csh/tcsh” at prompt

CIT593 5 CIT593 6

File Permissions „ After entering: „ In UNIXUNIX--basedbased systems, files are organized into a '' Desktop mail Maildir public_html html Mail structure. „ In this tree,,, there is a 'root,' which is a directory that „ After entering: ls -ll contains every other directory on the system. drwxr-xr-x 2 username username 4096 2006-09-04 06:51 html lrwxrwxrwx 1 username username 4 2006-08-30 09:21 mail -> Mail „ Other directories, which are 'branches' of the tree. drwxr-xr-x 3 username username 4096 2006-09-04 06:50 Mail drwxrwx--- 2 username username 4096 2006-08-30 09:21 Maildir root (/) lrwxrwxrwx 1 username username 4 2006-08-30 09:21 public_html -> html

bin src home1 usr “d” = Directory /File name directory/folder size Date & Time p

palsetia

CIT593 shellcmds.ppt 7 CIT593 8

2 File Permissions(contd..) commands

drwxrdrwxr--xx------6 palsetia palsetia 4096 20062006--0909--0404 06:52 CIT593_f06 After entering ls –l–l in my , I see: drwxr-xr-x 2 palsetia palsetia 4096 2006-09-04 06:51 html lrwxrwxrwx 1 palsetia palsetia 4 2006-08-30 09:21 mail -> Mail drwxr-x--- 6 palsetia palsetia 4096 2006 -09-04 06:52 CIT593_f06 drwxr-xr-x 3 palsetia palsetia 4096 2006 -09-04 06:50 Mail drwxrdrwxr--xrxr--xx 2 palsetia palsetia 4096 20062006--0909--0404 06:51 html lrwxrwxrwx 1 palsetia palsetia 4 2006-08-30 09:21 public_html -> html lrwxrwxrwx 1 palsetia palsetia 4 20062006--0808--3030 09:21 mail ->-> Mail drwxrdrwxr--xrxr--xx 3 palsetia palsetia 4096 2006-2006-0909--0404 06:50 Mail chmod 700 user can , and execute 0 : 000 : --- world 8 2 world chmod 600 filename 18 : 0012 : --x group 2 : 010 : -w- ggproup user user can read and write 8 2 3 : 011 : -wx user r = read permission 8 2 chmod 500 filename 4 : 100 : r-- w = write permission user can read and execute 8 2 5 : 101 : r-x x = execute permission chmod 755 filename 8 2 68 : 1102 : rw- for publishing on the web 78 : 1112 : rwx

CIT593 9 CIT593 10

About files Shell Commands for Handling files

„ Text files „ can be displayed, edited or printed file filename „ contain only ASCII characters up to 12710, including a few allowed „ Attempts to report on whether the file is text or binary control chars (e.g. !, & etc.) „ divi ded into lines; en d of lin e m ark by a co nt ro l c ha racter acte „ a C source file is an example of a filename „ not useful for binary files

„ Binary files „ attempts to display the file on the

„ contain arbitrary bit patterns; do not or display! „ if file longer than 25 lines, top part may scroll off

cat filename | „ Executable file „ display a text file (piped through the pager program, more) „ a ; cannot be displayed or printed by the usual means „ this shows you 25 lines at a time press any key to get more line „ – x filename displays a file (text or binary) as hex values

CIT593 11 CIT593 12

3 Text Editors ssh

„ There are many editors „ Secure Shell or SSH is a network protocol that allows „ NonNon--graphicalgraphical (open in the terminal) data to be exchanged using a secure channel between two networked devices ¾ Pico, Nano,,, Vim, ¾ „ Basically encrypts data which earlier protocols such as telnet left data to be intercepted easily

„ Graphical „ Your accounts are on eniac ¾ Emacs (We will use this for class) Command: emacs filename & „ Eniac account is also mounted on Linux PC’s

„ From an existing shell, log into eniac using your ¾ KEdit username „ ssh eniac.seas.upenn.edu OR „ ssh [email protected]

CIT593 13 CIT593 14

Archive Utility Settings: .cshrc /.bashrc

.cshrc/.bashrc „ UNIX archive utility commands „ gets executed anytime you up type of shell „ Zip „ This where one would change there environment settings or define shortcuts or preference „ Archive: zip -r myZipFile.zip file1 file2 file3 ... fileN „ View contents: zip ––vv myZipFile.zip „ Extract: unzip myZipFile.zip To view files starting with “.” „ ls –al list all the files/directories in your home directory „ „ Archive: tar -cvf tarfile.tar file1 file2 ….file N sour ce . cshr c/. bashr c „ View Con ten ts: tar -tvf tfilttarfile.tar „ re-executes your .cshrc file (at your request) „ Extract: tar -xvf tarfile.tar v=verbose, x=extract, f=file, t=table of contents, c= create

CIT593 15 CIT593 16

4 Example of a Preferences/ Setting

„ Edit ..cshrccshrc/./.bashrcbashrcto perform your settings:

„ To c reate sh or tcuts use aaaslias comma n d „ for emacs ¾ Bash: e=‘emacs’ ¾ Csh: aliac e emacs

„ Shortcut for clear (clear command clears the screen) ¾ Bash: alias c=‘ clear’ ¾ Csh: alias c clear

CIT593 17

5