1.
What does the command "foo < bar | foobar" do?
Correct Answer
A. Foo reads bar as stdin, pipes output to foobar
Explanation
Common Redirection Operators
Command >file : Redirects standard output of command into the file
Command>>file : Append the standard output of command into the file
Commandfile : Redirects the standard Error into the file
And Pipe (|) is used to combine the command, in piping outout of first command goes as
input to the second command.
Answer A is correct because foo command takes input from the bar file and sends the
standard output to foobar command.
2.
In the command 'test < bill | Certkiller '.
Correct Answer
D. The command Certkiller receives its stdin from the stdout of test.
Explanation
Common Redirection Operators
Command >file : Redirects standard output of command into the file
Command>>file : Append the standard output of command into the file
Commandfile : Redirects the standard Error into the file
And Pipe (|) is used to combine the command, in piping outout of first command goes as
input to the second command.
Answer D is correct because test command takes input from the Bill file and sends the
standard output to Certkiller command.
3.
You are writing a script to automate some tasks. You would like to be able to have alog of everything that you see printed to your console, yet you want to be able to seethe output on the console as well.What textutils command would typically be used to accomplish this?
Correct Answer
tee
Explanation
tee command redirect output to a file while still piping it to another
program.
Example: set | tee set.out | less : In example, output from set is written to file set.out
while also being piped to less.
4.
You need to have all the output from the executable myprog written to a text lognamed file1.out. This program must not send any output to the console. Which ofthe commands listed will accomplish this?
Correct Answer
A. Myprog > file1.out 2>&1
Explanation
Common Redirection Operators
Command >file : Redirects standard output of command into the file
Command>>file : Append the standard output of command into the file
Commandfile : Redirects the standard Error into the file
And Pipe (|) is used to combine the command, in piping outout of first command goes as
input to the second command.
When we executes the command it generates the standard output as well as standard error
and displays in standard output (Terminal Window) is default. When we redirect the
standard error as well as standard output into the file, it will not send any output into the
terminal window.
myprog >file1.out 2>&1 : Where & works as a Logical AND Operator.
5.
What command can be used to print out system boot messages?
Correct Answer
D. Dmesg
Explanation
dmesg command prints the boot messages, you can check which
devices are detected by your kernel or not from the boot log messages.
6.
What is the result of the following command?command > file1.out 2>&1
Correct Answer
B. Redirects the stderr to the same location as the stdout.
Explanation
Common Redirection Operators
Command >file : Redirects standard output of command into the file
Command>>file : Append the standard output of command into the file
Commandfile : Redirects the standard Error into the file
And Pipe (|) is used to combine the command, in piping outout of first command goes as
input to the second command.
When we executes the command it generates the standard output as well as standard error
and displays in standard output (Terminal Window) is default. When we redirect the
standard error as well as standard output into the file, it will not send any output into the
terminal window.
7.
You set a variable's value with the command "export TEST=snuffy" and then after executing the following script file, you type the command "echo $TEST". scriptfile1 #!/bin/bash USER=certkiller TEST=$USER What is the variable's value that is returned?
Correct Answer
A. Snuffy
Explanation
Export sets the shell variable named TEST to snuffy.
8.
You wish to send the output of a command to standard output (stdout) and save it toa file. The command to use is ______________. (Do not specify arguments)
Correct Answer
tee
Explanation
I want to show you one example, set | tee set.out | less. Here set
command generates the output and gives as an input to tee command. tee command
saves the output of set into set.out as well piping the output to less.
9.
In order to append the output of ls to a file called result, which of the following commandlines would you use?
Correct Answer
D. Ls >> result
Explanation
> will save the output to result
>> will append the output to result
>& will copy the output to result
10.
What syslog.conf facility represents the cron daemon?
Correct Answer
C. Cron
Explanation
You can see in /etc/syslog :
Cron.* /var/log/cron
This line represents that cron related all log messages will write into /var/log/cron file.
11.
What syslog.conf facility represents kernel processes?
Correct Answer
D. Kern
Explanation
kern facility represents the kernel processes, in first line of
/etc/syslog.conf file, you can see kern.* /dev/console, this means all kernel related log
messages will send to /dev/console.
12.
What syslog.conf facility represents Unix to Unix copy?
Correct Answer
C. Uucp
Explanation
Facility in /etc/syslog.conf can be auth, authpriv, cron, daemon, kern,
lpr, mail, mark, news, security, syslog, user, uucp and local0. Where uucp facility
represents Unix to Unix copy.
13.
What syslog.conf facility represents user authentication processes?
Correct Answer
A. Auth
Explanation
auth facility represents the user authentication processes, and
authentication related logs will send to /var/log/secure.
14.
What syslog.conf facility represents user processes?
Correct Answer
C. User
Explanation
user facility represents the user processes Example:
User.* /var/log/userlogs : It sends all user processes logs into /var/log/userlogs file
15.
What syslog.conf facility is used to create timestamps in log files?
Correct Answer
A. Mark
Explanation
You can see the timestamps on every log files this timestamps is
genereated by mark facility.
16.
What is the name of the configuration file used by the syslog daemon?
Correct Answer
A. Syslog.conf
Explanation
/etc/syslog.conf is the main log configuration file reads by syslogd
service. Which logs system messages on unix system.
17.
What syslog.conf facility represents login processes?
Correct Answer
D. Auth
Explanation
auth is the facility which represents the login processes. Either local
login or remote login, auth facilitiy traps the logs and writes into /var/log/secure file.
18.
What syslog.conf facility represents the line printer?
Correct Answer
C. Lpr
Explanation
Facility in /etc/syslog.conf can be auth, authpriv, cron, daemon, kern,
lpr, mail, mark, news, security, syslog, user, uucp and local0. Where lpr is the
facility for line printer.
19.
What daemon controls the syslog?
Correct Answer
B. Syslogd
Explanation
Syslogd provides two system utilities which provide support for system
logging and kernel message trapping. Support of both internet and unix domain
sockets enables this utility packages to support both local and remote logging.
20.
What syslog.conf facility represents mail processes?
Correct Answer
C. Mail
Explanation
Facility in /etc/syslog.conf can be auth, authpriv, cron, daemon, kern,
lpr, mail, mark, news, security, syslog, user, uucp and local0. Where mail facility
represents the mail processes . By default mail logs are send to /var/log/maillog file.
21.
What syslog.conf facility represents user processes?
Correct Answer
C. User
Explanation
user facility represents the user processes Example:
User.* /var/log/userlogs : It sends all user processes logs into /var/log/userlogs file
22.
What syslog.conf facility represents httpd processes?
Correct Answer
B. Daemon
Explanation
daemon facility represent the httpd processes.
23.
Which of the following syslog.conf entries would cause kernel error messages to besent to the system console?
Correct Answer
C. Kern.warning /dev/console
Explanation
/etc/syslog.conf is the syslog configuration file, where we specified the
facility and priority to send the facility related log messages to specified file.
kernel.warning /dev/console : this line sends the warning related to kernel into
/dev/console.
24.
Which of the following syslog.conf entries would cause kernel warning messages tobe sent to the system console?
Correct Answer
B. Kern.warning /dev/console
Explanation
/etc/syslog.conf is the syslog configuration file, where we specified the
facility and priority to send the facility related log messages to specified file.
kernel.warning /dev/console : this line sends the warning related to kernel into
/dev/console.
25.
Which of the following syslog.conf entries would cause mail error messages to be sent to the system console?
Correct Answer
B. Mail.err /dev/console
Explanation
Syntax of /etc/syslog.conf is :
facility.priority : Where facility represents facility of service and priority represents the
level of logs to store eg, info, err, emerg etc.
26.
What syslog.conf facility represents Usenet news?
Correct Answer
B. News
Explanation
news represents Usenet news example:
Uucp,news.crit /var/log/spooler This line represents the logs of news to redirect into the
/var/log/spooler log files.
27.
You have just added the following line to your syslog.conf file: lpr.info /dev/console. But, line printer messages are not being sent to the console. What is most likely the problem?
Correct Answer
A. After modifying the syslog.conf file, the syslog daemon needs to be restarted.
Explanation
syslog is the daemon, which reads /etc/syslog.conf configuration file.
After changing the configuration of syslog.conf you should restart the syslog service.
# service syslog restart
28.
What syslog.conf facility represents miscellaneous daemons?
Correct Answer
D. Daemon
Explanation
daemon facility represents the miscellaneous daemons like httpd,
vsftpd etc
29.
What will the command "kill -HUP 1354" do?
Correct Answer
C. Restart the process 1354, re-reading it's config files
Explanation
kill command is used to terminate the processes by default it sends the
TERM signal. When you send the -HUP signal, it will restart the process by reading
the original configuration file.
30.
To keep a process running after you logged out, you start it with the command:
Correct Answer
A. Nohup
Explanation
nohup : run a command immune to hang-ups, with output to a
non-tty, to keep the process running after you logged out.
31.
What will the command "kill -HUP 1354" do?
Correct Answer
C. Restart the process 1354, re-reading it's config files
Explanation
kill command is used to terminate the processes by default it sends the
TERM signal. When you send the -HUP signal, it will restart the process by reading
the original configuration file.
32.
You have backgrounded a job called big Certkiller . When you type jobs and the command line it comes back with the following info. jobs [1] Running job1 [2] - Running big Certkiller [3]+ Stopped job5 Type the command any switch(es) that would bring big Certkiller to the foreground.
Correct Answer
fg %2
Explanation
when you enter the command it runs on foreground, which means you
can type the commands after completing only, this is called foregroup but when you
run the command in background, it allows to run multiple commands on same shell.
bg jobid: which runs the jobs in background
fg jobid: Which runs the jobs in foreground.
33.
What is the result of the command:# kill 9 13459
Correct Answer
D. None of the above
Explanation
Kill usage is:
kill [ -s signal | -p ] [ -a ] [ -- ] pid ...
34.
When executing a command that produces output to the screen, you get an exit codeof 0. Choose the best description of what has happened
Correct Answer
A. The program executed properly
Explanation
when you executes the program, it returns the exit code either 0 or
1-255. If returns the exit code 0 it means program executed successfully it it returns
non-zero values it means error occurred during executing the program.
35.
What will the command "kill -HUP 1354" do? Select all the apply
Correct Answer(s)
D. The same as kill -SIGHUP 1354
E. The same as kill -1 1354
Explanation
kill command is used to terminate the processes by default it sends the
TERM signal. When you send the -HUP signal, it will restart the process by reading
the original configuration file. It is same to -SIGHUP and -1 signal. If you want to
display all the signal avaialbles just use the kill -l command.
36.
Which of the following commands sends an unclean and immediate kill signal to processID (PID) 1555?
Correct Answer
D. Kill -9 1555
Explanation
-9 is the powerfull signal, which sends an unclean and immediate kill
signal to process ID.
37.
When the kill command is given with only the PID number of the process to kill (asin 'kill 1234'), this corresponds to which type of kill signal?
Correct Answer
E. 15 (SIGTERM)
Explanation
When you send the kill command it by default sends the TERM signal.
38.
What is the disadvantage of using the command kill -9 ?
Correct Answer
E. The affected process is unable to clean up before exiting.
Explanation
While killing the process, we can send the signal. By default kill
command sends the TERM signal, to send -9 signal
#kill -9 PID
While killing the process using -9 signal it unable to clean up before exiting.
39.
The process big Certkiller is out of control, and efforts to cleanly stop it fail.You have executed a ps command and it displays the following info PID TTY TIME CMD 3541 pts/0 10:10:10 big Certkiller 3558 pts/0 00:00:00 ps What command should you type to absolutely stop the runaway process?
Correct Answer
kill -9 3541
Explanation
While killing the process using -9 signal it unable to clean up before exiting. When you
use the -9 signal, it sends the sigkill signal. Other Avaialble signals are:
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL
5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE
9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2
13) SIGPIPE 14) SIGALRM 15) SIGTERM 17) SIGCHLD
18) SIGCONT 19) SIGSTOP 20) SIGTSTP 21) SIGTTIN
22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO
30) SIGPWR 31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1
36) SIGRTMIN+2 37) SIGRTMIN+3 38) SIGRTMIN+4 39) SIGRTMIN+5
40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8 43) SIGRTMIN+9
44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13
52) SIGRTMAX-12 53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9
56) SIGRTMAX-8 57) SIGRTMAX-7 58) SIGRTMAX-6 59) SIGRTMAX-5
60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2 63) SIGRTMAX-1
64) SIGRTMAX
40.
What command or option will allow a program to continue operations after theinvoking user has logged out of the system? Type just the answer.
Correct Answer
nohup
Explanation
nohup : run a command immune to hang-ups, with output to a
non-tty, to keep the process running after you logged out.
41.
You wish to see the processes that are taking up CPU resources and their PIDnumbers. Type in the command that would do this including the options/argumentsto cause a refresh every second.
Correct Answer
top -d 1
top -d1
Explanation
Explanation:
The top programs provides a dynamic real-time view of a running system. It can
display system summary information as well as a list of tasks currently being
mananged by the linux kernel.
-d interval : Delay Time : Specifies the delay between screen updates and overrides the
corresponding value in one personal configuration file or th startup default.
42.
You wish to start a process and run it in the background. The binary executable ismybinary, and it's in your path. Type in the command in its simplest form to dothis.
Correct Answer
mybinary &
Explanation
Process can start either in foreground or in background. By default
commands executes on foreground. Running the process in foreground allows only
one command can enter at a time because we will get the shell to type another
command until fininshing the current command. But background process allows to
run the more than one command at a time.
To run the process in background just append the & at the end of the command.
Example:
# find / -name passwd >result &
43.
You wish to know what the previous runlevel the system was in. Type in thecommand to show this.
Correct Answer
runlevel
Explanation
runlevel command displays the current and previous runlevel.
Example:
[root@server1 ~]# runlevel
N 3
[root@server1 ~]#
Which means Currenct runlevel is 3 is runlevel is not changed.
Standard Runlevel
0 - halt (Do NOT set initdefault to this)
1 - Single user mode
2 - Multiuser, without NFS (The same as 3, if you do not have networking)
3 - Full multiuser mode
4 - unused
5 - X11
6 - reboot (Do NOT set initdefault to this)
44.
Regardless of the version of Linux, which of the following help start and stopservices on demand? Select two.
Correct Answer(s)
A. Xinetd
B. Inetd
Explanation
xinetd performs the same function as inetd: it starts programs that
provide Internet services. Instead of having such servers started at system
initialization time, and be format until a connection request arrives, xinetd is the
only daemon process started and it listens on all service ports ofr the services listed
in it's configuration file.
45.
Exhibit, output: prompt> Certkiller app [1]+ Stopped Certkiller app prompt> Which of the following commands will resume executing the stopped process while allowing the user to continue to type commands at the command prompt?
Correct Answer
A. Bg Certkiller app
Explanation
Process can start either in foreground or in background. By default
commands executes on foreground. Running the process in foreground allows only
one command can enter at a time because we will get the shell to type another
command until fininshing the current command. But background process allows to
run the more than one command at a time.
To run the process in background just append the & at the end of the command.
Example:
# find / -name passwd >result &
We can suspend the jobs running in foreground by pressing ctrl+z shortcut. As well as
can resume the suspended jobs either in background or foreground.
#fg %jobid : Runs the job in foreground
#bg %jobid : Runs the job in background
or
#fg command
#bg command
46.
What option can be used with the shutdown command to cancel a pendingshutdown?
Correct Answer
A. Shutdown -c
Explanation
shutdown brings the system down in a secure way. All logged-in uers
are notified that the system is going to down, and login blocked.
Syntax: shutdown [time]
#shutdown -c : Which cancel the shutdown process.
47.
You want to do a system shutdown, but you don t want the shutdown to occurimmediately. You want the system to wait 60 seconds before doing the shutdown.What option can be used with the shutdown command to wait 60 seconds beforestarting theshutdown?
Correct Answer
A. Shutdown -t 60
Explanation
shutdown brings the system down in a secure way. All logged-in uers
are notified that the system is going to down, and login blocked.
Syntax: shutdown [time]
#shutdown -c : Which cancel the shutdown process.
48.
What option can be used with the shutdown command to send a warning messagealerting users that the system will be shut down?
Correct Answer
A. Shutdown -k
Explanation
shutdown brings the system down in a secure way. All logged-in uers
are notified that the system is going to down, and login blocked.
Syntax: shutdown -k message : Which sends the warning messages to all logged-in users.
49.
What option can be used with the shutdown command to reboot the system?
Correct Answer
A. Shutdown -r
Explanation
shutdown brings the system down in a secure way. All logged-in uers
are notified that the system is going to down, and login blocked.
shutdown -k message : Which sends the warning messages to all logged-in users.
shutdown -r time : Which reboots the system
shutdown -t time -h: Which halt the system after shutting down.
50.
Given the following output: prompt> myapp[1]+ Stopped myappprompt>Which of the following commands resume executing the stopped process while allowing the user to continue to type commands at thecommand line.
Correct Answer
A. Bg myapp
Explanation
Jobs running on foregroud can suspend by pressing ctrl+z. Then
suspended job can be run either in foreground or in background. To run in
foregroud, fg command and to run in background bg command.
Or
bg job id
fg job id