Introduction to UNIX and Linux.  Written by Dennis Ritchie and Ken Thomsom at Bell Labs in 1969  Initially written in assembly language and a high-level.

Slides:



Advertisements
Similar presentations
A Guide to Unix Using Linux Fourth Edition
Advertisements

NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
Dayu Zhang 9/8/2014 Lab02. Example of Commands pwd --- show your current directory This is home of venus, not your home directory Tilde: means you are.
Exploring the UNIX File System and File Security
Working Environment - - Linux - -.
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
A Mini UNIX Tutorial. What’s UNIX?  An operating system run on many servers/workstations  Invented by AT&T Bell Labs in late 60’s  Currently there.
Linux Shell. 2 Linux Command-Line Interface ■ Linux shells: A shell is a command interpreter that allows you to type commands from the keyboard to interact.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Learning basic Unix command IT 325 operating system.
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
The file structure and related utilities CS240 Computer Science II.
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”
© Crown copyright Met Office An Introduction to Linux PRECIS Workshop, University of Reading, 23rd – 27th April 2012.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Unix Basics Chapter 4.
Cmsc 312 Operating Systems. UNIX? DOS – PC? VAX/VMS - mainframe Unix – PC, workstation, mainframe 1970 bell Lab For computer scientist? Why popular? Free.
Operating Systems Lecture 4. Agenda for Today Review of previous lecture Operating system structures Operating system design and implementation UNIX/Linux.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction Unix-like system is everywhere Linux Android for smartphones Google Chrome OS for Chromebook Web.
Operating Systems Lecture 5. Agenda for Today Review of previous lecture Browsing UNIX/Linux directory structure Useful UNIX/Linux commands Process concept.
Vim Editor and Unix Command gcc compiler Computer Networks.
1 Editing a C Program 01/16/15. 2 Objective Use Linux to edit, compile and execute a C program.
Chapter Two Exploring the UNIX File System and File Security.
Natawut NupairojAssembly Language1 Unix Survival Guide.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
Operating System What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware. An operating.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Introduction to UNIX Road Map: 1. UNIX Structure 2. Components of UNIX 3. Process Structure 4. Shell & Utility Programs 5. Using Files & Directories 6.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Chapter Two Exploring the UNIX File System and File Security.
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
Unix and Samba By: IC Labs (Raj Kidambi). What is Unix?  Unix stands for UNiplexed Information and Computing System. (It was originally spelled "Unics.")
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi.
Introduction to Unix (CA263) File Editing By Tariq Ibn Aziz.
Chapter Three The UNIX Editors.
Introduction to Programming Using C An Introduction to Operating Systems.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop III - Part A Shell Commands Professional Training.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
1 Introduction to Unix. 2 What is UNIX?  UNIX is an Operating System (OS).  An operating system is a control program that helps the user communicate.
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.
The Unix File sytem. Introduction Tree structure …
A Mini UNIX Tutorial. What’s UNIX?  An operating system run on many servers/workstations  Invented by AT&T Bell Labs in late 60’s  There are many different.
Learning basic Unix command It 325 operating system.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
CS 120 Extra: The CS1 Server Tarik Booker CS 120.
By Jonathan Rinfret UNIX/LINUX By Jonathan Rinfret
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
CS1010: Intro Workshop.
SUSE Linux Enterprise Desktop Administration
Getting started with CentOS Linux
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
UNIX The Basics Source:
Guide To UNIX Using Linux Third Edition
Exploring the UNIX File System and File Security
Operating Systems Lecture 4.
Introduction Paul Flynn
Getting started with CentOS Linux
Module 6 Working with Files and Directories
January 26th, 2004 Class Meeting 2
Presentation transcript:

Introduction to UNIX and Linux

 Written by Dennis Ritchie and Ken Thomsom at Bell Labs in 1969  Initially written in assembly language and a high-level language called B. Later converted from B to C language.  Linux written by Linus Torvalds (an undergraduate student at the Univ. of Helsinki, Finland) in  IEEE developed a standard for UNIX, called POSIX, that most versions of UNIX now support.  Most popular operating systems  Internet runs on UNIX and Linux 2

3 UNIX is basically a Simple Operating System But YOU have to be a GENIUS to understand the Simplicity Dennis Ritchie

 UNIX has a hierarchical file system structure consisting of a root directory with other directories and files hanging under it  In a command-line user interface, typed commands are used to navigate the system  Directories and files are specified by pathnames speicfying the location of the file  cmp320/assignments/assign1.c  /home/students/courses 4

5

6 faculty aliasifzia personalcourses cmp320ICS370 … … … …

/The root directory is the directory that contains all other directories. When a directory structure is displayed as a tree, the root directory is at the top. /binThis directory holds binary executable files that are essential for correct operation of the system /bootThis directory includes essential system boot files including the kernel image. 7

/devThis directory contains the devices available to on the machine /etcLinux uses this directory to store system configuration files /homeThis is where every user on a Linux system has a personal directory /libShared libraries and kernel modules are stored in this directory 8

