Download presentation
Presentation is loading. Please wait.
Published byMarlene Whitehead Modified over 5 years ago
1
Department of Engineering Science EE 465 (CES 440) - Intro
Department of Engineering Science EE 465 (CES 440) - Intro. to Networking & Network Management An Intro to Linux
2
It All Started With UNIX
Linux is an Operating System (OS) based on Unix. Linux commands come mainly from Unix. Unix was developed in 1970 by AT&T Bell Labs. A multi-tasking & multi-user OS AT&T licensed it to outside & the code of Unix was given to universities including UC Berkeley UC Berkeley enhanced the existing version called it BSD (Berkeley Software Distribution) Unix. SVR4 (System V Release 4) combines all Berkeley enhancements & original features. Unix was essentially for workstations, big computers, & servers, e.g., Sun Microsystems Workstations Sun Microsystems, founded in 1982, created Java programming language, Solaris OS; was acquired by Oracle Corporation in AT&T Bell Labs: Ken Thompson, Dennis Ritchie, Douglas McIlroy,
3
Then Came Linux Created in 1991 by Linus Torvalds, a software developer who became the chief architect of the Linux kernel. Released in 1994 as Version 1. Was initially developed for 80 & x86 processors (8080, 8086, .. i386) architecture processors*. Later for small computers & PC-based operating system. Today it supports various processor & servers including AMD, Motorola 6800, Power PC, etc. Runs on embedded systems, firmware, switches, routers, mobile phones (Android), tablets, video game consoles. Ubuntu OS is based on Linux OS, & Linux is part of Ubuntu. Linux programming is free, easy, simple, secure, easy to install, & can be used on micro computers. AMD = Advanced Micro Devices 8080, 8086, and i386 are the Intel 8-, 16-, & 32-bit processors.
4
Linux, Layered Views http://www. tellmeaboutlinux
User request SHELL Applications LINUX KERNEL Computer Hardware Lower Level Utilities Application Programs Shell / Photo / WP / FTP / Telnet / Web Browser User Application Programmer Interface (API)- C/C++/Java/Fortran Operating System (Kernel) Computer Hardware, I/O devices, Memory, CPU, Storage Devices A utility or software utility is computer system software intended to analyze, configure, monitor, or help maintain a computer. Typically a utility is smaller than a program in size and can be included with an OS or installed separately. E.g., print utility, WP = Word processing Utility software is a small program that configures, maintains & monitors a computer (e.g., print utility).
5
Linux Kernel Kernel contains the actual Operating System (OS).
Manages processes in terms of creating, suspending, terminating, & maintenance. Schedules CPU Provides inter-process communications & communicates with devices. Has many different versions Versions offer improvements in - Support of more hardware - Higher Stability - Support of billions of users & File System - Handle of external devices & plug- ins - Supports many new devices (Wireless, USB-based, different storage devices using IDE, SCSI, ..) - Support of Sound system - Support of higher security Using SELinux (Security Enhanced Linux) IDE = Interactive Development Environment SCSI = Small Computer System Interface IDE = Interactive Development Environment SCSI = Small Computer System Interface
6
Linux Platform Operating Systems are divided according to
How many users can use the system (logon) at the same time The number of processors the system can run simultaneously A process executing a program Basic categories Single User / Single Processor (Windows 3.1, DOS) Single User / Multi Processor (Win NT Workstations, OS/2) Multi User / Single Processor (Does it exist?) Multi User / Multi Processor (Linux, Windows NT Server) High resource utilization using multiplexing Uses Time Sharing High Throughput (Number of processes finished in a unit of time) Uses multi-programming – If the current processes is accessing I/O, the CPU can be assigned to another task
7
Linux Platform A Linux shell, also called the “Command Line“
Provides the traditional user interface using terminal and keyboard for the Linux OS. Contains standard commands for Unix. Good learning tool to learn Unix! Basic Shell applications are: BASH (Bourne Again Shell) BASH is similar to Bourne Shell in Unix. Most commonly used C Shell, tcsh (TENEX C Shell), scsh (Scheme Shell) has list of various shells & their differences. Commands are the instructions for the computer to do certain things. BSD = Berkeley Software Distribution (various UNIX flavors) BASH = Bourne Again Shell (Unix/Linux)
8
Linux Text Editors A text editor is a type of program used for editing plain text files. A Linux program is made of many commands & lines of code. Text editors are provided with operating systems & software development packages, & can be used to change: configuration files, documentation files & programming language source code Text editor allows to find, replace, cut & copy, filter, & format text in a program. There are many text editors that were & are used for Linux. Wikipedia provides a good comparison Text editor comes in form of Terminal Command Line Interface (CLI) or Graphic User Interface (GUI). “vim”, an improved version of “vi” CLI. developed by Bill Joy in C programing language for Unix OS, & Linux. It uses only keyboard. “gedit”, CLI & GUI, like Windows Notepad uses mouse & keyboard, friendly, text editor in Ubuntu, Mac OS X, & Windows. Joy co-founded Sun Microsystems in 1982.
9
Gedit Text Editor Gedit is similar to Windows Notepad & the default GUI text editor in the Ubuntu OS. Can be invoked also in CLI. Designed for Simplicity Editing source code & structured text such as markup languages Multi-language spell checking Extensive support of syntax highlighting, & A large # of official & 3rd party plugins Freely available for Linux, Mac & Windows, by several developers. An Ubuntu screen shot of GEDIT page KDE = K Desktop Environment (Linux)
10
Shell Prompt Most development work is done at the shell prompt which is the Command-Line Interface, e.g., $. Remember root is “/” ls – list files ls /Documents - lists the files in Folder Documents cd – change directory cd /home - go to folder home mkdir – create a directory Mkdir homework to make a folder homework - For CLI in Windows, go to Windows, Go to Start & search for cmd, or go to All Programs, Go to accessories & click on cmd in black - For CLI in Mac, start with a Find display,.go to GO in the toolbar in the top of screen dropdown, click on Utilities, Click on Terminal.app to Open - msconfig in cmd in Windows 7 shows tabs for systems configuration Exercise: How can you go to CLI in: Windows Mac
11
Shell Prompt rmdir – remove a directory mv – move or rename a file
rmdir /Documents (Documents is different than documents) mv – move or rename a file mv homework1 assignment1 cp – copy a file cp homework1 assignment1 locate – find a file locate homework1 gedit <filename> - start editing a file gedit homework1 vim <filename> - start editing a file vi homework1
12
Linux Directory Hierarchy
Is like a family tree.
13
Linux Directory Hierarchy
14
More Basic Commands Format: Command -option argument
pwd (print working directory) cd /bin ls (List info about file(s)) ls –l (List detail info about file) ls –a (show hidden files) mkdir myoffice mkdir /root/mydocuments rmdir office wc (print word count) date man wc (get more information on wc command) whatis man whereis tcsh (lists the path) whoami hostname uname (displays system info) E.g., uname –m (machine) who (info about current user) echo (display message on screen) For options go to -a all -d directory -l use a long listing format -q hide-control-chars -s size -c count “more” is a filter for paging through text, one screen full, then each “Enter” or “down arrow” keystroke advances one more line. Make sure you can do these! cat /etc/passwd more /etc/passwd man vi |more cp /etc/passwd mypasswd mv mypasswd yourpasswd mv –i sample
15
Finding/Displaying Files, Patterns
grep searches file(s) for words/lines that match a given pattern grep word? filename (? For any word1, word2, word. ) grep command can display the IP address & machine name find searches for files that meet a desired criteria find xyz? (? For any xyz1, xyz2, xyz. ) cat concatenates file & prints on the standard output cat xyz echo displays message on screen echo hello
16
Command + Options + Arguments
Exercise Open shell terminal on Ubuntu Type the following, observe, & briefly explain what each does: wc date man wc (get more info on wc command) whatis man whereis csh (lists the path) whoami hostname uname (linux) who (information about current user) Command + Options + Arguments Linux Commands
17
File System Permissions in Linux
type When used with files When used with directories Read read a file or copy a file list the contents of a directory Write write to the file, including deleting the file create files Execute execute programs & shell scripts, which are text files containing Linux commands modify the file permissions File system Permissions is part of Linux security mechanisms.
18
Linux Permissions Permissions are set for user, group, & others
Each permission is set with a single decimal digit from 0 to 7 (binary 000 to 111) on the combination of permissions Examples for user, group, or others: read + write + execute = rwx = = 7 write + execute = -wx = = 3 read execute = r-x = = 5 read + write = rw- = = 6 Operation Decimal value Binary value for read write execute read 4 100 write 2 010 execute 1 001 No permission 000
19
Using chmod to Set Permissions
Command Permissions Ownership Owner Group Other chmod 755 myfile rwx r-x chmod 540 myfile r-- --- chmod 744 myfile
20
Linux Script Example 1 Script is a collection of commands typed in text, stored in a file, read by processor & executed for result. One can use a text editor (e.g., vi or gedit) to make the file. Note: “$” is the Shell prompt & “#” indicates comments. Both need a space. Example 1: Write a Linux script to print sum of two numbers, let's say 6 & 3. $ echo This 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 & op2 are any Integer Number (Number without decimal point) & operator can be + Addition - Subtraction / Division, to find quotient, 20 / 3 = 6 % Modular, to find remainder, 20 % 3 = 2 (Remember its integer calculation) \* Multiplication $ expr # expr Evaluate expressions Now It will print sum as 9, But $ expr 6+3 will not work because space is required between number & operator (See Shell Arithmetic). Operators in BASH
21
` (back quote) executes the command
Linux Script Example 2 & 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, 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., ./program1 If you make the program with a text editor, to exwcute the program, you need to chmod to get execution authorization, then use “./filename”. Rules for variables: ( Don't put spaces on either side of the equal sign when assigning value to variable. For e.g. In following variable declaration there will be no error $ no=10 Variables are case-sensitive, just like filename in Linux. Do not use ?,* etc, to name your variable names. Before expr keyword we used ` (back quote) sign not the (single quote i.e. ') sign. Back quote is generally found on the key under tilde (~) on PC keyboard OR to the above of TAB key. "Double Quotes" - Anything enclose in double quotes removed meaning of that characters (except \ & $). 'Single quotes' - Enclosed in single quotes remains unchanged.`Back quote `Back quote` - To execute command * is wild card ` (back quote) executes the command
22
Practice Read about chmod and LINUX permissions (check the hyperlink)
For simple examples of scripts go to Create the following directories & files (/ is the root directory): / junks primary secondary my_junk_file my_primary_file my_secondary.log Find install.log file Write a shell script & using grep command (or anything else) display the IP address & machine name (use uname)
23
References Slides “Iinux”, Dr. Farid Farahmand, Fall 2014
24
Linux Distribution (Linux Distros)
Each distribution is a package including the OS & different applications. Different distributions provide different applications & require different installations steps. The package includes: Core Linux OS (also called Kernel) X Window System & GUI interfaces Graphical desktop (e.g., GNOME or KDE) Different applications Word Processor, Spreadsheet, etc. Documentations Each distribution is under General Public License (GNU) Anyone can copy & distribute the software in open source form to others (e.g., Ubuntu “ is an Open Source). Obtaining a distribution can be through ready made packages on the net or buying the CD or just compiling a version. * 10 Most Popular Linux Distributions of 2016* Linux Mint Debian Ununtu openSUSE Manjaro Fedora (Redhat) Zorin Elementary Cento OS Arch Linux GUI = Graphical User Interface GNU = GNU's Not Unix! GNOME = GNU Network Object Model Environment KDE = K Desktop Environment (Linux) Ubuntu(/ʊˈbuːntʊ/ uu-boon-tuu; Zulu pronunciation: [ùɓúntʼú])[1][2] is a Nguni Bantu term roughly translating to "human kindness."[dubious – discuss] It is an idea from the Southern African region which means literally "human-ness," & is often translated as "humanity toward others," but is often used in a more philosophical sense to mean "the belief in a universal bond of sharing that connects all humanity” 10 Most Popular Linux Distributions of Linux Mint Debian Ununtu openSUSE Manjaro Fedora (sponsored by Redhat) Zorin Elementary Cento OS Arch Linux
25
Linux Distribution - GNU
GNU is a free Operating System consisting of a kernel, libraries, system utilities, compilers, & end-user applications. "GNU's Not Unix", which was chosen because its design is Unix- like, but differs from Unix by being free software & by not containing any exact UNIX code. Fedora Project was introduced in 1993 to take over Red Hat Linux Red Hat 9 was the last version The new Linux distribution called Fedora Core A new version every six months! 2004 Fedora Core 3 2005 Fedora Core 4 New applications include OpenOffice, FireFox, GIMP (GNU Image Manipulation Program) 2007 Fedora Core 6 Fedora comes installed with Firefox
26
Basic Security In Linux
Without SELinux (Security Enhanced Linux) Domains are divided into Users & Group IDs. The ROOT has absolute control – need to logon as “root”. With SELinux Domains are divided into Subjects & Objects. Even with Super-user privilege access to some files & devices maybe denied. SELinus = Security-Enhanced Linux
27
Linux Desktop Using the terminal commands is boring!
X Window System or X Is an open, cross-platform, client/server system. Provides windowing system for graphic work stations. Based on a client/server model. Server handles input & output devices. Generates graphical displays used by the client. Was developed at MIT & some computer companies (X.org). Uses mouse & keyboard. How the actual interface looks or feels depends on the GUI interface.
28
Ubuntu on Windows, Multi-OS Environment
Three ways to install Ubuntu/Linux OS on your PC or laptop with Windows 7 (or above) or Mac OS. See Install Linux OS on a flash memory, then select Windows or Ubuntu/Linux as you boot your computer, OR Install two different OSes in two different partitions, in which case there is no access to each other, OR Use an emulator, e.g., VMware that can install & run a copy of a second OS (Ubuntu/Linux) on the Hard Drive. PCs in Salazar 2006 Wine - Windows apps running without Windows Click here. Host OS Guest VMWare VPC/ WINE Windows Linux Ubuntu(/ʊˈbuːntʊ/ uu-boon-tuu; Zulu pronunciation: [ùɓúntʼú])[1][2] is a Nguni Bantu term roughly translating to "human kindness."[dubious – discuss] It is an idea from the Southern African region which means literally "human-ness," & is often translated as "humanity toward others," but is often used in a more philosophical sense to mean "the belief in a universal bond of sharing that connects all humanity”
29
Shell Types The Linux Shell has evolved in several types, some are used, & some are not. Used: bash — Bourne Again SHell, default shell in most Linux distributions, decent features, most common, freeware Shell zsh — most feature rich, based on Bourne-style, still rarely used due to its complexity; developed by Paul Falstad in 1990 ksh — default shell in Solaris, AIX & other few other unices; (Korn Shell by David Korn, AT&T) tcsh — TENEX C shell, used by those who know C programing language Basically most Shell types work the same with similar base commands. Not Used (Historic): sh — original Bourne shell (released 1977), developed by Steven Bourne, AT&T. Obsoleted by bash csh — original C shell (released 1978), developed by Bill Joy, UCB. Obsoleted by tcsh & ksh ash – a Bourne shell clone, light-weight (used in Android phone) by Kenneth Almquist dash - a clone of ash developed by Debian Csh=C Shell Bourne shell Basic Shell Commands ksh - Unix, Linux Command Linux command Linux commands Ubuntu (literally, "human-ness") = "humanity towards others" or "the belief in a universal bond of sharing that connects all humanity" Can install & remove different shells using “Software Center” on Ubuntu.
30
Practice (cont) Write a shell script (called myshell) to perform the following: Remove all the new directories: junks, primary, secondary. Backup HOSTS file by creating HOSTS_BACK Display the IP address of your machine Change the permission on YOUR_IP_ADDRESS such that can only be viewed by the user & make sure it is readable only. Note: you should be able to run the script multiple times with no errors! To make sure, run your program multiple times. 50 Linux Commands With Examples Linux Commands With Examples Create a new file called YOUR_IP_ADDRESS containing the IP address of your machine thus, by doing a less YOUR_IP_ADDRESS we should get your IP address
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.