2023_Fall_Zubaer_L4_Computer_part1.pdf

Full Transcript

Linux Command Line Abdullah Zubaer, University of Manitoba. [email protected] 1 / 17 Rationale: why we need it? ● ● Computer is the main tool of genomics and bioinformatics A bioinformatician should have a good understanding of computer 2 / 17 Computer ● Computer is a machine/device ●...

Linux Command Line Abdullah Zubaer, University of Manitoba. [email protected] 1 / 17 Rationale: why we need it? ● ● Computer is the main tool of genomics and bioinformatics A bioinformatician should have a good understanding of computer 2 / 17 Computer ● Computer is a machine/device ● Can do arithmetic and logical operations ● Takes input/instructions, process tasks and give outputs 3 / 17 Computer System ● Four components – Hardware – Operating system – Application programs – Users Reference: Silberschatz A, Galvin PB, Gagne G. 2013. Operating Systems Concepts. 9 th Edition. USA: John Wiley & Sons, Inc. ISBN:9781118063330 4 / 17 Operating System (OS) ● ● ● ● The evolution of computer from special-purpose to generalpurpose gave rise to the operating systems Can be defined as an interface between the machine and the user OS have many roles and functions to run application programs, to perform common operations (such as controlling I/O devices) and to allocate resources OS have two components – kernel and system programs 5 / 17 Operating System ● ● ● ● ● Unix – developed by AT&T Bell Laboratories in 1970s - written in C language Unix was originally developed for research Developed by the experts for the experts Powerful command language Core of a number of modern operating systems Figure’s reference: Silberschatz A, Galvin PB, Gagne G. 2013. Operating Systems Concepts. 9 th Edition. USA: John Wiley & Sons, Inc. ISBN:9781118063330 6 / 17 Contemporary operating Systems OS name Kernel Command line License Windows Windows NT cmd Commercial Mac OS Darwin (Unix-based) bash Commercial GNU/Linux Linux (Unix-like) bash Open Source 7 / 17 GNU/Linux ● ● ● GNU (GNU is Not Unix) – A project that started the free software and open source movement led by Richard Stallman. They have developed a lot of system programs and necessary components for free operating systems Linux – Linux is the operating system kernel developed by Linus Torvalds Combination of GNU software and Linux kernel made the GNU/Linux OS which is popularly known as Linux in short 8 / 17 GNU/Linux ● ● Linux distributions – As the Linux source code is open to all, different companies (such as Canonical Ltd., Red Hat Inc. etc.) and programmer communities developed different operating systems using Linux code. Those variations of Linux OS are known as Linux distributions. e.g. Debian, Ubuntu, Red Hat, Fedora, Linux Mint, Arch Linux, CentOS, Slackware etc. 9 / 17 System Interface ● OS provides an interactive interface to communicate with the machine – Graphical User Interface (GUI) – Command Line Interface (CLI) 10 / 17 Command Line Interface (CLI) ● CLI is alternatively termed as Command-line User Interface or Console User Interface (CUI) ● It is also known as shell (=an outer layer, and interpreter) ● Types of shell: – sh (Bourne shell, 1979, Unix) – csh and tcsh (C shell, 1978, BSD) – ksh (Korn Shell, 1983, Unix) – zsh (improved sh, 1990, Unix) – bash (Bourne-again shell, 1989, GNU/Linux) 11 / 17 Bash ● A modern command language and shell created by GNU ● Simple syntax ● More utilities (super-set of the previous shells) ● Auto completion feature (using “tab” key) 12 / 17 Linux file system ● Start with root(/) of all directories (=folders). [It’s like a tree, where all files are like leaves, which can be referred back to the root.] 13 / 17 Linux file system ● ● ● Those are the folders in root(/) directory. To mention subdirectories (e.g. gcc folder in lib folder) it can be mentioned like /lib/gcc In “/lib/gcc”, the first slash sign means root, the latter ones means sub-folder. Note: Do not get confused with the folder name “root” here. It is actually “/root”, which means a sub-directory of root(/). The “/root” is the user-directory for the administrator (= root user). 14 / 17 User home/default directory ● ● ● ● When the Terminal is opened or a computer start in CLI, it starts at the user’s home or default directory In Linux systems, every user have their directory (by the username) under the /home/ directory. e.g., if the user-name is “user101”, then it’s home folder will be /home/user101/ In Mac OS, the user’s home folder is /Users/user101/ All the user’s files and folders (e.g., Desktop, Downloads etc.) are found in the user’s home folder 15 / 17 Path ● ● ● Absolute path – directory referred from the root (/) Relative path – directory referred from home or current working directory directory Relative paths references: . is current directory .. is previous directory ~ is home directory Figure’s reference: Sweigart A. 2015. Automate the Boring Stuff with Python. 1 st Edition. San Francisco: No Starch Press, Inc. ISBN-10: 1-59327-599-4 16 / 17 Path ● For example, if we have a file named class.txt in a user’s home folder, then - ● It’s absolute path is /home/username/class.txt ● It’s relative path is ~/class.txt 17 / 17

Use Quizgecko on...
Browser
Browser