Computer System Management - Unix/Linux Amarjeet Singh August 30, 2011 Partly adopted from Computer System Management Slides by Navpreet Singh
Logistics Learn-it-yourself topic assignment Many students still have complaints mostly due to confusion caused by others Please come over, together with your conflicting group, and get it resolved personally Any such activity found in the future will result in zero in that assignment without any warning Lab Session 2: Feedback so far? Creative Session: Group-1: Operating System Group-4: Components of Motherboard Group-5: Memory Hierarchy
Survey Feedback Unix commands and shell Knowledge of generic utilities Home network configuration Knowledge of useful utilities Configure a computer from Understanding of internet Computer component Network configuration Interface external devices Don t know anything Vaguely know know fair amount, like to know more know good amount, can handle questions without stydying Expert and can even teach it to peers Improving System Performance OS installation 0.00% 50.00% 100.00% 3
Some revision What is a file system? Why do we need a separate file system for flash? Beneficial to erase unused blocks when the device is idle Random access does not incur latency in flash memory Spreads out writes to avoid wearing out What are the advantages of Journaling filesystem? Less likely to be corrupted in case of system crash Use case? Example filesystems?
Setting Standards for Creative Session CERN - European Organization for Nuclear Research Matter vs antimatter Black holes Big bang theory Let the creative juices flow for your session on September-10 Take help from your mentors in preparation and ideas on topic Lets make it a fun class
Unix: History Unix command - date +%s Unix time (or POSIX time) defined as number of seconds elapsed since Jan 1, 1970 Around 1970 unix was born! Completely written in assembly language - hardware portability was a big constraint First version created by AT&T Bell labs 1972 - rewritten in C language High level language resulted in easier portability 1978 - About 600 machines across the world were running Unix in some form 1980 - BSD 4.1 (Berkeley Software Distribution) Also called Berkeley Unix Shared the initial codebase and design with AT&T Unix 1982 - AT&T released Unix System V, including vi editor
Unix: History 1983: AT&T commercialized Unix - System V Berkeley researchers continued their development of BSD - released version 4.2 Other companies started releasing versions of Unix based on BSD and System V - SunOS (released by Sun Microsystems - co-founded by Bill Joy, leading developer of BSD, in 1982) 1988: AT&T and Sun Microsystems jointly develop System V Release 4 (SVR4) Merged features of BSD, System V and SunOS Later developed into UnixWare and Solaris 2 1993: Most commercial variants of Unix based on System V with BSD features added on top 1991 Linux was born
History of Linux Video from youtube http://www.youtube.com/watch?v=5ocq6_3-new
Linux: The most important email! From: torvalds@klaava.helsinki.fi (Linus Benedict Torvalds) Newsgroups: comp.os.minix Subject: What would you like to see most in minix? Summary: small poll for my new operating system Message-ID: <1991Aug25.205708.9541@klaava.Helsinki.FI> Date: 25 Aug 91 20:57:08 GMT Organization: University of Helsinki Hello everybody out there using minix - I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready. I'd like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the file-system (due to practical reasons) among other things). I've currently ported bash(1.08) and gcc(1.40), and things seem to work. This implies that I'll get something practical within a few months, and I'd like to know what features most people would want. Any suggestions are welcome, but I won't promise I'll implement them :-) Linus (torvalds@kruuna.helsinki.fi) PS. Yes - it's free of any minix code, and it has a multi-threaded fs. It is NOT protable (uses 386 task switching etc), and it probably never will support anything other than AT-harddisks, as that's all I have :-(. Source: http://www.linux.org/people/linus_post.html
Linux: More, if you are interested Autobiography of Linus Torvalds More like a series of emails An exercise in textual communication for someone more used to code language than conversation - Amazon.com Review
A Bit About Licensing Copyleft Every person who receives a copy of work has permission to reproduce, adapt or distribute copies or adaptation but they also are bound by same licensing agreement GNU General Public License (GPL) was the first copyleft license to see extensive use Several other types of licenses, comprehensive comparison at http://en.wikipedia.org/wiki/comparison_of_free_software_licenses Source code of Linux is available to everyone under GNU GPL Kernel version 1.0 was released in 1994-176,250 lines of code Most recent stable version is 3.0.1 (August 5, 2011)
Unix directory structure Looks like an inverted tree structure Start with root directory at the top / and work down through sub-directories underneath it Each node is either a file or directory of files Path of file/directory either in full or relative Full path name starts with root / until you reach the file e.g. /home/condron/source/xntp Relative usually specific to current directory
Unix directory structure Relative path. - current directory.. - parent directory E.g. if I am at /home/frank, how should I go to traceroute using relative path?
Linux Filesystem Hierarchy Standard Current version is 2.3, released in 2004 Slight deviations exist across all Linux distributions but in general broadly applied All files and directories appear under the root director / even if they are stored on different physical device
Linux Filesystem Hierarchy Standard /bin/ : Essential command binaries available in single user mode, e.g. cat, cp, ls, date, dd /boot/ : Boot loader files, grub, system map file /dev/ : Essential devices such as USB ports, serial ports /home/ : User s home directories containing saved files, personal settings (folders like Desktop, Documents, Pictures, Music)
Linux Filesystem Hierarchy Standard /etc/ : Host specific system wide configuration files X11 : config files for X11 Window System Firefox : config files for firefox /lib/ : libraries essential for binaries in /bin and /sbin /media/ : Mount point for removable devices such as CD-ROM /mnt/ : Temporarily mounted filesystems
Linux Filesystem Hierarchy Standard /opt/ : Optional application software packages (any new package that does not come with OS) Config files go in /etc/opt /proc/ : Virtual filesystem documenting kernel and process status as text files e.g. cpuinfo, devices, meminfo, partitions /sbin/ : Essential system binaries e.g. iwconfig, ifconfig /tmp/ : Temporary files, often not preserved across system reboots
Linux Filesystem Hierarchy Standard /usr/ : Secondary hierarchy for user data; contains majority of multi-user utilities and applications /usr/bin/ : Non essential command binaries (not needed in single-user mode) /usr/lib/ : Libraries for binaries in /usr/bin and usr/sbin /usr/sbin/ : Non-essential system binaries e.g. sensors-detect, useradd, arp /usr/src/ : Source code /usr/local/ : Tertiary hierarchy for local data specific to this host
Linux Filesystem Hierarchy Standard /var/ : Variable files - whose content is expected to continually change during normal operations of the system e.g. logs, spool files, temporary email files /var/lib/ : Persistent data modified by programs as they run e.g. databases, openoffice /var/log/ : Various log files e.g. dmesg /var/run/ : Information about running system since last reboot e.g. logged users, running processes /var/www/ : Website file hierarchies; default location for websites served by Apache
Unix shell The original shell was the Bourne shell, sh Every Unix platform will either have the Bourne shell, or a Bourne compatible shell available The default prompt for the Bourne shell is $ (or #, for the root user) Another popular shell is C Shell. The default prompt for the C shell is %
Shell programming Whatever you type on the command line can be written in a file and executed together - shell script For terminal to distinguish a shell script from any other file, the first line of the script should start with #! /bin/sh /bin/sh - tells which program to use to execute the script The first line is followed by commands #! /bin/bash cd /tmp mkdir t To make the terminal understand that the script is executable, set the appropriate bits in file permissions using chmod, e.g.: $ chmod +x shell_script
Learning What did you learn today? Each group to write on a sheet of paper and submit me with their names This is also your attendance for the day