Midterm Test Flashcards
You have a service called “crond” on your system. This service is currently set to not start in any run level. What command would you use to cause it to start in run levels 2 and 3?
service crond 23 on
chkconfig –level 23 crond on
start crond –level 23
chkconfig –list crond
chkconfig –level 23 crond on
Which two commands will shutdown a system running the traditional init program and not do a reboot?
init 6
shutdown -h now
telinit 1
init 0
shutdown -h now
init 0
You hire Homer Simpson as a junior Linux Sys Admin for your company. You decide to test his job performance before letting him touch important systems. So you ask Homer to install the Apache web server version 2 on an older Debian system. The system uses the traditional init and init scripts to control what processes run at the different run levels. You tell Homer to make sure that Apache runs at run level 2, but does not run at run level 1.
After he is done, you login to the system to check his work. You notice a script called apache2 in the /etc/init.d directory. This is the correct init script. Next you look in the directory /etc/rc1.d and see this using ls -l.
lrwxrwxrwx 1 root root 17 Apr 3 2011 K09apache2 -> ../init.d/apache2
lrwxrwxrwx 1 root root 20 Mar 28 2011 K15pulseaudio -> ../init.d/pulseaudio
lrwxrwxrwx 1 root root 22 Mar 28 2011 K20acpi-support -> ../init.d/acpi-support
lrwxrwxrwx 1 root root 20 Mar 28 2011 K20kerneloops -> ../init.d/kerneloops
lrwxrwxrwx 1 root root 17 Feb 7 2013 K20postfix -> ../init.d/postfix
lrwxrwxrwx 1 root root 15 Mar 28 2011 K20saned -> ../init.d/saned
lrwxrwxrwx 1 root root 14 Sep 27 15:15 K73gpsd -> ../init.d/gpsd
lrwxrwxrwx 1 root root 13 Oct 1 16:37 K77ntp -> ../init.d/ntp
lrwxrwxrwx 1 root root 19 Mar 28 2011 S30killprocs -> ../init.d/killprocs
lrwxrwxrwx 1 root root 19 Mar 28 2011 S70dns-clean -> ../init.d/dns-clean
lrwxrwxrwx 1 root root 18 Mar 28 2011 S70pppd-dns -> ../init.d/pppd-dns
lrwxrwxrwx 1 root root 17 Apr 3 2011 S71apache2 -> ../init.d/apache2
lrwxrwxrwx 1 root root 16 Mar 28 2011 S90single -> ../init.d/single
You then look in the directory /etc/rc2.d and see this using ls -l
lrwxrwxrwx 1 root root 20 Mar 28 2011 S20fancontrol -> ../init.d/fancontrol
lrwxrwxrwx 1 root root 20 Mar 28 2011 S20kerneloops -> ../init.d/kerneloops
lrwxrwxrwx 1 root root 17 Feb 7 2013 S20postfix -> ../init.d/postfix
lrwxrwxrwx 1 root root 13 Oct 1 16:37 S23ntp -> ../init.d/ntp
lrwxrwxrwx 1 root root 14 Sep 27 15:15 S26gpsd -> ../init.d/gpsd
lrwxrwxrwx 1 root root 15 Mar 28 2011 S50rsync -> ../init.d/rsync
lrwxrwxrwx 1 root root 15 Mar 28 2011 S50saned -> ../init.d/saned
lrwxrwxrwx 1 root root 19 Mar 28 2011 S70dns-clean -> ../init.d/dns-clean
lrwxrwxrwx 1 root root 18 Mar 28 2011 S70pppd-dns -> ../init.d/pppd-dns
lrwxrwxrwx 1 root root 14 Sep 27 15:13 S75sudo -> ../init.d/sudo
lrwxrwxrwx 1 root root 17 Apr 3 2011 S91apache2 -> ../init.d/postfix
lrwxrwxrwx 1 root root 22 Mar 28 2011 S99acpi-support -> ../init.d/acpi-support
lrwxrwxrwx 1 root root 21 Mar 28 2011 S99grub-common -> ../init.d/grub-common
lrwxrwxrwx 1 root root 18 Mar 28 2011 S99ondemand -> ../init.d/ondemand
lrwxrwxrwx 1 root root 18 Mar 28 2011 S99rc.local -> ../init.d/rc.local
Did Homer setup Apache the way you told him to do?
Yes
No
I can not tell from the information above.
No answer text provided.
I can not tell from the information above.
On most newer Linux distributions the traditional init has been replaced with a newer system. What are the names of the two most common replacements? (select two)
upstart
systemd
initrd
Sys V Run Scripts
upstart
systemd
Match the description to the correct command.
Manage the current state of a service. Run or stop the service manually.
Tool to configure the runlevels for a service.
init
shutdown
service
chkconfig
Manage the current state of a service. Run or stop the service manually.
service
Tool to configure the runlevels for a service.
chkconfig
Which two commands will reboot a system running the traditional init program?
shutdown -h +2
shutdown -r now
init 6
telinit 1
shutdown -r now
init 6
In the traditional linux run levels. Run level blank is used to halt the system and run level blank is used to reboot the system.
0,6
You are working on an older RedHat system that uses the traditional init and init scripts to control programs. You know that Redhat uses the name httpd to refer to the Apache web server. What command could you use to check to see if Apache is running?
telinit httpd
chkconfig httpd status
systemctl status apache
service httpd status
service httpd status
In the traditional Linux boot sequence which component is responsible for loading and executing the init process? Initial Ram Disk BIOS MBR Kernel
Kernel
Match the stage of the traditional Linux boot sequence to its correct component.
Stage 1
Stage 2
Stage 3
Stage 4
Stage 5
Stage 6
BIOS Runlevel Kernel Init MBR Grub systemctl
Stage 1
BIOS
Stage 2
MBR
Stage 3
Grub
Stage 4
kernel
Stage 5
init
Stage 6
runlevel scripts
You want to create an alias called lm. It will run the ls command with the -a and -l options and pipe the results to the less pager command. Which of the following is the correct syntax to create this new alias at the shell prompt?
alias ‘ls -la | less’=lm
set lm=”ls -la | less”
alias lm=’ls -la | less’
export lm; ls -la; less
alias lm=’ls -la | less’
johnb@booboo:/tmp/test$ ls /etc > Notes.txt
johnb@booboo:/tmp/test$ head notes.txt
How will the shell respond to the head command?
Show the top 10 lines of the file
Show the bottom 10 lines of the file
Give the error “notes.txt: no such file or directory”
Give the error “Command not found”
Give the error “notes.txt: no such file or directory”
You have been told that the command fdisk is used to partition hard drives. At the command line how might you get a list of any options used with the fdisk command? (select 2)
which fdisk
man -k fdisk
fdisk -h
man fdisk
man fdisk
fdisk -h
You have added a new executable script to the directory /usr/local/sbin called myscript.sh. You are currently in your home directory. You view the value of your $PATH environment variable with the echo command. It looks like this:
/bin:/usr/bin:/usr/local/bin:/usr/games:/usr/bin/X11
What will happen if you type the command “myscript.sh” at the command prompt?
The shell will show the contents of myscript.sh.
The output of myscript.sh will be added to a file in the current directory.
The script myscript.sh will run.
The shell will give the error “Command not found”.
The shell will give the error “Command not found”.
The pwd command tells you that you are in the /var/log directory. You want to edit a file called file_list located in the /tmp directory, but want to stay in the /var/log directory. Which commands would work? (select two) vi ../tmp/file_list vi ./file_list vi ../../tmp/file_list vi /tmp/file_list
vi /tmp/file_list