Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.

Slides:



Advertisements
Similar presentations
RH030 Linux Computing Essentials
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Jump to first page Unix Commands Monica Stoica Jump to first page Introduction to Unix n Unix was born in 1969 at Bell Laboratories, a research subdivision.
Chapter One The Essence of UNIX.
Lesson 10-Controlling User Processes. Overview Managing and processing processes. Managing jobs. Exiting/quitting when jobs have been stopped.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Working with Files How to create, view, copy, rename and print files.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
More Shell Basics CS465 - Unix. Unix shells User’s default shell - specified in /etc/passwd file To show which shell you are currently using: $ echo $SHELL.
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
Guide To UNIX Using Linux Third Edition
Lecture 01CS311 – Operating Systems 1 1 CS311 – Lecture 01 Outline Course introduction Setting up your system Logging onto the servers at OSU with ssh.
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
UNIX Utilities Learning Objectives: 1. To understand the some basic utilities of UNIX File 2. To compare UNIX shell and popular shell 3. To learn Input/Output.
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
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
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”
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.
Introduction to Unix/Linux Chapter One The Essence of UNIX.
UNIX Unbounded 5th Edition Amir Afzal Chapter 3 Getting Started
Unix Basics Chapter 4.
CENT 305 Information Systems Security Linux Introduction.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
©NIIT Collaborate Lesson 1C / Slide 1 of 23 Collaborate Knowledge Byte In this section, you will learn to: Use the cal command Determine the file types.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
UNIX/LINUX Shells Shell is an UNIX/LINUX command interpreter. Shell command can be internal or external. The code to execute an internal command is part.
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
Introduction to Unix (CA263) Getting Started By Tariq Ibn Aziz.
Chapter 0 A “Quick-Start” into the UNIX Operating System.
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.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
ITR3 lecture 6: intoduction to UNIX Thomas Krichel
Introduction to UNIX Geraint Vaughan. What is UNIX? Command-line operating system (not point- and click) Designed for ‘experts’ Lots of different variants.
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
Introduction to Programming Using C An Introduction to Operating Systems.
Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Linux Commands C151 Multi-User Operating Systems.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
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.
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Learning basic Unix command It 325 operating system.
Lesson 6-Using Utilities to Accomplish Complex Tasks.
Lesson 8-Specifying Instructions to the Shell. Overview An overview of shell. Execution of commands in a shell. Shell command-line expansion. Customizing.
File Management commands cat Cat command cat cal.txt cat command displays the contents of a file here cal.txt on screen (or standard out).
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.
Learning Unix/Linux Based on slides from: Eric Bishop.
Overview of Linux Fall 2016 Dr. Donghyun Kim
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.
Lesson 5-Exploring Utilities
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Andy Wang Object Oriented Programming in C++ COP 3330
Some Linux Commands.
The Command Prompt Commands are the way to “do things” in Unix
Unix : Introduction and Commands
Andy Wang Object Oriented Programming in C++ COP 3330
Tutorial Unix Command & Makefile CIS 5027
Linux Shell Script Programming
Lab 2: Terminal Basics.
Presentation transcript:

Lesson 2-Touring Essential Programs

Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating the file system. Examining and managing files. Accessing the programmer’s manual. Accessing Internet resources.

Development of UNIX and Linux The UNIX operating system, developed in the 1970s at Bell Laboratories, consisted of the following features: A main program, called kernel, to control the central processing unit (CPU) and other hardware. A collection of user and system programs called utilities. A structure, called file system, for keeping and locating data on the hard drive. Unix was a multi-user and multi-tasking operating system.

Development of UNIX and Linux Linus Torvalds wrote a UNIX look-alike operating system called Linux. The operating system is available for free in its basic form for download, or at a low cost from several distributors.

The fundamental programs in Linux employ the same code, but different distributors add special features and installation programs. Some of different flavors of Linux operating system are RedHat, Lindows, SuSe, Mandrake, etc. Development of UNIX and Linux

Commands to Execute Utilities Introduction to the shell. Issuing commands to a shell. Passing information to a utility. Listing processes.

Introduction to the Shell The shell is a program, which displays the prompt on the screen. The shell reads the instructions of the user and interprets them to the remainder of the system. Usually the $ sign is the prompt in many systems. The shell processes and executes the command keyed in by a user.

