» Linux » Examen sur Linux » Examen 201 : Advanced Administration » Section 1 » Question 10/20
10.You telnet into several of your servers simultaneously. During the day, you sometimes get confused as to which telnet session is connected to which server. Which of the following commands in your .profile would make it obvious to which server you are attached?

PS1='\h: \w>'
PS1='\s: \W>'
PS1='\!: \t>'
PS1='\a: \n>'

Explanation: The PS1 environment variable controls the prompt on the command line, and can be used by users to tell what system they are on, the directory they are currently in, the current date and more depending on how this variable is configured. The \h option is used to specify the hostname and the \w option will give the full path of the current working directory.

Reference: http://ctdp.tripod.com/os/linux/tips/tipsps1.html

Incorrect Answers:
B: The \s option is used to display the shell name. This won't give any indication of which machine you are connected to.
C: The \ option is used to display the history number of the current command. This won't give any indication of which machine you are connected to.
D: The \a option is used to display a new line. This won't give any indication of which machine you are connected to.

« Question 9 Question 11 »