Exercicios en Linux

Embed Size (px)

Citation preview

  • 8/7/2019 Exercicios en Linux

    1/122

    Linux Basic and Installation(Course code LX02)

    Student ExercisesERC 6.0

    IBM certified course material

    5.1

    over

    Front cover

  • 8/7/2019 Exercicios en Linux

    2/122

    Student Exercises

    October 2008 edition

    The information contained in this document has not been submitted to any formal IBM test and is distributed on an as is basis withoutany warranty either express or implied. The use of this information or the implementation of any of these techniques is a customerresponsibility and depends on the customers ability to evaluate and integrate them into the customers operational environment. Whileeach item may have been reviewed by IBM for accuracy in a specific situation, there is no guarantee that the same or similar results willresult elsewhere. Customers attempting to adapt these techniques to their own environments do so at their own risk.

    Copyright International Business Machines Corporation 2001, 2008. All rights reserved.

    This document may not be reproduced in whole or in part without the prior written permission of IBM.

    Note to U.S. Government Users Documentation related to restricted rights Use, duplication or disclosure is subject to restrictionsset forth in GSA ADP Schedule Contract with IBM Corp.

    Trademarks

    IBM is a registered trademark of International Business Machines Corporation.

    The following are trademarks of International Business Machines Corporation in the UnitedStates, or other countries, or both:

    PS/2 is a trademark or registered trademark of Lenovo in the United States, other

    countries, or both.

    PostScript is either a registered trademark or a trademark of Adobe Systems Incorporated

    in the United States, and/or other countries.

    Microsoft, Windows and Windows NT are trademarks of Microsoft Corporation in theUnited States, other countries, or both.

    Intel and Pentium are trademarks or registered trademarks of Intel Corporation or itssubsidiaries in the United States and other countries.

    UNIX is a registered trademark of The Open Group in the United States and othercountries.

    Linux is a registered trademark of Linus Torvalds in the United States, other countries, or

    both.

    Other company, product, or service names may be trademarks or service marks of others.

    AIX AT DB2

    Domino Lotus Notes OS/2 400

  • 8/7/2019 Exercicios en Linux

    3/122

  • 8/7/2019 Exercicios en Linux

    4/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    iv Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise 12. The Linux GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-1Exercise Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-2Exercise Instructions with Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-4

    Exercise 13. Customizing the User Environment . . . . . . . . . . . . . . . . . . . . . . . . . .13-1Exercise Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-2Exercise Instructions with Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-4

    Exercise 14. Basic System Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-1Exercise Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-2Exercise Instructions with Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-4

    Exercise 15. Integrating Linux in a Windows Environment . . . . . . . . . . . . . . . . . .15-1Exercise Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-2Exercise Instructions with Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-7

    Exercise 16. End-of-course Challenge Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . .16-1

    Exercise Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16-2

  • 8/7/2019 Exercicios en Linux

    5/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Trademarks v

    5.1

    MK Trademarks

    The reader should recognize that the following terms, which appear in the content of this

    training document, are official trademarks of IBM or other companies:

    IBM is a registered trademark of International Business Machines Corporation.

    The following are trademarks of International Business Machines Corporation in the UnitedStates, or other countries, or both:

    PS/2 is a trademark or registered trademark of Lenovo in the United States, other

    countries, or both.

    PostScript is either a registered trademark or a trademark of Adobe Systems Incorporated

    in the United States, and/or other countries.Microsoft, Windows and Windows NT are trademarks of Microsoft Corporation in the

    United States, other countries, or both.

    Intel and Pentium are trademarks or registered trademarks of Intel Corporation or itssubsidiaries in the United States and other countries.

    UNIX is a registered trademark of The Open Group in the United States and othercountries.

    Linux is a registered trademark of Linus Torvalds in the United States, other countries, or

    both.

    Other company, product, or service names may be trademarks or service marks of others.

    AIX AT DB2

    Domino Lotus Notes

    OS/2 400

  • 8/7/2019 Exercicios en Linux

    6/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    vi Linux Basic and Installation Copyright IBM Corp. 2001, 2008

  • 8/7/2019 Exercicios en Linux

    7/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2006 Exercises Description vii

    2.0

    ef Exercises Description

    The objective of the Linux Power User exercises is to let the you

    become familiar with installing and running Linux on your personalworkstation. To achieve this, a variety of real-world exercises are

    performed, aimed at simulating real-world tasks.Each exercise unit consists of two parts:

    Exercise Instructions This section contains what it is you are toaccomplish. There are no definitive details on how to perform the

    tasks. You are given the opportunity to work through the exercisegiven what you learned in the unit presentation, utilizing the unit

    Student Notebook, your past experience, the online documentationand maybe a little intuition.

    Exercise Instructions With Hints This section is an exact

    duplicate of the Exercise Instructions section except that in addition,specific details and/or hints are provided to help step you through the

    exercise. A combination of using the Instructions section along withInstructions With Hints section can make for a rewarding combination

    providing you with no hints when you don't want them and hints whenyou need them.

    In this last section, multiple ways to accomplish the same task are

    often provided. Where this has been done, the various methods areseparated by an -OR-

    All exercises and hints apply both to Fedora, RHEL, and SLESequally, unless mentioned.

  • 8/7/2019 Exercicios en Linux

    8/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    viii Linux Basics and Installation Copyright IBM Corp. 2001, 2006

  • 8/7/2019 Exercicios en Linux

    9/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 1. Introduction to Linux 1-1

    5.1

    Xempty Exercise 1. Introduction to Linux

    Notice: This unit has no exercises. This page is here to ensure that unit numbers and

    exercise numbers stay synchronized.

  • 8/7/2019 Exercicios en Linux

    10/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    1-2 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

  • 8/7/2019 Exercicios en Linux

    11/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 2. Installing Linux 2-1

    5.1

    Xempty Exercise 2. Installing Linux

    What this exercise is about

    This exercise lets you install Linux.

    What you should be able to do

    After completing this exercise, you should have experience with:

    Preparing a system for installation

    Partitioning a system

    Installing Linux

    Required Materials A set of installation CDs or a network capable boot CD for your

    distribution

  • 8/7/2019 Exercicios en Linux

    12/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    2-2 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise Instructions

    Note

    The exercises in this course material have been designed for and tested on the following

    three distributions:

    Fedora Core 7

    Red Hat Enterprise Linux (RHEL) 5.1 Enterprise Client

    SUSE Linux Enterprise Desktop (SLED) 10 SP1

    If you are using one of these three distributions, follow the instructions below that apply

    to your distribution. If you are using another distribution, or another version of one of thethree distributions above, then your instructor gives you additional information.

    Optional: Depending on the circumstances, your instructor might have to loan you a fullset of CDs for each distribution, so that you can perform a CD-based install, or your

    instructor might have to loan you an installation CD so that you can perform anetwork-based install.

    If you need to perform a network install, your instructor will give you additional information,

    specifically:

    The install method: NFS (FTP or HTTP is also available)

    The IP address that is to be used for your workstation, if DHCP is not used

    The name or IP address of the install server The path to the installation images on the install server

    Installing Fedora Core 7 or Red Hat Enterprise Linux 5.1 Desktop

    __ 1. Turn on or reboot the computer.

    __ 2. Your systems needs to boot to the network instead of from the hard drive or CD.

    Depending on your hardware, you might need to press F12 or F9 or F1 to force anetwork boot. You see a screen with a text version of the IBM logo that gives you

    different installation options. You will simply type an appropriate number and thenpress Enter.

    For Fedora 7, type 11 and press Enter.

    For RHEL 5.1 Client, type 13 and press Enter.

  • 8/7/2019 Exercicios en Linux

    13/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 2. Installing Linux 2-3

    5.1

    XemptyNote

    If your system is not booting to the network, ask your instructor for additional

    assistance.

    __ 3. Choose the language for the installation process, click OK.

    __ 4. Choose your keyboard model and layout, click OK.

    __ 5. On the TCP/IP screen, you want to disable IPv6Support, click OK.

    __ 6. At the initial graphic screen, click Next.

    __ 7. If you are installing RHEL 5.1, you are asked to input an Installation Number --choose Skip Installation Number; then click OK.

    Next, click in the pull-down that says Remove Linux partitions and choose

    Create custom layout; then click Next. The Disk Druid screen displays and shows the current layout of your disks. You

    first need to Delete all partitions manually. You can then start adding Linux

    partitions. Make sure you create three additional partitions:

    - One partition is used as root partition. Its Mount Point should be /, the File

    System Type should be ext3, and the size of this partition should be 6 GB(6000MB).

    - Add a boot partition. Its Mount Point should be /boot, the File System Type

    should be ext3, and the size of this partition should be 100 MB.

    - The last partition is used as swap space, which does not have a mount point.The size should be equal to the amount of real memory, with a maximum of

    1000 MB, and the File System Type should be swap (the Mount Point shows

    )

    __ 8. Let the instructor check your partition configuration before you save it! Afterthe instructor has checked your partition configuration, click Next.

    __ 9. The installation program now allows you to configure your boot loader. You can

    accept all defaults here, then click Next.

    __ 10. Configure your network adapters. Your instructor should tell you whether to useDHCP or will provide you with the IP Address, Netmask, Network and Broadcastaddresses, with the Hostname, Gateway and DNS addresses. Enter these values,

    double-check them, and click Next.

    __ 11. Now select your Time Zone and clear the UTC checkbox, then click Next.

    __ 12. In the next screen you need to set the root password. For convenience in the class,set the root password to ibmlnx: then click Next.

  • 8/7/2019 Exercicios en Linux

    14/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    2-4 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    __ 13. At the Software screen, select Customize now. Click Next and add the KDE

    Desktop Environment group. Also, click Development and add DevelopmentTools; then click Next.

    __ 14. Note the location of the log file and click Next.

    __ 15. The installation program now formats the filesystems and installs Linux. This mighttake anywhere from 5 minutes to an hour, depending on the number of packages to

    install, and the speed of the computer.

    While installing, you can see what is going on in detail by switching to the third

    virtual terminal with Ctrl+Alt+F3. Switch back to the graphical installation screen

    with Ctrl+Alt+F7. Also, take a look at other virtual screens (1 through 6).

    __ 16. When your installation is complete -- click Reboot to reboot your system.

    __ 17. When your Linux system boots for the first time, the Fedora/RHEL Setup Agent is

    started. Click the Forward button.

    __ 18. Read the License Agreement, if asked; then select Yes, I agree and click Forward.

    __ 19. The next screen allows you to configure firewall rules. Choose Disabled from the

    Firewall list and click Forward and then Yes. Then Disable the SELinux Setting the

    same way, and click Forward and then click Yes.

    __ 20. RHEL 5.1 will ask you if you want Kdump enabled -- you do notso click Forward.

    __ 21. Check the date and time. If the network has an NTP server, configure it here as well.

    Click Forward.

    __ 22. Fedora 7 will then show your hardware profile -- Click Do not send then Forward,then No, do not send.

    __ 23. RHEL 5.1 Client will ask if you want to Set Up Software Updates. Click No>Forward> No thanks> Forward.

    __ 24. Add a personal user account for yourself, with a password you make up yourself,then click Forward.

    __ 25. Verify that your sound card has been detected and is configured correctly, by playing

    a test sound. Then click Yes, then Finish.

    __ 26. RHEL 5.1 Client will ask if you want to install any additional CDs, click No> Finish>

    OK.

    __ 27. The installer might ask that you reboot your machine at this time -- do so and theinstallation is complete.

  • 8/7/2019 Exercicios en Linux

    15/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 2. Installing Linux 2-5

    5.1

    Xempty Installing SUSE Linux Enterprise Desktop 10 SP1

    __ 28. Turn on or reboot the computer.

    __ 29. Your systems needs to boot to the network instead of from the hard drive or CD.

    Depending on your hardware, you might need to press F12 or F9 or F1 to force anetwork boot. You see a screen with a text version of the IBM logo that gives you

    different installation options. You will simply type an appropriate number and thenpress Enter. For SLED 10, type 15 and press Enter.

    Note

    If your system is not booting to the network, ask your instructor for additionalassistance.

    __ 30. Select the language and keyboard map (if asked) for the network configuration

    process and click Next.

    __ 31. On the License Agreement screen, choose Yes, I agree and click Next.

    __ 32. If your system has already been installed with Linux, then a window might open

    stating this. Select New installation and click Next.

    __ 33. Browse through the autodetected installation settings, and make changes ifrequired:

    Make sure your Time Zone and UTC/Local choices are correct.

    Click Partitioning; then click Create Custom Partition Setup, then Next. Now

    click Custom Partitioning and Next. Delete all partitions that you see. Makethese choices to create three partitions:

    - Click> Primary> OK. Format as ext3, highlight the number in the End boxand change it to 6GB, enter / in the Mount Point field, then click OK.

    - Click> Primary> OK, Format as ext3, highlight the number in the End box

    and change it to 100MB, enter /boot in the Mount Point field, then click

    OK.

    - Click> Primary> OK, Format as Swap, highlight the number in the End box

    and change it to 1GB,and then click OK> click Finish.

    Click Software, make sure that you add KDE and C/C++ Compiler and Toolsto the default selection of software; then click Accept.

    Click Accept (on any and all pop-up screens) and click Install. SLED 10 now

    installs itself. This takes 5 minutes to an hour, depending on the speed of yourcomputer.

  • 8/7/2019 Exercicios en Linux

    16/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    2-6 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    __ 34. Note that SLED 10 might automatically reboot midway through the installationprocess. This is normal. When the initial boot screen appears, do nothing so that the

    system boots from hard disk. The installation process should continue automatically.

    __ 35. Next, you need to enter the root password. For convenience in class, use ibmlnx asthe root password and click Next.

    __ 36. On the Hostname and Domain Name screen, select the box next to ChangeHostname via DHCP check box and then click Next.

    __ 37. The Network Configuration screen allows you to configure your network. Make

    sure all detected values are okay. If necessary, consult your instructor for IP

    addresses and such. Then, click the word Enabled next to Firewall to toggle thefirewall setting; then click Disable IPv6 and click Next.

    __ 38. Even if you have an Internet connection, click No, skip the test for your Internetconnection test and click Next.

    __ 39. Select Local (/etc/passwd) as User Authentication Method screen. Click Next.

    __ 40. Add a local user account for yourself, using a secret password. Do notselectAutomatic Login. Then click Next.

    __ 41. SuSEConfig now executes several configuration scripts. This might take severalminutes.

    __ 42. If you feel like it, read the Release Notes for this version. Then click Next.

    __ 43. Check your Hardware Configuration, (You may change the Graphics Card/Monitorsettings if you know what they should be.) Then click Next, and then Finish.

    __ 44. Select the Clone for Autoyast check boxand log in when the system is ready.

    End of exercise

  • 8/7/2019 Exercicios en Linux

    17/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 3. Using the System 3-1

    5.1

    Xempty Exercise 3. Using the System

    What this exercise is about

    The purpose of this exercise is to become familiar with Linux, the

    command syntax and some basic commands. The exercise alsoserves to show some multiuser concepts.

    What you should be able to do

    At the end of the lab, you should be able to:

    Switch between virtual terminals Log in to a Linux system and change passwords

    Execute basic commands

    Use the wall and write commands to communicate with otherusers Use keyboard control keys to control command line output

    Use the mouse to copy and paste commands Use the command history

    Lock a Linux system Log out of a Linux system

  • 8/7/2019 Exercicios en Linux

    18/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    3-2 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise Instructions

    Logging in on a virtual terminal

    In this section, you are going to log in to the system using both text and graphical virtualterminals.

    __ 1. If the install went correctly then you should now see a graphical login prompt. If thisis not the case, ask your instructor to fix this. (You learn how to do this yourself laterin the course.)

    __ 2. Verify that you indeed have seven different virtual terminals. Cycle through them by

    pressing Alt+Fn, where nis the terminal number you want to access. UseCtrl+Alt+Fnwhen you are in a graphical terminal.

    __ 3. In your first virtual terminal (tty1), log in to the system with your own username,

    which you also configured when installing the system.

    __ 4. In your second virtual terminal (tty2), log in to the system as root. After having

    logged in, look at the command prompt. Do you notice anything different from thecommand prompt in the other virtual terminals?

    __ 5. In your seventh virtual terminal (tty7), log in to the system with your own username

    and password.

    __ 6. Open a terminal window. Take a look at the command prompt. Does it differ from thecommand prompt on tty1? Why or why not?

    Basic Commands

    In this section, we are going to execute some basic commands, in order to familiarizeyourself with the command syntax of Linux, and the fact that you are currently on amultiuser, multi-tasking system.

    All commands in this section are executed on virtual terminal seven (the graphical login

    prompt where you are logged in as yourself), using the terminal window you just opened,unless specified otherwise.

    __ 7. Change your password. Memorize this password because no one can find out your

    password if you forget it.

    __ 8. Display the system's date.

    __ 9. Display the whole calendar for the year 2008.

    __ 10. Display the month of January for the year 1999 and 99. Are 1999 and 99 the same?

    __ 11. Generate a list of all users present on your system.

    __ 12. Display your login name.

    __ 13. Display the login information of your own user account, and of root.

    __ 14. Clear your screen.

  • 8/7/2019 Exercicios en Linux

    19/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 3. Using the System 3-3

    5.1

    Xempty __ 15. Print the text Out to lunch on your display.

    __ 16. Make sure you are willing to receive messages.

    __ 17. Write the message Out to lunch to the display of root. Check whether root got themessage.

    __ 18. Write the message Out to lunch to the display of all users. Check whether

    everybody on your system got the message.

    Keyboard and Mouse Tips

    __ 19. The bash shell has a command history function. View some of the commands youhave entered. Try to alter one of these commands; then run the command again.

    __ 20. Your terminal has a buffer that keeps track of the output of your commands. View theoutput of the previous commands.

    __ 21. Bash supports command and filename completion with the TAB character. Try to

    use this feature, both on commands and on filenames.__ 22. Both in a text terminal and an emulated terminal in the graphical desktop, try to

    re-execute commands by scrolling up a little, selecting the command with the left

    mouse button, and then pasting it onto the same terminal again with the middlemouse button.

    Also try this across different text and graphical terminals.

    Note

    SuSE does not enable gpm by default; so your mouse wont work in a text terminalwhen you are using SuSE.

    Using the history

    __ 23. Use the history command to view the last 20 commands you typed.

    __ 24. Execute one of the commands from the history list.

    __ 25. Execute the echo command again, this time changing the word lunchto dinner.

    __ 26. Bash also supports searching in the history. Try this feature as well.

  • 8/7/2019 Exercicios en Linux

    20/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    3-4 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Locking terminals

    Note

    Not all distributions install vlock and xlock by default. If vlock and xlock are notinstalled, then you learn how to do that in Exercise 15 - Basic System

    Configuration.

    __ 27. Lock a virtual terminal. Can you switch to another virtual terminal while this one islocked? Unlock the terminal.

    __ 28. Lock the console. Can you switch to another virtual terminal now? Unlock theconsole.

    __ 29. Lock the graphical environment and then unlock it again.

    Logging off

    __ 30. Log off all users that are logged in at any TTY.

    End of exercise

  • 8/7/2019 Exercicios en Linux

    21/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 3. Using the System 3-5

    5.1

    Xempty Exercise Instructions with Hints

    All hints are identified with the two greater-than symbols like this one.

    All hints apply to all distributions equally, unless mentioned.

    Logging in on a virtual terminal

    In this section, you are going to log in to the system using both text and graphical virtualterminals.

    __ 1. If the install went correctly, then you should now see a graphical login prompt. If this

    is not the case, ask your instructor to fix this. (You learn how to do this yourself laterin the course.)

    __ 2. Verify that you indeed have seven different virtual terminals. Cycle through them by

    pressing Alt-Fn, where nis the terminal number you want to access. UseCtrl+Alt+Fnwhen you are in a graphical terminal.

    __ 3. In your first virtual terminal (tty1), log in to the system with your own username,which you also configured when installing the system.

    Login: (your username)

    Password: (your password)

    __ 4. In your second virtual terminal (tty2), log in to the system as root. After having

    logged in, look at the command prompt. Do you notice anything different from thecommand prompt in the other virtual terminals?

    Login: root

    Password: ibmlnx

    __ 5. In your seventh virtual terminal (tty7), log in to the system with your own username

    and password.

    Login: (your username)

  • 8/7/2019 Exercicios en Linux

    22/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    3-6 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Password: (your password)

    __ 6. Open a terminal window. Take a look at the command prompt. Does it differ from thecommand prompt on tty1? Why or why not?

    On a Fedora or Red Hat system, a terminal window can be started from the Red

    Hat button in the upper left hand corner; System Tools; Terminal. You can alsodrag this icon to your quick launch bar, if you want to.

    On a SuSE system, the terminal icon can be found in the launch bar.

    Basic Commands

    In this section, you execute some basic commands, to familiarize yourself with the

    command syntax of Linux. All commands in this section are executed on virtual terminal 7(the graphical login prompt where you are logged in as yourself), using the terminal window

    you just opened, unless specified otherwise.

    __ 7. Change your password. Memorize this password because no one can find out your

    password if you forget it.

    $ passwd

    Changing password for

    (current) UNIX password: (your current password)

    New UNIX password: (your new password)

    Retype new UNIX password: (your new password)

    passwd: all authentication tokens updated successfully

    __ 8. Display the system's date.

    $ date

    __ 9. Display the whole calendar for the year 2008.

    $ cal 2008

    __ 10. Display the month of January for the year 1999 and 99. Are 1999 and 99 the same?

    $ cal 1 1999

    $ cal 1 99

    __ 11. Generate a list of all users present on your system. $ who

    - OR -

    $ finger

    __ 12. Display your login name.

    $ whoami

  • 8/7/2019 Exercicios en Linux

    23/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 3. Using the System 3-7

    5.1

    Xempty - OR -

    $ who am i

    __ 13. Display the login information of your own user account, and of root.

    $ finger

    $ finger root

    __ 14. Clear your screen.

    $ clear

    __ 15. Print the text Out to lunch on your display.

    $ echo Out to lunch

    __ 16. Make sure you are willing to receive messages

    $ mesg y

    __ 17. Write the message Out to lunch to the display of root. Check whether root got the

    message.

    $ write root

    Out to lunch

    __ 18. Write the message Out to lunch to the display of all users. Check whether

    everybody on your system got the message. $ wall

    Out to lunch

    Keyboard and Mouse Tips

    __ 19. The bash shell has a command history function. View some of the commands youhave entered. Try to alter one of these commands, then run the command again.

  • 8/7/2019 Exercicios en Linux

    24/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    3-8 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    __ 20. Your terminal has a buffer that keeps track of the output of your commands. View theoutput of the previous commands.

    __ 21. Bash supports command and filename completion with the TAB character. Try to

    use this feature, both on commands and on filenames. $ pass

    $ cat /etc/pass

    __ 22. Both in a text terminal and an emulated terminal in the graphical desktop, try to

    re-execute commands by scrolling up a little, selecting the command with the leftmouse button, and then pasting it onto the same terminal again with the middle

    mouse button.

    Also try this across different text and graphical terminals.

    Note

    SuSE does not enable gpm by default; so your mouse wont work in a text terminal

    when you are using SuSE.

    Using the history

    __ 23. Use the history command to view the last 20 commands you typed.

    $ history 20

    __ 24. Execute one of the commands from the history list.

    $ !2

    __ 25. Execute the echo command again, this time changing the word lunchto dinner.

    $ !echo:s/lunch/dinner/

    __ 26. Bash also supports searching in the history. Try this feature as well.

    $ cle

    Locking terminals

    Note

    Not all distributions install vlock and xlock by default. If vlock and xlock are notinstalled, then you learn how to do that in Exercise 15 - Basic System Configuration.

  • 8/7/2019 Exercicios en Linux

    25/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 3. Using the System 3-9

    5.1

    Xempty __ 27. Lock a virtual terminal. Can you switch to another virtual terminal while this one islocked? Unlock the terminal.

    $ vlock

    Type your password or the root password ibmlnx to unlock the terminal.

    __ 28. Lock the console. Can you switch to another virtual terminal now? Unlock theconsole.

    $ vlock -a

    Type your password or the root password ibmlnx to unlock the console.

    __ 29. Lock the graphical environment and then unlock it again.

    $ xlock

    - OR -Click the padlock icon.

    - OR -Use the Lock Screen function in your Start menu.

    Type your password to unlock the graphical environment.

    Logging off

    __ 30. Log off all users that are logged in at any TTY.

    $ exit

    $ logout

    Click the GNOME or KDE button and select Log out

    End of exercise

  • 8/7/2019 Exercicios en Linux

    26/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    3-10 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

  • 8/7/2019 Exercicios en Linux

    27/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 4. Working with Files and Directories 4-1

    5.1

    Xempty Exercise 4. Working with Files and Directories

    What this exercise is about

    This exercise provides the students with the opportunity to begin

    working with directories and the files they contain.

    What you should be able to do

    At the end of the lab, you should be able to:

    Work with directories

    Work with files Work with files and directories recursively

    Work with binary files

  • 8/7/2019 Exercicios en Linux

    28/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    4-2 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise Instructions

    Working with directories

    __ 1. If you are not logged in as yourself at tty7, log in now. Make sure a terminal windowis open.

    __ 2. Check the directory you are placed in. What directory is this? __________

    __ 3. Change your current directory to the root directory (/).

    __ 4. Verify that you are in the root directory and then execute both a simple and a long

    listing of the files in that directory.

    __ 5. List all files in the current directory and list all files in the current directory and below.

    Note

    This command provides extensive output. When you have seen enough, end the

    command with the correct sequence.

    __ 6. Return to your home directory and list its contents including hidden files.

    __ 7. Create a directory in your home directory called mydir. Then, issue the command toview a long listing of your home directory and the ~/mydir directory. (Do not show

    the contents of the directories.) What is the size of each directory? __________

    __ 8. Change to the mydir directory. Create two zero-length files called myfile1 and

    myfile2.

    __ 9. Issue the command to view a long listing of the contents of the mydir directory.

    What are the sizes of myfile1 and myfile2?_______________

    __ 10. Return to your home directory and use the ls -R command to view your directorytree.

    __ 11. Try to remove the mydir directory. Does it work?

    __ 12. Go to the mydir directory once more and delete the two files in that directory. Then

    go back up to your home directory and delete the mydir directory.

    Working with files

    __ 13. Look at the contents of the /etc/passwd file. The /etc/passwd file contains a list of

    all the users authorized to use the system.

    __ 14. Copy the /etc/passwd file to your home directory, and rename it to usersfile.

    __ 15. Split the usersfile into a number of smaller files, of 200 bytes each.

    __ 16. Make a long listing of all files in your home directory.

  • 8/7/2019 Exercicios en Linux

    29/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 4. Working with Files and Directories 4-3

    5.1

    Xempty Working with files and directories recursively

    __ 17. Create a directory sub1 and create a directory sub2 in sub1. Do this all with one

    command.

    __ 18. Go to the sub2 directory and create a file called myfile.

    __ 19. Go back to your home directory. Then make a copy of the whole sub1 directory tree

    by the name of tree1. Make a recursive listing of all files and directories in sub1 andtree1.

    __ 20. You now have two directory trees, named sub1 and tree1. Move the directory treetree1 into the sub1 subdirectory.

    __ 21. List the contents of your home directory. Make a recursive listing of all files anddirectories in the sub1 directory.

    Working with binary files

    __ 22. List the content of the file /bin/ls using od or hexdump.__ 23. List all strings in the /bin/ls program.

    End of exercise

  • 8/7/2019 Exercicios en Linux

    30/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    4-4 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise Instructions with Hints

    Working with directories

    __ 1. If you are not logged in as yourself at tty7, log in now. Make sure youve got aterminal window open.

    Login:

    Password:

    Open a terminal window.

    __ 2. Check the directory you are placed in. What directory is this? __________

    $ pwd

    __ 3. Change your current directory to the root directory (/).

    $ cd /__ 4. Verify that you are in the root directory and then execute both a simple and a long

    listing of the files in that directory.

    $ pwd

    $ ls

    $ ls -l

    __ 5. List all files in the current directory and list all files in the current directory and below.

    Note

    This command provides extensive output. Once you have seen enough, end the

    command with the correct sequence.

    $ ls -a

    $ ls -R

    __ 6. Return to your home directory and list its contents including hidden files.

    $ cd

    - OR -

    $ cd ~

    $ ls -a

    __ 7. Create a directory in your home directory called mydir. Then, issue the command toview a long listing of your home directory and the ~/mydir directory. (Do not show

    the contents of the directories.) What is the size of each directory? __________

  • 8/7/2019 Exercicios en Linux

    31/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 4. Working with Files and Directories 4-5

    5.1

    Xempty $ mkdir mydir

    $ ls -ld .

    $ ls -ld mydir

    - OR -

    $ ls -ld . mydir

    __ 8. Change to the mydir directory. Create two zero-length files called myfile1 and

    myfile2.

    $ cd mydir

    $ touch myfile1

    $ touch myfile2

    - OR -

    $ touch myfile1 myfile2

    __ 9. Issue the command to view a long listing of the contents of the mydir directory.What are the sizes of myfile1 and myfile2?_______________

    $ ls -l

    __ 10. Return to your home directory and use the ls -R command to view your directorytree.

    $ cd

    $ ls -R

    __ 11. Try to remove the mydir directory. Does it work?

    $ rmdir mydir

    __ 12. Go to the mydir directory once more and delete the two files in that directory. Thengo back up to your home directory and delete the mydir directory.

    $ cd mydir

    $ rm myfile1 myfile2

    $ cd ..

    $ rmdir mydir

    Working with files

    __ 13. Look at the contents of the /etc/passwd file. The /etc/passwd file contains a list ofall the users authorized to use the system.

    $ cat /etc/passwd

    - OR -

    You can use more or less in place of the cat command.

  • 8/7/2019 Exercicios en Linux

    32/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    4-6 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    __ 14. Copy the /etc/passwd file to your home directory, and rename it to usersfile.

    $ cp /etc/passwd ~/usersfile

    $ mv passwd usersfile

    __ 15. Split the usersfile into a number of smaller files, of 200 bytes each.

    $ split -b 200 usersfile usersfile.

    __ 16. Make a long listing of all files in your home directory.

    $ ls -l ~

    Working with files and directories recursively

    __ 17. Create a directory sub1 and create a directory sub2 in sub1. Do this all with one

    command.

    $ mkdir -p sub1/sub2

    __ 18. Go to the sub2 directory and create a file called myfile. $ cd sub1/sub2

    $ touch myfile

    __ 19. Go back to your home directory. Then make a copy of the whole sub1 directory tree

    by the name of tree1. Make a recursive listing of all files and directories in sub1 andtree1.

    $ cd

    $ cp -R sub1 tree1

    $ ls -l

    $ ls -R sub1

    $ ls -R tree1

    __ 20. You now have two directory trees, named sub1 and tree1. Move the directory treetree1 into the sub1 subdirectory.

    $ mv tree1 sub1

    __ 21. List the contents of your home directory. Make a recursive listing of all files and

    directories in the sub1 directory.

    $ ls -l

    $ ls -R sub1

  • 8/7/2019 Exercicios en Linux

    33/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 4. Working with Files and Directories 4-7

    5.1

    Xempty Working with binary files

    __ 22. List the content of the file /bin/ls using od or hexdump.

    $ od /bin/ls

    - OR -

    $ hexdump /bin/ls__ 23. List all strings in the /bin/ls program.

    $ strings /bin/ls

    End of exercise

  • 8/7/2019 Exercicios en Linux

    34/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    4-8 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

  • 8/7/2019 Exercicios en Linux

    35/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 5. File and Directory Permissions 5-1

    5.1

    Xempty Exercise 5. File and Directory Permissions

    What this exercise is about

    This exercise provides the student the opportunity to work with file and

    directory permissions.

    What you should be able to do

    At the end of the lab, you should be able to apply file and directory

    permissions.

  • 8/7/2019 Exercicios en Linux

    36/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    5-2 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise Instructions

    Creating User Accounts

    To demonstrate permissions in full, you need to create a few additional users, tux1 andtux2, who both are members of the penguins group. For this, you need to execute a few

    command that have not been covered in the course, and which normally do not need to beexecuted by a regular user. They are covered in full in LX03.

    __ 1. On tty3, log in as root.

    __ 2. Execute the following series of commands:

    # groupadd penguins

    # useradd -m -g penguins -c Tux the Penguin (1) tux1# useradd -m -g penguins -c Tux the Penguin (2) tux2

    # passwd tux1New password: penguin1

    Retype new password: penguin1# passwd tux2

    New password: penguin2Retype new password: penguin2

    __ 3. On tty1, log in as tux1 with password penguin1, and on tty2, log in as tux2 withpassword penguin2.

    File and directory permissions

    __ 4. Switch to VT 1, where you are logged in as tux1, and look at the permissions on

    your home directory.

    __ 5. Switch to VT2, where you are logged in as tux2. Try to change to the home directoryof tux1, or read the contents of the home directory of tux1. Does this work?

    On a Fedora or Red Hat system, both commands fail, because the default

    permissions on a users home directory are set to rwx------. On a SuSE system, bothcommand succeed, because the default permissions are set to rwxr-xr-x.

    __ 6. Fedora/Red Hat only: Switch to tty1. Change the permissions on the home

    directory of tux1 so that other users are allowed to read and access it. Then try toaccess the directory again as tux2. Does this work now?

    __ 7. As tux2, try to create and delete files in tux1s home directory. Does this work?

    __ 8. Switch once again to tty1. Create a bin directory (Fedora/Red Hat only) and copy

    the file /bin/ls in there, renaming it to my_ls in the process.

    __ 9. Set the permissions on my_ls to rw-r-----, and then try to execute it, both as tux1 andtux2. Does this work? Why not?

  • 8/7/2019 Exercicios en Linux

    37/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 5. File and Directory Permissions 5-3

    5.1

    Xempty __ 10. Now set the permissions to rwxr-xr-x, and then try to execute it once more, both astux1 and tux2. Does this work now?

    __ 11. Try to execute my_ls as tux1 and as tux2, and as yourself, but now with permissions

    rw-------, rw-rw----, rwx------, rwx--x--- and rwx--x--x as well. What permissions arerequired, at a minimum, for tux1 to execute my_ls? What permissions are required

    for tux2? What permissions does your own user account require?

    End of exercise

  • 8/7/2019 Exercicios en Linux

    38/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    5-4 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise Instructions with Hints

    Creating User Accounts

    To demonstrate permissions in full, you need to create a few additional users, tux1 andtux2, who both are members of the penguins group. For this, you need to execute a few

    command that have not been covered in the course, and which normally do not need to beexecuted by a regular user. They are covered in full in LX03.

    __ 1. On tty3, log in as root.

    Login: root

    Password: ibmlnx

    __ 2. Execute the following series of commands:

    # groupadd penguins

    # useradd -m -g penguins -c Tux the Penguin (1) tux1# useradd -m -g penguins -c Tux the Penguin (2) tux2# passwd tux1

    New password: penguin1Retype new password: penguin1

    # passwd tux2New password: penguin2

    Retype new password: penguin2

    __ 3. On tty1, log in as tux1 with password penguin1, and on tty2, log in as tux2 with

    password penguin2.

    Login: tux1

    Password: penguin1

    Login: tux2

    Password: penguin2

    File and directory permissions

    __ 4. Switch to VT 1, where you are logged in as tux1, and look at the permissions onyour home directory.

    $ ls -ld /home/tux1

  • 8/7/2019 Exercicios en Linux

    39/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 5. File and Directory Permissions 5-5

    5.1

    Xempty __ 5. Switch to VT2, where you are logged in as tux2. Try to change to the home directoryof tux1, or read the contents of the home directory of tux1. Does this work?

    $ cd /home/tux1

    $ ls /home/tux1

    On a Fedora or Red Hat system, both commands fail, because the defaultpermissions on a users home directory are set to rwx------. On a SuSE system, both

    commands succeed, because the default permissions are set to rwxr-xr-x.

    __ 6. Fedora/Red Hat only: Switch to tty1. Change the permissions on the homedirectory of tux1 so that other users are allowed to read and access it. Then try to

    access the directory again as tux2. Does this work now?

    $ chmod 755 /home/tux1

    - OR -$ chmod go+rx /home/tux1

    $ cd /home/tux1

    $ ls /home/tux1

    __ 7. As tux2, try to create and delete files in tux1s home directory. Does this work?

    $ touch testfile

    __ 8. Switch once again to tty1. Create a bin directory (Fedora/Red Hat only) and copythe file /bin/ls in there, renaming it to my_ls in the process.

    $ mkdir /home/tux1/bin (Fedora/Red Hat only)

    $ cp /bin/ls /home/tux1/bin/my_ls

    __ 9. Set the permissions on my_ls to rw-r-----, and then try to execute it, both as tux1 and

    tux2. Does this work? Why not?

    $ chmod 640 /home/tux1/bin/my_ls

    - OR -

    $ chmod u=rw,g=r,o=/home/tux1/bin/my_ls

    $ my_ls

    $ /home/tux1/bin/my_ls

  • 8/7/2019 Exercicios en Linux

    40/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    5-6 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    __ 10. Now set the permissions to rwxr-xr-x, then try to execute it once more, both as tux1and tux2. Does this work now?

    $ chmod 755 /home/tux1/bin/my_ls

    - OR -

    $ chmod u=rwx,go=rx /home/tux1/bin/my_ls

    $ my_ls

    $ /home/tux1/bin/my_ls

    __ 11. Try to execute my_ls as tux1 and as tux2, and as yourself, but now with permissions

    rw-------, rw-rw----, rwx------, rwx--x--- and rwx--x--x as well. What permissions are

    required, at a minimum, for tux1 to execute my_ls? What permissions are requiredfor tux2? What permissions does your own user account require?

    End of exercise

  • 8/7/2019 Exercicios en Linux

    41/122

  • 8/7/2019 Exercicios en Linux

    42/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    6-2 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise Instructions

    Man Pages

    __ 1. If you are not already logged on, log in as tux1 at tty1.

    __ 2. Display the man pages for the man command. Read the text that follows to obtain a

    better understanding of the functionality of the man command.

    __ 3. Search for the string PAGER in the manual page of the man command.

    __ 4. Use the key to end the man command.

    __ 5. Display the man page of the ls command. Move though the manual pages:

    Go to the last page.

    Go to the previous page.

    Go to the first page.

    Type these commands while looking at the man page of ls.

    __ 6. Close the man command.

    __ 7. Find out which manual pages all deal with passwd. Then view each page, giving thecorrect section number.

    Note

    If the man -k or apropos commands do not work, then you need to run the

    makewhatis command as root. Normally, the makewhatis command is executed

    each night automatically, but because your system is freshly installed, this might

    not have happened yet.

    Info command

    __ 8. View the info documentation for the finger command. Are you actually reading info

    documentation now?

    __ 9. Move through this page by using the Space and Backspace keys.

    __ 10. Read the help for the info command. Use the L key to go back to the finger

    information.

    __ 11. End the info command.

    __ 12. Read the info documentation of the info command. Use the menu by using the Taband M keys.

    __ 13. info has a nice built-in tutorial. If you have spare time during this course, look at the

    tutorial to see some of the advanced features of info.

  • 8/7/2019 Exercicios en Linux

    43/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 6. Linux Documentation 6-3

    5.1

    Xempty Other Documentation

    __ 14. Make a listing of all directories in the /usr/share/doc directory. Browse some of these

    directories to see what sort of information is available.

    __ 15. If the classroom systems have an Internet connection, then take a look at thehttp://www.tldp.org Web site. This is the main documentation Web site for Linux.

    Note that in some classrooms, some additional configuration of your Web browsermight be needed because the classroom is behind a socks or proxy-based firewall.In this case, your instructor gives you additional instructions.

    End of exercise

  • 8/7/2019 Exercicios en Linux

    44/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    6-4 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise Instructions with Hints

    Man Pages

    __ 1. If you are not already logged on, log in as tux1 at tty1.

    Login: tux1

    Password: penguin1 (the password does not appear on the screen)

    __ 2. Display the man pages for the man command. Read the text that follows to obtain a

    better understanding of the functionality of the man command.

    $ man man

    __ 3. Search for the string PAGER in the manual page of the man command.

    /PAGER

    __ 4. Use the Q key to end the man command. q

    __ 5. Display the man page of the ls command. Move though the manual pages:

    Go to the last page.

    Go to the previous page.

    Go to the first page.

    Type these commands while looking at the man page of ls.

    $ man ls

    Go to last page: G

    Go to previous page: b

    Go to first page: 1G

    __ 6. Close the man command.

    q

    __ 7. Find out which manual pages all deal with passwd. Then view each page, giving thecorrect section number.

    Note

    If the man -k or apropos commands do not work, then you need to run the

    makewhatis command as root. Normally, the makewhatis command is executed

    each night automatically, but because your system is freshly installed, this mightnot have happened yet.

  • 8/7/2019 Exercicios en Linux

    45/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 6. Linux Documentation 6-5

    5.1

    Xempty $ man -k passwd or apropos passwd

    $ man 1 passwd

    $ man 5 passwd

    Info command

    __ 8. View the info documentation for the finger command. Are you actually reading infodocumentation now?

    $ info finger

    No. Look at the upper left corner of your screen. It says *manpages*, whichmeans that there is no info documentation for finger. If info cannot locate the

    correct info document, it locates and displays its manual page. If there is nomanual page, info shows the top node.

    __ 9. Move through this page by using the Space and Backspace keys.

    shows the next page of information

    show the previous page

    __ 10. Read the help for the info command. Use the key to go back to the finger

    information.

    To enter help, type ?

    To quit the help, type l.

    __ 11. End the info command.

    q

    __ 12. Read the info documentation of the info command. Use the menu by using the Tab

    and M keys.

    info info

    m

    q

    __ 13. info has a nice built-in tutorial. If you have spare time during this course, look at thetutorial to see some of the advanced features of info.

    Start the tutorial with the info command.

    $ info

    q

  • 8/7/2019 Exercicios en Linux

    46/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    6-6 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Other Documentation

    __ 14. Make a listing of all directories in the /usr/share/doc directory. Browse some of these

    directories to see what sort of information is available.

    $ cd /usr/share/doc

    $ ls

    Browse some directories and see what documentation is available.

    $ cd

    __ 15. If the classroom systems have an Internet connection, then take a look at the

    http://www.tldp.org Web site. This is the main documentation Web site for Linux.

    Note that in some classrooms some additional configuration of your Web browsermight be needed because the classroom is behind a socks or proxy-based firewall.

    In this case, your instructor gives you additional instructions.

    End of exercise

  • 8/7/2019 Exercicios en Linux

    47/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 7. Editing Files 7-1

    5.1

    Xempty Exercise 7. Editing Files

    What this exercise is about

    The purpose of this exercise is to give the students the opportunity to

    create and edit files using the most common UNIX editor, vi, and to tryout a number of other editors that might be available.

    What you should be able to do

    At the end of the lab, you should be able to:

    Use vi to create and edit files List a few other editors that are available on your system

  • 8/7/2019 Exercicios en Linux

    48/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    7-2 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise Instructions

    Working with vi

    __ 1. If you aren't already logged in as tux1 at tty1, log in now.

    __ 2. Ensure that you are in your home directory. Create a file in your home directory

    named vitest using vi.

    Type the following text and the marine alphabet into the vitest file. Adding the

    alphabet is an easy way to fill a couple of screens of information needed for lateruse. This is a training session about the usage of the vi editor. We need some more

    lines to learn the most common commands of the editor.

    a alpha

    b bravo

    c charlie

    (the rest of the marine alphabet)x x-ray

    y yankee

    z zulu

    __ 3. Return to command mode. Write and quit the file. Notice that as soon as you pressthe colon (:), it appears below the last line of your input area. When the buffer is

    empty and the file is closed, you see a message giving the number of lines andcharacters in the file.

    Cursor Movement Keys__ 4. Open vitest file again. Notice that the bottom line of the screen indicates the name

    of the file and number of characters.

    __ 5. Using the H,J, K, and L keys, practice moving the through the file.

    __ 6. Use the appropriate vi commands to move through the text:

    Move forward one page.

    Move back one page.

    Move the cursor to the first line on the screen.

    Move the cursor to the last line in the file.

    Move the cursor to the first line in the file.

    Move the cursor to line 5 of the file.

    Move the cursor to the end of the line.

    Move the cursor to the beginning of the line.

    __ 7. Change the file vitest so that after each letter of the alphabet a common first name is

    added that starts with that letter. Make sure you use different methods for switchingfrom command mode to insert mode.

  • 8/7/2019 Exercicios en Linux

    49/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 7. Editing Files 7-3

    5.1

    Xempty __ 8. Practice some more with all the commands that are listed on your cheat sheet.

    __ 9. Save the file but do not exit vi.

    Using set to Customize the Editing Session

    __ 10. Turn online numbering and set your tab stop to 4.

    Global search and replace

    __ 11. Replace all spaces in your file with tabs.

    __ 12. Save your file.

    Working with other editors

    __ 13. Your system has various other text mode and graphical editors available as well.

    Start some of these to get acquainted with them.

    Note

    All editors listed in the course material might not be available or installed on your

    distribution.

    End of exercise

  • 8/7/2019 Exercicios en Linux

    50/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    7-4 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise Instructions with Hints

    Working with vi

    __ 1. If you aren't already logged in as tux1 at tty1, log in now.

    Login: tux1

    Password: penguin1

    __ 2. Ensure that you are in your home directory. Create a file in your home directory

    named vitest using vi.

    Type the following text and the marine alphabet into the vitest file. Adding thealphabet is an easy way to fill a couple of screens of information needed for later

    use. This is a training session about the usage of the vi editor. We need some morelines to learn the most common commands of the editor.

    a alphab bravo

    c charlie

    ...

    (the rest of the marine alphabet)

    x x-ray

    y yankee

    z zulu

    $ cd

    $ pwd

    $ vi vitest

    First type an I to enter input mode. Remember that vi starts in command mode.

    Then type the contents of the file.

    __ 3. Return to command mode. Write and quit the file. Notice that as soon as you press

    the colon (:), it appears below the last line of your input area. When the buffer isempty and the file is closed, you see a message giving the number of lines and

    characters in the file.

    Use the Esc key to go from input mode to command mode.

    Saving the file and closing vi can be done with one of these commands:

    :wq or :x or ZZ

  • 8/7/2019 Exercicios en Linux

    51/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 7. Editing Files 7-5

    5.1

    Xempty Cursor Movement Keys

    __ 4. Open vitest file again. Notice that the bottom line of the screen indicates the name

    of the file and number of characters.

    $ vi vitest

    __ 5. Using the H, J, K, and L keys, practice moving the through the file.

    j down one line

    k up one line

    h left one character

    l right one character

    __ 6. Use the appropriate vi commands to move through the text:

    Move forward one page.

    Move back one page.

    Move the cursor to the first line on the screen. Move the cursor to the last line in the file.

    Move the cursor to the first line in the file.

    Move the cursor to line 5 of the file.

    Move the cursor to the end of the line.

    Move the cursor to the beginning of the line.

    Ctrl+F - Move forward one page.

    Ctrl+B - Move back one page.

    H - Move the cursor to the first line on the screen.

    G - Move cursor to last line in the file.

    1G or :1 and Enter - Move cursor to first line in file.

    5G or :5 and Enter - Move cursor to line 5.

    $ - Move cursor to end of line.

    0 (zero) or n- Move cursor to beginning of line.

    __ 7. Change the file vitest so that after each letter of the alphabet a common first name is

    added that starts with that letter. Make sure you use different methods for switchingfrom command mode to insert mode.

    Use vi commands to add the words. Be sure to try the i, I, a, and A commands.

    The file should look like this afterwards:

    a alpha Arnold

    b bravo Brad

    c charlie Charles

    ...

    __ 8. Practice some more with all the commands that are listed on your cheat sheet.

  • 8/7/2019 Exercicios en Linux

    52/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    7-6 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    __ 9. Save the file but do not exit vi.

    :w

    Using set to Customize the Editing Session

    __ 10. Turn online numbering and set your tab stop to 4.

    :set number

    :set tabstop=4

    Global search and replace

    __ 11. Replace all spaces in your file with tabs.

    :%s/ //g

    (where is the Tab key. This shows up as ^I when you type it.)

    Hint

    colon percent s slash space slash slash g )

    __ 12. Save your file.

    :wq

    - OR -

    :x- OR -

    ZZ

    Working with other editors

    __ 13. Your system has various other text mode and graphical editors available as well.

    Start some of these to get acquainted with them.

    Note

    All editors listed in the course material might not be available or installed on your

    distribution.

    $ pico vitest

    $ mcedit vitest

    $ hexedit vitest

  • 8/7/2019 Exercicios en Linux

    53/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 7. Editing Files 7-7

    5.1

    Xempty

    $ gedit vitest

    $ kedit vitest

    End of exercise

  • 8/7/2019 Exercicios en Linux

    54/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    7-8 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

  • 8/7/2019 Exercicios en Linux

    55/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 8. Shell Basics 8-1

    5.1

    Xempty Exercise 8. Shell Basics

    What this exercise is about

    This exercise provides an opportunity to get to know the basic features

    of the Linux shell (bash).

    What you should be able to do

    At the end of the lab, you should be able to:

    Use wildcards for file name expansion

    Redirect standard in, standard out, and standard error Use pipes to provide the output of one process as input to another

    process

    Perform command grouping and line continuation

  • 8/7/2019 Exercicios en Linux

    56/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    8-2 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise Instructions

    Wildcards

    __ 1. If you are not logged in as tux1 at tty1, log in now.

    __ 2. Go to the /etc directory and make a list of all files here.

    __ 3. Use ls with wildcards to list file names:

    That end with conf

    That begin with a d or D

    That contain an o in the fifth position

    That contain the word tab (in any combination with capitals and lowercase

    characters)

    That end with a number

    That do not end with a number

    (Note that wildcard expansion is done by the shell. If one of the filenames that

    matches is a directory name, then ls by default lists the contents of that directory,instead of the filename itself. To prevent this, use the -d option.)

    __ 4. What happens if you execute the command ls -d ?[!y]*[e-g]? What would the

    shortest filename be that can match? Execute this command to verify your answer.

    __ 5. Return to your home directory.

    Redirection

    __ 6. Use the cat command and redirection to create a file called junk containing a few

    lines of text. When you have typed a few lines, end your input to the cat commandand return to the shell prompt. Then view the contents of the file you just created.

    __ 7. Append more lines to the junk file using redirection. Then view the contents of thefile junk and check if all the lines you saved in this file are there.

    Pipes, Tees, and Filters

    __ 8. Count the number of files in your current directory. Use a pipe, do not count the files

    manually.

    __ 9. Does ls > tempfile ; wc -l tempfile ; rm tempfile do the same thing as the pipe youmade in the previous command? Why or why not?

    __ 10. Use the ls command and save the output in a file called tempfile2 before you count

    the files.

    __ 11. Use the sed command to alter the output of the ls -l /etc/ command so that it lookslike you own all files in /etc. Execute this both with and without the globaloption.

    What is the difference?

  • 8/7/2019 Exercicios en Linux

    57/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 8. Shell Basics 8-3

    5.1

    Xempty __ 12. Use the awk command to display the first and ninth column of the output of the ls -l

    /etc/ command.

    __ 13. Use the tac command to display the output of the ls command in reverse order.

    __ 14. Use the nl command to number the lines of tempfile.

    __ 15. Use the pr command to format tempfile for the printer.

    __ 16. Combine all usersfile parts from exercise 4 into one big file, called usersfile5. Checkto see if this file is identical to the original usersfile.

    Command Grouping

    __ 17. On the same command line, display the current system date and all the users that

    are logged in, together with some explaining comments, and save all this to one fileafter numbering the lines. Check your output.

    Process Environment

    __ 18. Display all your variables that are defined in your current process environment. Also

    display all variables that are currently exported.

    __ 19. Create a variable x and set its value to 10. Check the value of the variable. Again,

    display all your current variables.

    __ 20. Create a subshell. Check to see what value variable x holds in the subshell. What isthe value of x? _______ List the subshell's current variables. Do you see a listing for

    x? _______

    __ 21. Set the value of x to 500 and go back to your parent process. What is the current

    value of x? _______ Why?_______

    __ 22. Make sure that child processes inherit the variable x. Verify this by creating asubshell and checking the value of variable x. After this, exit your subshell.

    End of exercise

  • 8/7/2019 Exercicios en Linux

    58/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    8-4 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise Instructions With Hints

    Wildcards

    __ 1. If you are not logged in as tux1 at tty1, log in now.

    Login: tux1

    Password: penguin1 (the password does not appear on the screen)

    __ 2. Go to the /etc directory and make a list of all files here.

    $ cd /etc

    $ ls

    __ 3. Use ls with wildcards to list file names:

    that end with conf

    that begin with a d or D that contain an o in the fifth position

    that contain the word tab (in any combination with capitals and lowercasecharacters)

    that end with a number

    that do not end with a number

    (Note that wildcard expansion is done by the shell. If one of the filenames thatmatches is a directory name, then ls by default lists the contents of that directory,

    instead of the filename itself. To prevent this, use the -d option.)

    $ ls -d *conf $ ls -d [dD]*

    $ ls -d ????o*

    $ ls -d *[tT][aA][bB]*

    $ ls -d *[0-9]

    $ ls -d *[!0-9]

    __ 4. What happens if you execute the command ls -d ?[!y]*[e-g]? What would the

    shortest filename be that can match? Execute this command to verify your answer.

    $ ls -d ?[!y]*[e-g]

    __ 5. Return to your home directory.

    $ cd

  • 8/7/2019 Exercicios en Linux

    59/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 8. Shell Basics 8-5

    5.1

    Xempty Redirection

    __ 6. Use the cat command and redirection to create a file called junk containing a few

    lines of text. When you have typed a few lines, end your input to the cat commandand return to the shell prompt. Then view the contents of the file you just created.

    $ cat > junk

    Type some lines of information

    (At the beginning of a new line)

    $ cat junk

    __ 7. Append more lines to the junk file using redirection. Then view the contents of thefile junk and check if all the lines you saved in this file are there.

    $ cat >> junk

    Type some lines of information

    (At the beginning of a new line) $ cat junk

    Pipes, Tees, and Filters

    __ 8. Count the number of files in your current directory. Use a pipe, do not count the files

    manually.

    $ ls | wc -l

    __ 9. Does ls > tempfile ; wc -l tempfile ; rm tempfile do the same thing as the pipe you

    made in the previous command? Why or why not? Almost, but it counts tempfile too; so it counts one file too many.

    $ ls > tempfile

    $ more tempfile

    __ 10. Use the ls command and save the output in a file called tempfile2 before you countthe files.

    $ ls | tee tempfile2 | wc -l

    __ 11. Use the sed command to alter the output of the ls -l /etc/ command so that it looks

    like you own all files in /etc. Execute this both with and without the globaloption.What is the difference?

    $ ls -l /etc | sed s/root/tux1/

    $ ls -l /etc | sed s/root/tux1/g

  • 8/7/2019 Exercicios en Linux

    60/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    8-6 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    __ 12. Use the awk command to display the first and ninth column of the output of the ls -l

    /etc/ command.

    $ ls -l /etc | awk '{print $1 " " $9}'

    Note

    The $9 needs to be $8 in SLES.

    __ 13. Use the tac command to display the output of the ls command in reverse order.

    $ ls | tac

    __ 14. Use the nl command to number the lines of tempfile.

    $ nl tempfile

    __ 15. Use the pr command to format tempfile for the printer.

    $ pr tempfile

    __ 16. Combine all usersfile parts from Exercise 4 into one big file, called usersfile5. Check

    to see if this file is identical to the original usersfile.

    $ su - -where is your username

    $ cat usersfile* > usersfile5

    $ diff usersfile usersfile5

    Command Grouping

    __ 17. On the same command line, display the current system date and all the users thatare logged in, together with some explaining comments, and save all this to one file

    after numbering the lines. Check your output.

    $ ( date ; who ) | nl > users

    $ cat users

    Process Environment

    __ 18. Display all your variables that are defined in your current process environment. Alsodisplay all variables that are currently exported.

    $ set | less

    $ env | less

    __ 19. Create a variable x and set its value to 10. Check the value of the variable. Again,display all your current variables.

    $ x=10

  • 8/7/2019 Exercicios en Linux

    61/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 8. Shell Basics 8-7

    5.1

    Xempty $ echo $x

    $ set | less

    $ env | less

    __ 20. Create a subshell. Check to see what value variable x holds in the subshell. What is

    the value of x? _______ List the subshell's current variables. Do you see a listing for

    x? _______ $ bash

    $ echo $x

    You should see no output, only an empty line.

    $ set | less

    You should not see a listing for x.

    __ 21. Set the value of x to 500 and go back to your parent process. What is the currentvalue of x? _______ Why?_______

    $ x=500

    $ exit

    $ echo $x

    __ 22. Make sure that child processes inherit the variable x. Verify this by creating a

    subshell and checking the value of variable x. After this, exit your subshell.

    $ export x

    $ env | less

    $ bash

    $ echo $x

    $ exit

    End of exercise

  • 8/7/2019 Exercicios en Linux

    62/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    8-8 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

  • 8/7/2019 Exercicios en Linux

    63/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 9. Working with Processes 9-1

    5.1

    Xempty Exercise 9. Working with Processes

    What this exercise is about

    This exercise familiarizes the students with process manipulation and

    process control.

    What you should be able to do

    At the end of the lab, you should be able to:

    Monitor processes

    Change and understand the process environment Control jobs

    Terminate processes

  • 8/7/2019 Exercicios en Linux

    64/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    9-2 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise Instructions

    Listing Processes

    __ 1. Log in at tty1 as tux1.

    __ 2. Check the PID of your log in environment and then create a subshell by entering

    bash. What is the process ID of the subshell? Is it different from your login process?

    ________________________________________________________________

    ________________________________________________________________

    __ 3. Enter the command ls -R / >outfile 2>/dev/null & and then show the processes thatyou are running in the system. Which processes are running?

    Note

    This command is explained in full in the next units.

    ________________________________________________________________

    ________________________________________________________________

    __ 4. While the ls command is still running, run the pstree command. (It might benecessary to restart the ls command.)

    __ 5. Log in as tux2 on tty2 and run vi tux2_file.

    __ 6. Go back to tty1 and show all the processes in your system. If necessary, look in the

    man pages and info to find the correct options to show all processes running in yoursystem.

    Look for your own processes as well as the processes of tux2.

    __ 7. Again run the ls -R / >outfile 2>/dev/null & command and then exit your currentprocess. List the processes you are running. What happens to processes if you kill

    their parent process?

    ________________________________________________________________

    Job Control__ 8. Using vi or another editor, create the file named myclock in your bin directory with

    the following contents:

    while true

    do

    date

    sleep 10

  • 8/7/2019 Exercicios en Linux

    65/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 9. Working with Processes 9-3

    5.1

    Xempty done

    Make the script executable.

    __ 9. Run the script myclock. Run this script in the foreground.

    __ 10. Suspend the job you just started.

    __ 11. List all the jobs that you are running on the system and restart the above job in the

    background.

    __ 12. List all users that are logged in. Bring the job back to the foreground, wait until youget a timestamp, and then exit the job.

    Terminating a Process

    __ 13. Execute the myclock script again, this time in the background. Hint: Take note of

    the PID.

    __ 14. List all your processes and kill the sleep process. What happened?

    __ 15. Now stop the shell script myclock.

    End of exercise

  • 8/7/2019 Exercicios en Linux

    66/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    9-4 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    Exercise Instructions with Hints

    Listing Processes

    __ 1. Log in at tty1 as tux1.

    Login: tux1

    Password: penguin1 (The password does not appear on screen)

    __ 2. Check the PID of your log in environment and then create a subshell by entering

    bash. What is the process ID of the subshell? Is it different from your login process?

    ________________________________________________________________

    ________________________________________________________________

    $ echo $$

    $ bash $ echo $$

    Yes, all processes in your system have a unique process ID (PID). So the PID of

    your login shell and your subshell have to be different. If they are equal you reallyhave a problem ;-).

    $ exit

    __ 3. Enter the command ls -R / >outfile 2>/dev/null & and then show the processes that

    you are running in the system. Which processes are running?

    Note

    This command is explained in full in the next units.

    ________________________________________________________________

    ________________________________________________________________

    $ ls -R / > outfile 2>/dev/null &

    $ ps

    - OR -

    $ ps -ef (for more information about your processes)

    __ 4. While the ls command is still running, run the pstree command. (It might be

    necessary to restart the ls command.)

    $ pstree

  • 8/7/2019 Exercicios en Linux

    67/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 9. Working with Processes 9-5

    5.1

    Xempty __ 5. Log in as tux2 on tty2 and run vi tux2_file.

    Login: tux2

    Password: penguin2 (the password does not appear on the screen)

    $ vi tux2_file

    __ 6. Go back to tty1 and show all the processes in your system. If necessary, look in the

    man pages and info to find the correct options to show all processes running in yoursystem.

    Look for your own processes as well as the processes of tux2.

    $ ps -ef | less

    __ 7. Again run the ls -R / >outfile 2>/dev/null & command and then exit your currentprocess. List the processes you are running. What happens to processes if you kill

    their parent process?

    ________________________________________________________________

    $ ls -R / >outfile 2>/dev/null &

    $ exit

    Login: tux1

    Password: penguin1

    $ ps -ef

    $ pstree

    If the parent process dies, the child processes are transferred to a new parent

    process, init.

    Job Control

    __ 8. Using vi or another editor, create the file named myclock in your bin directory withthe following contents:

    while true

    dodate

    sleep 10

    done

    Make the script executable.

    $ cd ~/bin

    $ vi myclock

  • 8/7/2019 Exercicios en Linux

    68/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    9-6 Linux Basic and Installation Copyright IBM Corp. 2001, 2008

    $ chmod +x myclock

    __ 9. Run the script myclock. Run this script in the foreground.

    $ myclock

    __ 10. Suspend the job you just started.

    __ 11. List all the jobs that you are running on the system and restart the above job in the

    background.

    $ jobs

    $ bg %1

    __ 12. List all users that are logged in. Bring the job back to the foreground, wait until youget a timestamp, and then exit the job.

    $ who

    $ fg %1

    Terminating a Process

    __ 13. Execute the myclock script again, this time in the background. Hint: Take note ofthe PID.

    $ myclock &

    __ 14. List all your processes and kill the sleep process. What happened?

    $ ps

    $ kill

    where is the process ID of the sleep command.

    You received a new timestamp immediately after the kill command ran.

    myclock is a shell script that displays a timestamp every 10 seconds. When youkill the sleep process, there is no process to wait for. The script continues and

    shows you another timestamp.

    Killing processes started from a shell script does not kill the shell script itself.

    __ 15. Now stop the shell script myclock.

    $ kill

    where is the process ID of the process that runs the myclock script

  • 8/7/2019 Exercicios en Linux

    69/122

    Student Exercises

    Course materials may not be reproduced in whole or in part

    without the prior written permission of IBM.

    Copyright IBM Corp. 2001, 2008 Exercise 9. Working with Processes 9-7

    5.1

    XemptyHint

    Look for a second instance of bash.

    - or -

    $ k