Unix/Linux Shell Scripting and System Administration
Test your knowledge of Unix/Linux shell commands, scripting, vi editor, cron, NTP, NIS, and HP-UX system administration utilities
Questions
Which key sequence delete the previous word in vi editor?
- dW
- dG
- db
- dd
What are the modes used in vi editor?
- command mode
- Last line mode
- insert or input mode
- All of the above
What are the benefits of IPQoS?
- policy-based bandwidth provisioning
- automatic configuration of IP interfaces
- prioritize only inbound network bandwidth
- prioritize only outbound network bandwidth
What is the first step when creating an NIS Master server
- nisinit -a
- update all ASCII source file
- /sbin/init.d/ypinit start
- /sbin/init.d/nis.server start
Which command uses NTP to keep the local system clock in sync with other nodes on the network
- /usr/sbin/ntpsync
- /usr/sbin/ntpdate
- /usr/sbin/ntpscan
- /usr/sbin/ntpd.conf
Which command performs formatting of binary data generated by nettl
- nroff -e
- netformat -a
- nettl -l filename
- netfmt -f filename
On an HP-UX system, an empty cron.deny file exists but there is not a cron.allow file.Who can use cron in this situation?
- nobody
- only root
- everybody
- only system accounts
A user types history command and gets the following output 141 cd .tcs 142 ll tcs.lst 143 pwd 144 vi tcs.lst 145 ll -lrt | awk '{ print $NF }' 146 echo "Test" 147 ps -ef | grep lsnr 148 grep a * 149 ls 150 echo $PWD Refering to the scenario above, which one of the following is not a method for recovering the pwd command
- r 143
- fc -e -r p
- fc -e 143
- r -8
#! /bin/ksh for i in 1 2 3 4 ......... 50 # loop from 1 to 50 do let i=i+1 done echo $i What will be the output of the above script?
- 2450
- 1275
- 1225
- 2550
Crown margin mode can be done using which command
- nroff
- mm
- fmt
- tbl
Consider the script let i=2 while (( i <= ($l - 1) )); do if (( ($l % i ) == 0 )); then print $i $l $? break; fi let i=i+1 done What is the program all about and what are the possible outputs?
- checks prime number; returns one when not prime and zero when prime
- checks prime number; returns none when not prime and zero when prime
- checks prime number; returns zero when not prime and one when prime
- checks prime number; returns zero when not prime and none when prime
Consider the script "beach.sh" for i in $1; do if (( ${#i} > 4 )); then print -n "#$i " fi done beach.sh "On the beach at night, stands a child with her father"
- #On the beach at night, stands a child with her father
- #On #the #at #a #with #her
- #beac #nigh #stan #chil #fath
- #beach #night, #stands #child #father
which of the following command sets the previously undefined variable x to 40?
- typset x=32+8
- set x=32+8
- let x=32+8
- x=32+8
Which one of the following command shows the last 50 commands the user has entered.
- fc -l 50
- fc -l -50
- history 50
- history $$
Which one of the following is the syntax for a pattern that matches the null string or a filename beginning with a or A
- ?([A-a].*)
- ?([aA]*)
- ?([aA].*)
- ?([aA]$)
Consider the following case echo * We know that the output will be the list of all the files in current directory or equivalent to ls output. Which of the following command gives the ouput as * for the above script.
- set -t
- set -m
- set -f
- set -l
Which key allows to append the script in next line
- Single quote
- front slash
- full stop
- back slash
Consider the following case
echo *
We know that the output will be the list of all the files in current directory or equivalent to ls output.
Which of the following command gives the ouput as * for the above script.
- set -t
- set -m
- set -f
- set -l
#! /bin/ksh
for i in 1 2 3 4 ......... 50 # loop from 1 to 50
do
let i=i+1
done
echo $i
What will be the output of the above script?
- 2450
- 1275
- 1225
- 2550
Consider the script "beach.sh"
for i in $1; do
if (( ${#i} > 4 )); then
print -n "#$i "
fi
done
beach.sh "On the beach at night, stands a child with her father"
- #On the beach at night, stands a child with her father
- #On #the #at #a #with #her
- #beac #nigh #stan #chil #fath
- #beach #night, #stands #child #father