/rootThe home directory for the superuser /sbinUtilities used for system administration (halt, ifconfig, fdisk, etc.) are stored in this directory /tmpUsed for storing temporary files. Similar to C:\Windows\Temp. 9

/usrTypically a shareable, read-only directory. Contains user applications and supporting files for those applications. /varThis directory contains variable data files such as logs (/var/log), mail (/var/mail), and spools (/var/spool) among other things. 10

11 A shell command can be internal/built-in or External The code to execute an internal command is part of the shell process, e.g., cd, pwd. The code to process an external command resides in a file in the form of a binary executable program file or a shell script, e.g.ls, mkdir. The general syntax of a shell command is command [option(s)] [argument(s)] To get the help against the use of a command, type man command

Browsing the File Hierarchy  lsDisplay contents of a directory  cdChange directory  pwdPrint working directory  mkdirCreate directory  rmdirRemove directory  cpCopy file  mvMove file  rmRemove file 12

Browsing the File Hierarchy ls (list) The ls command lists the contents of your current working directory. % ls (short for list) Ls does not show those files whose name s not begin with a dot (.) Files beginning with a dot (.) are known as hidden files and usually contain important program configuration information. To list all files in your home directory including those whose names begin with a dot, type % ls -a 13

Browsing the File Hierarchy mkdir (make directory) % mkdir unixstuff cd (change directory) To change to the directory you have just made, type % cd unixstuff mkdir ~/courses/OS/programs Create the ‘programs’ directory in your ~/courses/OS directory (.. ) means the parent of the current directory, so typing % cd.. will take you one directory up the hierarchy (back to your home directory). Typing cd / will take you to the root. Current working directory (.) Note: typing cd with no argument always returns you to your home directory. This is very useful if you are lost in the file system. 14

Browsing the File Hierarchy ~ (your home directory) Home directories can also be referred to by the tilde ~ character. It can be used to specify paths starting at your home directory. So typing % ls ~/unixstuff will list the contents of your unixstuff directory, no matter where you currently are in the file system. pwd (print working directory) Pathnames enable you to work out where you are in relation to the whole file-system. % pwd The full pathname of your current directory will be displayed. 15

Important Shell Commands cp (copy) cp file1 file2 makes a copy of file1 in the current working directory and calls it file2 mv (move) mv file1 file2 moves (or renames) file1 to file2 This has the effect of moving rather than copying the file. It can also be used to rename a file, by moving the file to the same directory, but giving it a different name. rm (remove), rmdir (remove directory) To delete (remove) a file, use the rm command. You can use the rmdir command to remove a directory (make sure it is empty first). 16

17 CommandDescription datePrints or sets the system date and time cal Displays the calendar for a specified month or a year whoami, who,User Information look up programs PasswdUsed to change the user password man [-k]Displays online documentation clearClear the terminal screen logout/exit/^D

vi / vim Editor History: Vim is a text editor released by Bram Moolenaar in 1991 for the Amiga computer. The name "Vim" is an acronym for "Vi IMproved“ because Vim was created as an extended version of the vi editor, with many additional features designed to be helpful in editing program source code. Introduction: Vim editor is very useful for editing programs and other plain ASCII files. All commands are given with normal keyboard characters. Vim is case sensitive. 18

vi / vim Editor History: Vim is a text editor released by Bram Moolenaar in 1991 for the Amiga computer. The name "Vim" is an acronym for "Vi IMproved“ because Vim was created as an extended version of the vi editor, with many additional features designed to be helpful in editing program source code. Introduction: Vim editor is very useful for editing programs and other plain ASCII files. All commands are given with normal keyboard characters. Vim is case sensitive. 19

vi / vim Editor Opening / Creating a File $vim practice The vim editor has three modes: 1. Command/Normal mode: This is the default mode, whenever you starts vim, the vim starts in this mode. This mode is used to give commands to vim, eg. save file, copy/paste/delete text, quit etc. You can switch to this mode by pressing the ESC key. 2. Insert mode: In this mode text is written/inserted in the file. One can enter insert mode by pressing "i", "I", "a", "A", "o", or "O". 3. Execute mode / Last line mode: From command mode you can enter this mode by typing ":" which puts the command line entry at the foot of the screen. 20

vi / vim Editor Editing a File Press i (move command mode to insertion mode) Exiting the Editor Press Esc. Followed by: :wq Write to file and quit :eq Exit without saving :w write(save) changes without quitting :eAbandon changes since last save 21

Writing a C program $ vi prog1.c Press i to move command mode to insertion mode Type the following program. #include int main(){ printf(“Hello World \n”); } Press Esc. Followed by :wq to save the file and exiting from the editor. 22

Compiling and Running C program Use any editor to type your program and then to compile use gcc compiler: $ gcc prog1.c This will create an executable file a.out in the pwd. Now to execute the file $./a.out If you just type $ a.out, it will say a.out not found. So either use./ before the exe name Once you compile another program in the same directory, the executable name is again a.out, which will overwrite the previous executable file. To over come this use –o flag when compiling your source file. $ gcc prog1.c –o prog1 Now this will create an executable file with the name as the second argument i.e., prog1 in this case. To execute the file give following command. $./prog1 23