1 / 20

Introduction to Linux: A Digital Circuit & Logic Design Lab

This lab introduces students to the Linux operating system and its use in digital circuit and logic design. It covers the basics of Linux, popular distributions, layered views, shell prompt commands, text editors, and the Linux directory hierarchy.

linderman
Download Presentation

Introduction to Linux: A Digital Circuit & Logic Design Lab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Department of Engineering ScienceES210L Digital Circuit & Logic Design Lab An Introduction to Linuxhttp://web.sonoma.edu/users/k/kujoory/course_materials/es_210/ References: • https://www.youtube.com/watch?v=IVquJh3DXUA • https://www.guru99.com/introduction-linux.html • ftp://ftp.wayne.edu/ldp/en/Intro-Linux/Intro-Linux.pdf

  2. An Intro to Linux • Like, Windows 7, Mac OS X, Linux is an Operating System (OS) • An OS is a software that manages all of the hardware & software resources in a computer • OS also manages the communication between software and hardware • Linux is based on Unix • Unix was developed in 1969 by AT&T Bell Laboratories • A multi-tasking and multi-user OS • AT&T licensed it to outside and the Unix code was given to universities including UC Berkeley 2/4/19

  3. An Intro to Linux (cont) • Linux was created in 1991 by Linus Torvalds, a software developer who became the Chief Architect of the Linux kernel • It is free and open-source software • Linux is used and runs on • small computers and PC-based operating system, servers, and main frames • embedded systems, firmware, routers, mobile phones (Android), notebooks, video game consoles and • devices such as Raspberry Pi (for educational projects), simulation software (Verilog HDL) 2/4/19

  4. Popular Linux Distributions • One of the Linux distribution called Fedora Core is used in • OpenOffice • FireFox (comes with Firefox) • Ubuntu Linux (we use it in EE465/CES440) Lab • Linux Mint Fedora Project was introduced in 1993 to take over Red Hat Linux. Red Hat 9 was the last version with Linux. 2/4/19

  5. Linux, Layered Views User User Application Programs Shell/Photo/WP/FTP/Telnet/ Web Browser User request Application Programmer Interface (API)- C/C++/Java/Fortran SHELL Application Operating System (Kernel) Lower Level Utilities Computer Hardware, I/O devices, Memory, CPU, Storage Devices LINUX KERNEL Computer Hardware 6/23/2015

  6. Linux is ubiquitously found on various types of hardwarehttps://en.wikipedia.org/wiki/Linux 6/23/2015

  7. Linux Platform • Linux shell also called ”Command Line Interface (CLI)” • Provides the traditional user interface for the Linux OS • Contains standard commands for Unix • Command are the instructions for the computer to do certain things • Good learning tool to learn Unix! • Basic Shells applications are • BASH, Bourne Shell • BASH is similar to Bourne Shell in Unix • C Shell, tcsh (TENEX C Shell), scsh (Scheme Shell) • http://www.freebsdsoftware.org/shells/ has list of various shells and their differences 2/4/19

  8. Linux Text Editors • A text editor is a type of program used for editing plain text files • Text editors are provided with operating systems and software development packages, and can be used to change: • configuration files, documentation files and programming languagesource code • Text editor allows to manage files, find, replace, cut and copy, filter, and format text in a program • There are many text editors that were and are used for Linux. • Wikipedia provides a good comparison • Text editors come in form of Terminal Command Line Interface (CLI) or Graphic User Interface (GUI) • “vim”, free CL and GUI, originally developed for Unix OS, and Linux usesmouse and keyboard, friendly • Can put together with many commands, lines of code, to make a program. • “gedit”, free CLI and GUI, like Windows Notepad uses mouse and keyboard, friendly • “nano”, free CLI and GUI, developed by Chris Allegratta, licensed under GNU, can use mouse and keyboard, friendly 2/4/19

  9. geditText Editor • Geditis similar to Windows Notepad and the default GUI text editor in the Ubuntu OS • Can be invoked also in CLI • Designed for • Simplicity • Editing source code and structured text such as markup languages • Multi-language spell checking • Extensive support of syntax highlighting, and • A large #of official and 3rd party plugins • Freely available for Linux, Mac and Windows, by several developers An Ubuntu screen shot of GEDIT page 6/23/2015

  10. Shell Prompt • Most work is done at the shell prompt (e.g., $) which is the Command-Line Interface • User can control the computer • Remember root is “ / ” • ls – list files • ls /es210 to list files or folders in es210folder • cd – change directory • cd /home to go to folder home • mkdir – create a directory • mkdirhomework to make a folder homework • Exercise: How can you go to CLI in: • Windows • Mac 2/4/19

  11. Shell Prompt • rmdir – remove a directory • rmdir /es210/verilog/test • mv – move or rename a file • mv homework1 assignment1 • cp – copy a file • cphomework1 assignment1 • locate – find a file • locate homework1 • gedit <filename> - start editing a file • gedithomework1 • vi <filename> - start editing a file • vi homework1 2/4/19

  12. Linux Directory Hierarchy 6/23/2015

  13. Linux Directory Hierarchy 2/4/19

  14. Some Basic Commands Format: Command -optionargument • pwd(print working directory) • cd /bin • ls (List info about file(s) • ls –l (List detail info about file) • ls –a (show hidden files) • mkdirmyoffice • mkdir /root/mydocuments • rmdir office • wc (print word count) • date • Man wc (get more information on wc command) • hostname • who (info about current user) • echo (display message on screen) • E.g., echo hello • cat (concatenates file and prints on the standard output) • E.g., cat xyz • cat /etc/passwd • more /etc/passwd • man vi |more • cp/etc/passwdmypasswd • mv mypasswdyourpasswd • mv –i sample Make sure you can do these! 6/23/2015

  15. File System Permissions in Linux 2/4/19

  16. Linux Permissions • Permissions are set for user, group, and others • Each permission is set with a single digit from 0 to 7 (binary 000 to 111) on the combination of permissions • Examples for user, group, or others: • Read + write+ Execute = rwx = 4 + 2 + 1 = 7 • - + write+ Execute = -wx = 0 + 2 + 1 = 3 • Read + - + Execute = r-x = 4 + 0 + 1 = 5 • Read + write+ - = rw- = 4 + 2 + 0 = 6 2/4/19

  17. Using chmod to Set Permissions 2/4/19

  18. / junks primary secondary my_junk_file my_primary_file my_secondary.log Practice • Read about chmod - Read about LINUX permissions (check the hyperlink) • For simple examples of scripts go to http://www.freeos.com/guides/lsst/misc.htm#commonvi • Write a shell script (called myshell) to perform the following: • Remove all the new directories: junks, primary, secondary. • Display the IP address of your machine • Create the following directories and files (/ is the root directory): 2/4/19

  19. Appendix: Linux Script Examples 1 Scriptis a collection of commands typed in text, stored in a file, read by processor and executed for result. One can use a text editor (e.g., vi) to make the file. Note: “$” is the Shell prompt and “#” indicates comments. Example 1: Write a Linux script to print sum of two numbers, let's say 6 and 3. $ echo 6 + 3This will print 6 + 3, not the sum 9. To do sum or math operations in shell use expr, syntax is as follows:Syntax: expr  op1   operator   op2 Where, op1 and op2 are any Integer Number (Number without decimal point) and operator can be +Addition- Subtraction/Division, to find quotient, 20 / 3 = 6 % Modular, tofind remainder, 20 % 3 = 2 (Remember its integer calculation)\* Multiplication $ expr 6 + 3 # exprEvaluate expressions Now It will print sum as 9 , But$ expr 6+3will not work because space is required between number and operator (See Shell Arithmetic). 2/4/19

  20. Appendix: Linux Script Example 2 and 3 Notes: • $ with a space char after is the Linux prompt here • $ with NO space after defines a Linux variable Example 2:Define two variables x=20 and y=5 and then print division of x and y (i.e. x/y)$ x=20$ y=5$ expr $x / $y Example 3: Modify above and store division of x and y to variable called z$ x=20$ y=5$ z=`expr $x / $y`$ echo $z To execute a program in Linux, type: ./filename, e.g., ./xxx ` (back quote) executes the command 2/4/19

More Related