Issuing Commands to a Shell Various utilities can be executed from the shell prompt. The “whoami” utility displays a user’s login name or username on the screen. The “date” utility displays the current date and time on the screen. The “hostname” utility is used to display the name of the system the user is working on.

Issuing Commands to a Shell The “clear” utility is used to clear all the text on the screen and display the prompt at the top of the screen or window. The Delete key or the Ctrl-H key can be used to correct errors that occur while entering commands. The “who” utility is used to display a list of users who have currently logged on.

Issuing Commands to a Shell Output of who Command

Issuing Commands to a Shell A port is a physical location at the back of the computer. Each port has a designation that usually begins with the letters tty and a number. A terminal connected through a network uses an electronic or pseudo port named pts.

Issuing Commands to a Shell The command/utility keyed in by a user is followed by the ENTER key. The shell interprets the ENTER as the end of the command/utility. The shell starts a child process to execute the command/utility.

Issuing Commands to a Shell The shell locates the path of the utility/command and executes it. The output is, by default, connected to the screen, unless we redirect it. After executing the command/utility, it returns the command prompt again.

Issuing Commands to a Shell How the shell works

Passing Information to a Utility When any information is passed to a utility, the shell runs the utility, and passes the information that comes after the command to the utility. Information passed to the utility is called an argument. Arguments provide instructions to utilities. Multiple arguments can also be passed to a utility.

Passing Information to a Utility The “cal” program provides the users with the current month’s calendar. Multiple arguments can be passed to the cal utility. When two arguments are passed to the cal program, the program interprets the first argument as the month and the second as the year.

Passing Information to a Utility The “look” command is used to locate words in the dictionary file that begin with that word, and output all the matching words. The look command requires one argument – the word that needs to be located.

Listing Processes A process is an instance of a running program code. The “ps” command can be used to obtain a list all the current processes, with some information about each process. The output displays the process id, the port, CPU time, and the code that the process is running.

Listing Processes The “–aux” and “–ef” command options are used with the “ps” command to display the processes running on the entire system, including system processes, and a list of currently logged on users. Arguments that begin with a minus (-) sign are options. The ps option is useful for system administrators in trouble- shooting the system.

Communicating Instructions to the Shell Every user is given a place, called the home directory, to work with and save files. The home directory is the default workspace of a user. The home directory contains the names of files and subdirectories created by and owned by a user.

Communicating Instructions to the Shell Working with files. Redirecting output from a utility. Determining the role of tokens on command-lines. Starting a child shell. Reissuing commands. Using nicknames for commands.

Working with Files The “ls” (list) command lists the contents of the current directory’s standard files. The “more” command displays the contents of a file one part at a time. The command requires one argument – the name of the file.

The spacebar can be used to display additional text in a file displayed by more. The “q” key can be used to quit the ‘more’ utility. The “wc” (word count) utility is used to count the number of lines, words, and characters in a particular file. The command requires one parameter – the name of the file. Working with Files

The “–l” option can be used with the wc command to only count the number of lines in a file. The “-c” option is used to count the number of characters in the file. The “-w” option is used to count the number of words in the file.

Redirecting Output from a Utility By default, the results provided by any utility are displayed on the user’s screen. Instructions can be given to redirect the output of a utility to a file. The command to redirect the output of a file is “utility > filename”. The > is the instruction to redirect the output to a new file.

Redirecting Output from a Utility The double redirect (>>) can be used to append the output of a utility to the end of an existing file. The | (pipe) command can be used to redirect the output of one utility to another utility. The argument following the pipeline must be a utility.

Determining the Role of Tokens on Command-Lines Each word or object on a command-line is called a token. The shell is programmed to read the initial token as a utility program to run or some action to be taken. The location on the command-line determines how the shell interprets each token.

Starting a Child Shell List of Various Shells in UNIX/Linux

Reissuing Commands The “!!” command or the “r” command can be used to re- execute a previously entered command. The “!!” command works only on a csh, a tch, or a bash shell. The “r” command works only on a Korn shell. The sh shell does not allow a user to re-execute previously entered commands.

Reissuing Commands The Up arrow key can be used to display previously entered commands one at a time. The shell keeps track of the commands that we issue at the prompt. The “history” command can be used to provide a list of all the commands entered previously, and every command has a number associated with it.

Reissuing Commands Various Options to Execute Previous Commands

