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 – 2nd 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 timestamp….why? Events • Every event has a timestamp….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 – ‘Present’ or ‘Current’ Working Directory – “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 3rd 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 bg cat chmod chown cmp df diff du echo emacs env fg file Bourne-Again Shell background show each file in sequence change file permission change the owner of a file compare two files show mounted volumes, etc show differences between two files show disk usage echo/print arguments given the all-powerful text/binary editor lists the current environment variables foreground guess what kind a file is Basic Commands • • • • • • • • • grep kill ln ls ltrace links ps set sftp • • • • source ssh strace time print lines matching a pattern kills a running program creates a link between two files; try ln –s list contents of directory; try ls –lisa show library calls made WWW/News/Mail browser shows current processes set/get the value of shell variables transfer files securely to/from a remote machine execute the commands in a file remote login securely show sys calls made 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.