Michael Wrzaczek Dept of Biosciences, Plant Biology Viikki Plant Science Centre (Vips) University of Helsinki, Finland
Total Page:16
File Type:pdf, Size:1020Kb
Michael Wrzaczek Dept of Biosciences, Plant Biology Viikki Plant Science Centre (ViPS) University of Helsinki, Finland November 11th, 2015 Why learn and use Unix http://stein.cshl.org/genome_informatics/unix1/why_unix.html Bioinformatics tools built on Unix Why learn and use Unix simple I/O system good programming tools building block approach to programming many text manipulation programmes easy networking (integrated networking) are lazy Why learn and use Unix Unix is very powerful Many tools run on Unix Majority of web services run on Unix What is Unix... UNIX operating system 70ies, Bell Laboratories 1969: UNIX in Assembler code (Ken Thompson) 1972-1974: re-implementation in C (Ken Thompson and Dennis Ritchie) Until 1979: UNIX source code free, and freely distributed Early 80 The Unix-Philosophy Write computer programmes so, that they do one thing, but they do that one thing well. The Unix-Philosophy Write programmes in a way, so that they can work together. The Unix-Philosophy Write programmes in a way, that they use text files, since that is a univeral interface. (Douglas McIlroy) The Unix-Philosophy Due to the history of UNIX, ease of use/userfriendlyness was not one of the prime goals. UNIX was an operating system to develop a system for geeks. The Unix-Philosophy According to Eric S. Raymond Unix-Philosophies can be summed up as The Unix-Philosophy Mike Gancarz, 9 paramount precepts: 1. Small is beautiful 2. Make each programme do one thing well 3. Build a prototype as soon as possible 4. Choose portability over efficiency 5. Store data in flat text files 6. Use software leverage to your advantage 7. Use shell scripts to increase leverage and portability 8. Avoid captive user interfaces 9. Make every programme a filter The Unix-Philosophy 10 lesser tenets (not universally agreed upon): 1. Allow the user to tailor the environment 2. Make operating system kernels small and lightweight 3. User lowercase and keep it short 4. Save trees 5. Silence is golden 6. Think parallel 7. The sum of the parts is greater than the whole 8. Look for the 90 percent solution 9. Worse is better (simplicity over perfection!) 10.Think hierarchically Unix makes it easy and efficient to customize create from scratch connect (workflow automation) Since many flavours of Unix are open-source, it is very easy to take existing code/programmes and modify them according to the specific requirements. (POSIX-compliant) AIX, IRIX, Solaris, Mac Os X (not certified as POSIX-compliant) GNU, Minix, BSD, Linux Posix standard: standardized application level interface for Unix. While AIX, IRIX, Solaris, Mac Os X are posix compliant, Linux and the BSDs are not Posix-certified but generally comply with the standards. Plain and simple, the Posix standard makes it possible, to write a new operating system which is fully compatible with other Unix systems, by sticking to these specifications. So, what is Linux? kernel of the GNU/Linux operating system operating system -> distribution -compatible free operating system. -user ready, Linux-kernel is used. The kernel is the central component of most computer operating Systems. Amongst other things it regulates the communication Between soft- and hardware and also between processes. kernel of the GNU/Linux operating system software required (to interact with the computer.) Linux distributions kernel + additional software + package manager for simple software installation and removal Note that also many things run Linux where you might not be aware of, eg. Routers, PDAs, etc freely available on the net Pay for company-support Information: discussion forums newsgroups The community is generally very helpful in solving Some GNU/Linux Distributions: Ubuntu (http://www.ubuntulinux.org) Debian Gnu/Linux (http://www.debian.org) openSUSE (Novell SUSE Linux Desktop; http://www.opensuse.org) Fedora (Red Hat; http://www.fedoraproject.org) Slackware Linux (http://www.slackware.org) Gentoo GNU/Linux (http://www.gentoo.org) Mandriva Linux (formerly Mandrake; http://www.mandriva.com) Which version of Linux is right for me? Depends on use and taste. Arch, Debian, Gentoo, Slackware, etc Suse, Redhat - Communication with Unix You talk directly to the operating system You to a programme, that communicates with Unix or communicates with another programme that communicates with Unix What kinds of programmes can you talk to? a shell an interactive command a Graphical User Interface (GUI) tty . That comes from the teletypes that were originally used to interact with the operating system Note: Technically any software that allows the user to interact with a computer is a shell. A GUI is a shell just like a terminal. However, usually the command-line interpreter (or terminal) is referred to as shell. Communication with Unix User user commands interactive and data commands hand down input as well as output output prompt output Shell transfer cat ls vi adb built-in commands of control requests for services Kernel and Device Drivers The Unix Shell PROGRAMMING LANGUAGE! Shell scripts are not compiled (=translated into binaries, the machine understandable format) but interpreted at runtime INTERPRETED LANGUAGE Shell scripts are very powerful, but more sophisticated alternatives exist. We will see Perl and Python later in the course. The Unix shell Different types Thompson Shell (osh; the original UNIX shell), Bourne Shell (sh), C-Shell (csh) Korn Shell (ksh), Bourne Again Shell (bash), Z Shell (zsh) -in commands (eg. cd) Which shell are you running? michael@infocalypse ~ $ grep wrzaczek /etc/passwd michael:x:1007:100::/home/michael:/bin/bash michael@infocalypse ~ $ echo $SHELL /bin/bash michael@infocalypse ~ $ The Unix shell few helpful things CASE SENSITIVE! trying to open a file or using a command will not work if you mix upper- and lowercase letters. Commonly, all commands use lowercase letters while options and - or lower-case. The Unix shell few helpful things Tab completion typing the first few letters and then hitting the TAB key will complete the command/filename. If there are still several possibilities, when you press TAB a second time you will be presented with a list of appropriate commands/filenames. Type and press TAB TAB. This will give you all commands starting with CO. Pathnames locate files and directories in a Unix filesystem File extensions usually do not identify a file (there are a few exceptions!!!) Access to files is based on the concept of users and groups Every user has a unique account with a unique ID number (UID) Users are members of one or more groups Users and groups can efficiently be used to restrict or allow access to files depending on requirements wrzaczek@kasbi31 ~ $ cd / wrzaczek@kasbi31 / $ ls -l total 72 drwxr-xr-x 26 root root 4096 2007-11-09 13:20 home drwxr-xr-x 2 root root 4096 2008-01-29 10:10 bin drwxr-xr-x 2 root root 29 2005-06-09 14:43 boot drwxr-xr-x 14 root root 13180 2008-01-31 16:09 dev drwxr-xr-x 84 root root 8192 2008-02-03 19:08 etc drwxr-xr-x 26 root root 4096 2007-11-09 13:20 home drwxr-xr-x 9 root root 8192 2008-01-29 10:10 lib drwxr-xr-x 2 root root 33 2008-01-29 12:24 media drwxr-xr-x 9 root root 106 2006-03-13 19:21 mnt drwxr-xr-x 13 root root 4096 2007-08-10 17:44 opt dr-xr-xr-x 93 root root 0 2008-01-31 16:08 proc drwx------ 17 root root 4096 2008-02-03 19:07 root drwxr-xr-x 2 root root 8192 2008-01-29 12:24 sbin drwxr-xr-x 11 root root 0 2008-01-31 16:08 sys drwxrwxrwt 6 root root 4096 2008-02-03 20:20 tmp drwxr-xr-x 14 root root 4096 2007-11-02 01:01 usr drwxr-xr-x 14 root root 4096 2006-09-15 20:40 var wrzaczek@kasbi31 / $ Inside a Unix system... Enter the command df h Unix system harddisks Partition harddisks mount Directory will point to the assigned harddisk is the attaching of an additional filesystem to the currently accessible filesystem of a computer. You can tell your computer to add a new filesystem (a partition on a harddisk, a CD, a DVD, a USB stick etc) to the system and point to it from a folder on the already existing filesystem. The command cd (change directory) moves you around the tree. cd without any options takes you to your home directory. cd / takes you to the root level (=the most basal part of The filesystem) NOTE: root can mean different things root: the superuser account of the system root: the home directory of the root user root: the basal level on the filesystem indicated When you log in to your linux machine you find yourself in your HOME directory. michael@infocalypse ~ $ cd / michael@infocalypse / $ ls -l total 72 Type drwxr-xr-x 2 root root 4096 2008-01-29 10:10 bin drwxr-xr-x 2 root root 29 2005-06-09 14:43 boot drwxr-xr-x 14 root root 13180 2008-01-31 16:09 dev cd / drwxr-xr-x 84 root root 8192 2008-02-03 19:08 etc drwxr-xr-x 26 root root 4096 2007-11-09 13:20 home to go to drwxr-xr-x 9 root root 8192 2008-01-29 10:10 lib the lowest level of the drwxr-xr-x 2 root root 33 2008-01-29 12:24 media drwxr-xr-x 9 root root 106 2006-03-13 19:21 mnt filesystem. drwxr-xr-x 13 root root 4096 2007-08-10 17:44 opt dr-xr-xr-x 93 root root 0 2008-01-31 16:08 proc drwx------ 17 root root 4096 2008-02-03 19:07 root Unix: drwxr-xr-x 2 root root 8192 2008-01-29 12:24 sbin drwxr-xr-x 11 root root 0 2008-01-31 16:08 sys single-root hierarchical drwxrwxrwt 6 root root 4096 2008-02-03 20:20 tmp file system.