linux basics
play

Linux Basics 2 Pre-Lab Everyone installed Linux on their computer - PowerPoint PPT Presentation

Computer Systems and Networks ECPE 170 Jeff Shafer University of the Pacific Linux Basics 2 Pre-Lab Everyone installed Linux on their computer Everyone launched the command line (terminal) and ran a few commands


  1. ì Computer Systems and Networks ECPE 170 – Jeff Shafer – University of the Pacific Linux Basics

  2. 2 Pre-Lab Everyone installed Linux on their computer ì Everyone launched the command line (“terminal”) and ran a few ì commands What problems were encountered? ì Virtualization support in processor not enabled (BIOS) ì VMWare Player (current version) only runs on Windows 64 ì 3D graphics virtualization incompatible with specific hardware ì Old virtual machine software ì Others? ì Tip: If you have problems maximizing your VM to full screen, or ì doing copy-and-paste between Linux and Windows, make sure you installed the VM tools Computer Systems and Networks Spring 2019

  3. 3 Person of the Day: Linus Torvalds Creator of Linux Kernel ì Started in 1991 ì First developer – hobby ì project (for fun!) Modern kernel is product of ì work by thousands of programmers Currently “final authority” ì on what is included in the kernel Creator of Git version control ì system Initially for Linux kernel dev ì Computer Systems and Networks Spring 2019

  4. 4 Operating System Tasks ì What does the OS need to do? Schedule processes to run ì Memory management ì Interrupt handling (manage hardware in general) ì Security (between processes) ì Network access ì Storage management (filesystem) ì Graphical user interface ì ì May be a middleware layer on top of the OS Computer Systems and Networks Spring 2019

  5. 5 Operating Systems – Processes Process management is a key operating system task ì OS must initially create processes when you run your ì program OS can allow processes to access resources ì Must schedule access to shared resources (e.g., CPU) ì OS can allow processes to communicate with each other ì OS must clean up after process finishes ì Deallocate resources (e.g. memory, network sockets, file ì descriptors, etc…) that were created during process execution Computer Systems and Networks Spring 2019

  6. 6 Operating Systems – Scheduling ì The operating system schedules process execution What processes are allowed to run at all? ì What processes are allowed to run right now? ì ì Context switches occur when the CPU is taken from one process and given to another process CPU state (registers, current PC, etc…) is preserved ì during a context switch Computer Systems and Networks Spring 2019

  7. 7 Operating Systems – Scheduling ì Preemptive Scheduling Each process is allocated a timeslice. ì When the timeslice expires, a context switch occurs ì ì A context switch can also occur when a higher-priority process needs the CPU Computer Systems and Networks Spring 2019

  8. 8 Operating Systems – Security Process A is forbidden from reading/modifying/writing ì the memory of Process B Virtual memory is a huge help here! ì Each process has a separate virtual address space that ì maps to different regions of physical memory Process A has other limits besides which memory pages ì it can access What are some other limits? ì Amount of memory consumed ì Number of open files on disk ì Which files on disk can be read/written ì Computer Systems and Networks Spring 2019

  9. 9 Operating Systems – Filesystem OS is responsible for managing data on persistent ì storage Job of the filesystem! ì What files exist? (i.e. names) ì How are they organized? (i.e. paths/folders) ì Who owns and can access them? (i.e. usernames, ì permissions) Where are individual file blocks stored on the disk? ì ì i.e. filename “database.dat” is really composed of 15823 blocks, of which block 1 is located at logical block address #... on the hard drive. Computer Systems and Networks Spring 2019

  10. 10 Operating Systems – Device Management Manage devices ì How do we send data to the NIC for transmission? ì How do we render an image for display on screen? ì How do we read a block of data from our RAID disk ì controller? Operating systems can be extended through device drivers to ì manage new hardware Hardware vendors write software to manage their devices ì OS provides a fixed interface (API) that driver must follow ì Common task for a device driver is responding to interrupts ì (from that device) Computer Systems and Networks Spring 2019

  11. 11 Operating Systems –The Kernel ì Who does all this essential work in the operating system? (besides the GUI) The kernel (i.e. the heart or core of the OS) ì ì Kernel performs: Scheduling ì Synchronization ì Memory management ì Interrupt handling ì Security and protection ì Computer Systems and Networks Spring 2019

  12. 12 Operating Systems – GUI ì Operating systems with graphical user interfaces (GUI) were first brought to market in the 1980s Microsoft Windows 1.0 (released 1986) Apple Mac OS 1.0 (released 1984) Captures from http://www.guidebookgallery.org/screenshots Computer Systems and Networks Spring 2019

  13. 13 ì Significant evolution in GUI design in subsequent decades Computer Systems and Networks Spring 2019

  14. 14 Operating Systems – GUI ì Technical perspective: The GUI is one of the least important parts of the ì operating system ì A GUI does not even have to be part of the true OS at all Windows 1.0 was just a program that ran on top of ì MS-DOS, the true operating system (of that era) ì But to a user, the GUI is one of the most important parts of the OS! Computer Systems and Networks Spring 2019

  15. 15 Command-Line Advantages of Advantages of Command Line Windows / GUI Computer Systems and Networks Spring 2019

  16. 16 ì Linux Command Line Computer Systems and Networks Spring 2019

  17. 17 In-Class Activity Launch your Linux virtual machine! 1. Open the Terminal – a text-based interface that accepts your 2. commands (Applications button -> Terminal) Open Canvas and today’s In-Class Participation assignment 3. Computer Systems and Networks Spring 2019

  18. 18 Problem 1 –Which Shell? ì A shell is a user program that defines how your terminal window behaves for input commands Command-line interpreter ì Parses user input and carries out commands ì ì Many types exist: sh , bash (Bourne again), C syntax motivated: csh , tsh , etc. ì Find out what shell is being used: $ echo $SHELL P1 Computer Systems and Networks Spring 2019

  19. 19 Directory Structure Root directory: / ì Absolute path: ì /home/hpotter/thesis/intro.txt ì Relative path: ì If I am already in /home/potter/ ì ì addresses.html http://osl.iu.edu/~pgottsch/swc2/lec/shell01.html Computer Systems and Networks Spring 2019

  20. 20 Problem 2 – Navigation Skills ì Where are we? $ pwd Print Working Directory ì What items exist here? $ ls List items $ ls [options] [location] P2 Computer Systems and Networks Spring 2019

  21. 21 Basic Operations ì Tilde (~) sign refers to your home directory. You can perform either $ ls /home/you/Documents $ ls ~/Documents Computer Systems and Networks Spring 2019

  22. 22 Navigation Skills ì Dot (.) sign refers to current directory. Try: $ ls . ì Double dot (..) refers to the parent directory of your current directory. Try: $ ls .. Computer Systems and Networks Spring 2019

  23. 23 Problem 3 – Navigation Skills ì Change directory $ cd [location] ì Hint: There’s a very easy shortcut to change directory to your home directory… P3 Computer Systems and Networks Spring 2019

  24. 24 Problem 4 – Documentation ì Documentation (“manual”) on commands $ man [command] ì Example usage Hidden files have a (.) before the filename ì ì .secret , .bashrc , … Type ls – Do you see any hidden files? ì Using the man command, find out what option you ì need to use with ls to list the hidden files P4 $ ls -a Computer Systems and Networks Spring 2019

  25. 25 Basic Operations ì Create a directory called Linux_tutorial inside your home directory Do $ mkdir [options] [dirname] these steps in your ì Change to the Linux_tutorial directory VM! ì Create a blank file called example1 $ touch example1 Computer Systems and Networks Spring 2019

  26. 26 Basic Operations ì Put something in the file via output redirection $ echo "Tiger Roar" > example1 Do these ì Copy file example1 to example2 steps in your VM! $ cp example1 example2 ì Move the example2 file to your home directory $ mv example2 ~ Computer Systems and Networks Spring 2019

  27. 27 Basic Operations ì Remove the file example2 Do this step in $ rm ~/example2 your VM! ì General form of command $ rmdir [options] [dirname] $ rm [options] [filename] Computer Systems and Networks Spring 2019

  28. 28 Piping ì Change to /etc directory and count the number of Do this step in files in that directory. You only have 60 seconds. your Tick tock!! VM! ì Tip: Combine list tool with another tool that will count the number of words (or lines) $ cd /etc $ ls -l | wc -l Pipe Word Option: Count Count number of lines Computer Systems and Networks Spring 2019

  29. 29 Problem 5 –Wildcards ì Directory listings can use wildcards to search for matching file names ì Example: In /etc directory, list all files with .conf extension $ ls *.conf ì Example: In /etc directory, list all files where second letter is d and with .conf extension * – Zero or more characters ? – Single character $ ls ?d*.conf [] – Range of characters P5 Computer Systems and Networks Spring 2019

Recommend


More recommend