• Aucun résultat trouvé

Options Used with renice

Dans le document Practice on state- of-the-art test- (Page 115-122)

Option Use

-g Specifies the priority for processes executed by members of the specified group.

-u Specifies the priority level for processes executed by the specified user.

-p Specifies the priority level for the specified process.

An example of the use of this command to set the priority level for a process cur-rently running on the system is as follows.

# renice 10 -p 408

408: old priority 0, new priority Objective

Key Point Summary

This chapter introduces you to many of the functions and configuration options for the shell environment. Many key points here serve as a basis for the rest of the material in the book.

✦The default shell used on Linux systems is the bash shell (Bourne-Again Shell).

✦This shell can be changed by the user. However, scripts must be written for the specific shell that is being run, so changing shells should be done with caution.

✦The bash shell allows multiple commands to be entered on one line when sep-arated with a semicolon (;). Commands can span multiple lines when using the backslash key followed by Enter.

✦Commands can be automatically completed using the Tab key.

✦The Readline Library allows commands to be edited at the command line using the emacseditor. This capability can be changed to use the vieditor.

✦Command substitution is used to replace a command with its output.

✦The command history is stored in the ~/.bash_historyfile. The number of entries stored here is configured using the HISTSIZEvariable. This file allows you to view and edit previously entered commands.

✦The fccommand allows you to edit entries in the history file from the default editor. Multiple entries can be edited at once.

✦Environment variables and settings in the /etc/profileand /etc/bashrc file set configuration parameters for the entire system. If a user wishes to overwrite these settings with specific user settings, the files ~/.profileand

~/.bashrcare used.

✦The PATHvariable contains a listing of directories to search for commands that are entered at the command line.

✦The initpath is used by programs started from the /etc/inittab file.

✦The shell prompt can be configured to display a variety of information such as pwd, hostname, and user name.

✦The HOMEvariable stores the user’s home directory. This variable is useful for scripts which work with this directory.

✦The pscommand provides a snapshot of the process status on the system.

✦The topcommand provides real-time information on processes.

✦The killcommand is used to terminate processes.

✦Processes can be run in the background using the &symbol and bgcommand.

✦Processes in the foreground can be halted using the ^Zcommand.

✦Processes can be moved to the foreground using the fgcommand.

✦The nicecommand is used to set a process priority when the process is started.

✦The renicecommand is used to change the priority of processes already run-ning on the system.

✦ ✦ ✦

STUDY GUIDE

The following questions and exercises enable you to review the information cov-ered in this chapter. Take your time when completing this section of the chapter, carefully reviewing any questions that you may have. Answering the question cor-rectly is not as important as understanding the answer, so review any material that you might still be unsure of. Being comfortable with the questions and answers pre-sented here will help you be more prepared for the certification exam questions.

Assessment Questions

1.Which shell is the default shell used on Linux systems?

A.csh B.rsh C.bash D.tcsh

2.Which file contains the available shells for the system?

A./etc/passwd B./etc/command C./etc/bash D./etc/shells

3.Which command is used to change the default shell to the Bourne-Again Shell version 2?

A.chng -s /bin/bash2 B.chsh -s /bin/bash2 C.shell -c /bin/bash2 D.default -shell /bin/bash2

4.What is not a correct format for entering commands at the command line?

A.command

B.command options

C.command arguments options D.command options arguments

5.Multiple commands can be entered on the same command line when sepa-rated by which character?

A.. B.; C., D.\

6.Which key combination is used to allow a command to span multiple lines?

A.“”

B.\Enter C./Enter D.Tab-Enter

7.Which key, when pressed once, is used to provide command completion at the command line?

A.Tab B.Esc C.Enter D.Ctrl

8.Which key, when pressed twice, is used to provide command completion at the command line?

A.Tab B.Esc C.Enter D.Ctrl

9.The Readline Library uses which editor to provide command-line editing?

A.pico B.vi C.emacs D.edit

10.Keyboard bindings can be viewed using which command?

A.bind -keys B.bind -v C.display -keys D.display -v

11.Which file contains the system-wide variables on a system with a bash shell?

A./bash B./bin/bash C./etc/bash D./etc/profile

12._______________would run a script called update_mozillastored in your home directory, from that directory.

13.When making changes to an environment variable what command must you use to ensure that those changes are available to the shell?

A.save B.remember C.export D.echo

14.Which environment variable is used to customize the shell prompt?

A.PS1 B.prompt C.shell D.display

15.Which file contains the assignment of user’s home directories?

A./etc/home B./etc/profile C./etc/passwd D./etc/users

16.Which command displays a listing of previously entered commands?

A.commands B.review C.history D.export

17.Which key allows you to view the last command entered?

A.down arrow B.up arrow C.right arrow D.left arrow

18.Which command allows you to use the default editor to edit several com-mands from the history file?

A.history B.edit C.fc D.view

19.It is possible to run commands that are not located in a directory listed in the PATHif you know the full path and command name.

A.True B.False

20.The ___________ command is used to view a snapshot of the processes run-ning on a system.

21.Which of the following is used to end the 408 process without allowing it to exit gracefully?

A.kill 408 B.kill –15 408 C.kill –1 408 D.kill –9 408

22.The _______ command runs the netscapeprocess in the background.

23.Which command is used to set the priority of a process when it is started?

A.jobs B.renice C.nice D.top

Scenarios

1.You have several scripts stored in a directory named maintenancelocated inside of your home directory. You wish to run these scripts from various locations on the system without entering the full path. How can you accom-plish this?

2.You’ve noticed that several of your users have changed their default shells and your scripts no longer work. What can you do to prevent this from hap-pening in the future?

Dans le document Practice on state- of-the-art test- (Page 115-122)

Documents relatifs