The Linux Operating System

Slides:



Advertisements
Similar presentations
ITR3 lecture 7: more introduction to UNIX Thomas Krichel
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
1 Introduction to UNIX Ke Liu
Linux+ Guide to Linux Certification, Second Edition
CMPE 151: Network Administration Spring Class Description Focus: system and network administration. Sequence of exercises. E.g., installing/configuring.
Shell Script Examples.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Linux Commands LINUX COMMANDS.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Systems Programming Concepts
GETTING STARTED USING LINUX UBUNTU FOR A MULTI-USER SYSTEM Team 4 Lab Coordinator Manager Presentation Prep Webmaster Document Prep Faculty Facilitator.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
UNIX command line. In this module you will learn: What is the computer shell What is the command line interface (or Terminal) What is the filesystem tree.
8 Shell Programming Mauro Jaskelioff. Introduction Environment variables –How to use and assign them –Your PATH variable Introduction to shell programming.
Essential Unix at ACEnet Joey Bernard, Computational Research Consultant.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
An Introduction to Unix Shell Scripting
2INC0 Operating Systems Introduction to Linux
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
CS 6560 Operating System Design Lecture 3:Tour of GNU/Linux.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
Linux+ Guide to Linux Certification, Third Edition
UNIX Shell Script (1) Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology
1 Operating Systems Lecture 2 UNIX and Shell Scripts.
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
UNIX shell environments CS 2204 Class meeting 6 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
UNIX shell environments CS 2204 Class meeting 4 Created by Doug Bowman, 2001 Modified by Mir Farooq Ali, 2002.
Introduction to Programming Using C An Introduction to Operating Systems.
Linux+ Guide to Linux Certification, Second Edition
The Kernel At a high level, the kernel in an operating system serves as the bridge between applications and the actual data processing of the hardware.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
Learning Unix/Linux Based on slides from: Eric Bishop.
Linux Administration Working with the BASH Shell.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Using Linux Kaya Oğuz Room: 310.
Introduction to the Linux Command Line Interface Research Computing Systems Bob Torgerson July 19, 2016.
Bash Scripting CIRC Summer School 2016 Baowei Liu CIRC Summer School 2016 Baowei Liu.
By Jonathan Rinfret UNIX/LINUX By Jonathan Rinfret
File permissions Operating systems I800
CIRC Winter Boot Camp 2017 Baowei Liu
Prepared by: Eng. Maryam Adel Abdel-Hady
Bash Introduction (adapted from chapters 1 and 2 of bash Cookbook by Albing, Vossing, & Newham) CPTE 440 John Beckett.
Andy Wang Object Oriented Programming in C++ COP 3330
Some Linux Commands.
Shell Script Assignment 1.
Introduction to UNIX.
Sarah Diesburg Operating Systems CS 3430
LING 408/508: Computational Techniques for Linguists
CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection
CSE 390a Lecture 1 introduction to Linux/Unix environment
Chapter 7 File and file System structure
Exploring Shell Commands, Streams, and Redirection
Introduction Paul Flynn
CSE 390a Lecture 1 introduction to Linux/Unix environment
introduction to Linux/Unix environment
Andy Wang Object Oriented Programming in C++ COP 3330
CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection
introduction to Linux/Unix environment
Linux Shell Script Programming
CSE 303 Concepts and Tools for Software Development
introduction to Linux/Unix environment
introduction to Linux/Unix environment
introduction to Linux/Unix environment
introduction to Linux/Unix environment
Linux Commands LINUX COMMANDS.
Presentation transcript:

The Linux Operating System Lecture 2 Uli Raich

Starting up the Linux System

Linux Distributions Linux comes in many flavors (distributions) which may be different of how they are configured, their desktop, their software repository, their target user community beginners, gurus, programmers, desktop, server … Here are some distributions: Ubuntu (which we use), Mint, Debian, RedHat, Fedora, Kali...

Linux versus Windows Linux can be downloaded and installed for free The sources of the OS can be accessed freely Linux has a window system based on X11 and has most facilities Windows offers For certain commercial hardware there are no Linux drivers (caution!) Writing your own Linux driver is possible but often the manufacturers do not open the hardware specs (register meaning, initialization procedure…) which makes this a very tedious job. Programmers mostly use the command line interface something that is hardly ever used in Windows. The file system layout on disk is different (ext4 vs ntfs) but there exist drivers on both systems reading and writing the others files systems