Using Nicknames for Commands An “alias” or alternate name can be used for commands that are hard to remember. The alias command can be used to provide a list of all the current aliases. The command “unalias alias name” can be used to remove an alias.

Using Nicknames for Commands CommandShell alias alias name utility nameCsh and tch alias alias name=utility name Bash and ksh Nicknames for commands in UNIX/Linux

Navigating the File System The arrangement of files and folders in a system is called the file system. The “pwd” (present working directory) command can be used to get the location of the user’s home directory. The result displays the path from the root to the present working directory.

The topmost directory is called the “root,” and is identified as /. The “ls /” command can be used to obtain a list of all the files and directories in the root directory. Navigating the File System

The “mkdir” (make directory) command is used to create a new directory. The command requires one argument – the name to be given to the directory. The “–F” option can be used with the ‘ls’ command to include a / (slash) after all the directory names, and also to identify other kinds of files.

Navigating the File System The “cd” command can be used to make a directory the current directory. The command requires one parameter – the name of the directory that needs to be made the current directory. The cd command is used to return to the home directory. It does not require any parameters.

Examining and Managing Files Finding matching text: A particular word in a file can be located by giving the command “/word to be located”. The “n” key can be used to locate the next instance of the same word in the file. The “b” key can be used to move one screen backwards.

Examining and Managing Files The “head” utility can be used to read the first ten lines of a file. The “tail” utility can be used to view the last ten lines of a file. Both the utilities require one argument – the name of the file to be read. The number of lines to be read can also be passed as an argument to the utilities.

Examining and Managing Files The cat utility can be used to view the entire contents of a file. The utility requires one argument – the name of the file to be read. This utility is preferable when a file is small.

Examining and Managing Files Copying files: The “cp” command can be used to make a copy of an existing file, as well as copy files to another subdirectory. Two arguments are required to make a duplicate of a file – the name of the existing file and the name to be given to the duplicated file. The arguments required to copy a file to another subdirectory are – the name of the file to be copied and the target directory.

Examining and Managing Files Removing files: The “rm” command can be used to delete a file. The command requires one argument – the name of the file to be deleted.

Examining and Managing Files Removing files (continued): The rm command does its work and displays the prompt. It displays no message. The “-i” option can be used with the command to ask for confirmation before deleting any filenames listed as an argument. The command also accepts multiple file names as arguments.

Examining and Managing Files Renaming files: The “mv” command can be used to rename files, as well as to move files from one location to another. Two arguments are required while renaming the files – the current name of the file and the new name to be given to the file. The arguments required for moving the files are – the name of the files to be moved and the destination directory.

Examining and Managing Files Deciphering utility error messages: Error messages that occur due to the failure of a utility are shown in the screen by default. Every process has an "output door", where it writes output, and an error door, where it writes error messages. By default, the "error door" is connected to the screen, unless we redirect it.

Examining and Managing Files Printing a file: The “lp” or the “lpr” command can be used to print a file. The command requires one argument – the name of the file to be printed. The “–P” option with the “lpr” command, and the “-d” option with the lp command, can be used to specify the name of the printer to be used.

Accessing the Programmer’s Manual The UNIX and Linux systems include an extensive collection of powerful utility programs, system features, application languages, and support libraries. The UNIX programmer’s manual provides the information needed to employ the exact syntax of a particular option or command format for a utility.

Accessing the Programmer’s Manual The manual contains a detailed documentation on the uses and functions of utility programs, application programs, and libraries. The manual also contains information on UNIX system files and system programming libraries. It also includes supplementary information on related special files and commands for each entry.

Accessing the Programmer’s Manual The man command can be used to provide an online manual entry for a utility or a command. The command requires one argument – the name of the utility or the command. The “man –k” command can be used to search the manual pages’ descriptions for keywords.

Accessing Internet Resources The Internet includes many useful sites that provide information on: Recent news in the Linux world ( Interactive Web tutorials. Recent software updates and Linux code documentation.

Summary The shell is a process that interprets the commands entered by the user. Each word or object on a command-line is called a token. All shells, except for sh, allow users to create alias names for commands. The file system is a collection of files and folders.

Summary We can work on many utilities, print files, and access system folders from a shell. Files can be printed from the shell prompt. Online manual pages provide a detailed description of system utilities, files, and functionalities. The Internet includes useful sites that provide information on the various aspects of UNIX and Linux.