04 lecture 3

Upload: abdul-ghaffar

Post on 06-Apr-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 04 Lecture 3

    1/15

    Instructor: Ms. Shahida JabeenTA: Mr. Muhammad Kashif

    Enterprise Netw ork Technologies:

    W indow s 2000/Linux

    CSE-321

    Fall-20111 By Shahida Jabeen

  • 8/3/2019 04 Lecture 3

    2/15

    Last Lecture

    Fall-2011By Shahida Jabeen2

    An Enterprise Operating System

    The Linux Operating System Getting Started with Linux

  • 8/3/2019 04 Lecture 3

    3/15

    Todays Lecture

    Fall-2011By Shahida Jabeen3

    Getting Started with Linux Continued

  • 8/3/2019 04 Lecture 3

    4/15

    Working with the Shell

    Fall-2011By Shahida Jabeen4

    Which Shell Are You Running?

    You can identify the shell you are running by usingthe ps utility:

    $ ps

    PID TTY TIME CMD

    2402 pts/5 00:00:00 bash

    7174 pts/5 00:00:00 ps

  • 8/3/2019 04 Lecture 3

    5/15

    Working with the Shell

    Fall-2011By Shahida Jabeen5

    Repeating/Editing Command Lines:

    To repeat a previous command under bash or tcsh,press the UP ARROW key.

    Each time you press this key, the shell displays anearlier command line.

    To re-execute the displayed command line, pressRETURN.

    Press the DOWN ARROW key to browse through the

    command lines in the other direction.

  • 8/3/2019 04 Lecture 3

    6/15

    su/sudo: root privileges

    Fall-2011By Shahida Jabeen6

    UNIX and Linux systems have always had aprivileged user named root.

    When you are working as the root user (workingwith root privileges), you have extraordinary

    system-wide powers. A user working with root privileges is sometimes

    referred to as Super user or administrator.

  • 8/3/2019 04 Lecture 3

    7/15

    su/sudo: root privileges

    Fall-2011By Shahida Jabeen7

    Under a conventional setup, you can gain rootprivileges in one of two ways.

    First you can log in as the user named root; whenyou do so you are working with root privilegesuntil you log off.

    Alternatively, while you are working as yourself,you can use the su (substitute user) utility toexecute a single command with root privileges or

    to gain root privileges temporarily so you canexecute several commands.

  • 8/3/2019 04 Lecture 3

    8/15

    su/sudo: root privileges

    Fall-2011By Shahida Jabeen8

    The following example shows how to use su to execute a single command.

    $ ls -l /lost+found

    ls: cannot open directory /lost+found: Permission denied

    $ su -c 'ls -l /lost+found'

    Password: Ent er t he root password

    total 0

    $

    $ su

    Password: Ent er t he root password

    # ls -l /lost+found

    total 0

    # exitexit

    $

  • 8/3/2019 04 Lecture 3

    9/15

    su/sudo: root privileges

    Fall-2011By Shahida Jabeen9

    Some distributions (e.g., Ubuntu) ship with the rootaccount lockedthere is no root passwordand rely

    on the sudo utility to allow users to gain rootprivileges. The sudo utility requires you to enter your password

    (not the root password) to gain root privileges.

    The following example allows the user to gain rootprivileges to view the contents of the /lost+founddirectory:

    $ sudo ls -l /lost+found

    [sudo] password for sam: Enter your passwordtotal 0$

  • 8/3/2019 04 Lecture 3

    10/15

    su/sudo: root privileges

    Fall-2011By Shahida Jabeen10

    With an argument of i, sudo spawns a new shellrunning with root privileges.

    Typically the shell displays a hash pound sign (#)prompt when you are working with rootprivileges.

    Give an exit command to return to the normalprompt and non-root privileges.

  • 8/3/2019 04 Lecture 3

    11/15

    Where to Find Documentation

    Fall-2011By Shahida Jabeen11

    The help Option

    man: Displays the System Manual info: Displays Information About Utilities

    apropos: Searches for a Keyword

    Often a wrapper for the "man -k" command

  • 8/3/2019 04 Lecture 3

    12/15

    Readings

    Fall-2011By Shahida Jabeen12

    Chap # 2 of TB1

  • 8/3/2019 04 Lecture 3

    13/15

    Quiz: next Lecture

    Fall-2011By Shahida Jabeen13

    From Lab2 and Chap 2 TB1

  • 8/3/2019 04 Lecture 3

    14/15

    Homework 1

    Fall-2011By Shahida Jabeen14

    Exercises and Advanced Exercises section inChap # 2 of TB1 (page no. 44).

    To be submitted on LMS

    Due next week

  • 8/3/2019 04 Lecture 3

    15/15

    References:

    Fall-2011By Shahida Jabeen15

    Wikipedia

    Chapter 2 of Textbook no. 1