Linux command line When you start up a terminal window, you start a command shell with it. We will be using bash When you type a command, bash will check if it is a command implemented in bash, in which case it is executed immediately, otherwise a new process is created, the command loaded and executed After termination of the command the process is removed again. Either bash waits for termination of the process or it is run in parallel (“&” after the command) Where are the commands and how many are there?

Linux commands Here are a few commands: Have a look in /bin /usr/bin. The environment variable PATH tells the system where to look for commands. The number of commands is unlimited since you can write your own commands and include them into the system. Command Action ls List directory content cat, less, more Print content of a text file mkdir Create a directory cd Change working directory pwd Print current working directory echo Print variable vi, nano, emacs, gedit ... Edit a text file rm, rmdir Remove a file / directory grep Search for a string in files

Manual pages This is a small sample of /usr/sbin: Each of these commands has plenty of parameters! How do I remember all this? Well… you don’t, but there is a man (manual) command where you can find a description of the parameters.

File permissions and user groups Typing ls -l (l means long listing format) in one of my directories, this is what I get: The left rwx means that the file owner can read write and execute the file. The middle 3 characters have the same meaning for group members and the last 3 characters for any user.

Changing file permissions The chmod command allows the file owner to modify file permissions. This can be done for u: user who owns the file g: users in the same group a: any user You may add (+) or remove (-) permissions Example: chmod a+w Makefile (what does it do?) You can also give octal values representing the permission bits: chmod 655 Makefile (what will be the file permissions after the command?)

The super user As we have seen the owner of a file / directory can do with it whatever he wants including to refuse access to anybody but himself. You can modify or destroy your file but you cannot modify system files or files of other another user if he does not explicitly allow it. There is one user who has the power to do anything: root: the super user. Sometimes you may need this power to adapt the system to your needs: sudo command executes a command with super user privileges. Be careful when doing this, you have the power to destroy your system!

Adding software packages The apt command is a package management to allowing you to add new software packages remove them upgrade them find out which packages are installed Software installation and removal can only be done by the super user

Adding software packages The apt command is a package management to allowing you to add new software packages remove them upgrade them find out which packages are installed Software installation and removal can only be done by the super user

Find commands To find any command click this button and type a command name in the search box Here you may try to see which software is available on Ubuntu clicking the Ubuntu Software button

stdin, stdout, stderr Every program has 3 input/ouput channels associate with it: stdin: the standard input channel stdout: the standard output channel stderr: the error channels stdin in usually associate with the keyboard stdout and stderr with the terminal window from which the application was started. Any of these may be re-directed with “<” for stdin, “>” for stdout and “2>” for stderr

pipes Unix (and Linux) uses many small programs that can however be connected to produce more complex commands. stdout of one command is connected to stdin to another one through a pipe. Let’s say, I want to know how many instances of bash are running on the system (with each terminal you get an associated shell) In this case I can give the command ps ax, which will however print all processes currently running. If I pipe this output into grep bash (showing every line containing the string “bash”) then I have constructed the command I was looking for.

The home directory Every user has his own home directory into which his personal files are stored. This also concerns configuration files Most configuration files are “hidden files” whose file names start with “.” To see these type ls -a ~ Meaning: show all files in my own home directory. cd (without parameters) takes you to your home directory The current working directory is “.” “..” is the directory one level lower from my current working directory

Change Settings

Settings(2)

bash scripts You can collect commands in a script file (e.g. myscript.sh) The command sh myscript.sh sequentially executes all commands in this file. Actually bash is a command language with assignments, conditional and loop statements just like any conventional programming language. When making your script file executable by changing the permission bits you can run it (with the sh prefix) like any other program (how?). Have a look at your .profile file a shell script which is executed when you create a new shell (e.g. when opening a new command window).

Other script files bash is a command interpreter but it is not the only one There are other command shells like csh, tcsh … And there are script base programming languages like python, perl … Often the first comment in the script file tells the system which interpreter to use: #!/bin/sh #!/bin/python