WorksheetsUnit 7 to 10
Total questions: 40
Worksheet time: 23mins
What is the purpose of $# Special Variable ?
Return Number of variable
Return number of arguments
Return arguments
None of the above
What is the purpose of $* special variable ?
Return arguments
Return number of arguments
Return value of the variable
None of the above
What is the purpose of $@ special variable ?
Returns number of arguments
Returns number of variables
Returns arguments
None of the above
Which command using special variable can print script name ?
echo $#
echo $@
echo $0
echo #!
What is the contents of /etc directory ?
Configuration files
Variable files
Log files
None of the above
What is the contents of /var directory ?
log files
configuration files
it's an empty directory
None of the above
What is the contents of a directory /var ?
Spool directory
configuration files
device files
None of the above
What is the location of dmesg files ?
/etc/log
/var/log
/etc
I forgot because I didn't had breakfast
What is the content of dmesg files ?
Kernel related messages retrieved from logs
configuration related messages retrieved from /etc
Kernel related messages retrieved from kernel buffer
Services initialized on boot-up of system
Eat Almonds daily to know exact answer
What is the purpose of httpd deamon ?
Web server deamon, Apache Hyper Text Transfer Protocol Deamon.
Kernel server deamon, Hyper Text Transfer Protocol Deamon.
Log server deamon.
What is the purpose of mysqld deamon ?
Database service deamon and Mysqld.log is a record of what mysqld is doing & keep records of when clients connect or disconnect
Server service deamon and Mysqld a record of what mysqld is doing & keep records of when clients connect or disconnect
Configuration service deamon and Mysqld.log is a record of what mysqld is doing & keep records of when clients connect or disconnect
Variable service deamon and Mysqld.log is a record of what mysqld is doing & keep records of when clients connect or disconnect
syslog.conf / rsyslog.conf file is a configuration file and it's function is a) ___________ & b) ________________ (Tick all correct answers)
Control the behavior of system
Allow admin to control, change where system log files are stored
Allow admin to control and change any types of file system
All three answers are correct
What is the purpose of init.d deamon ? Tick all correct answers.
Allow to change how the system behave.
Initialize during the boot process of your system
Contains a number of start-up and stop scripts for various services on your system
Allow to change boot path.
What is the content of passwd file in /etc directory?
Contains the Users online.
Contain the user encrypted passwords
Contain the user passwords
Contains the user account details
What is the content of shadow file in /etc directory ?
User encrypted passwords
User Account details
User and group encrypted passwords
None of the above
Su and sudo allow users to run as superusers or root.
True
False
You can use "su" to switch to any user account
True
False
You cannot use su to switch to any user account.
True
False
Sudo keeps a log for the commands which were executed.
True
False
What is correct about su and sudo ? Select two answers.
su command stands for substitute user or switch user
sudo command stands for superuser do.
both su and sudo are same and can be used interchangeably.
su minimizes the risk of accidental system-wide changes and enhances security.
What is correct about /etc/sudoers.d. (Select two options).
You can refer to Unit 10 ppt to answer this question.
This file is checked before allowing users to login.
This file is typically preserved during system upgrade
To see if the user is authorised to use sudo
This file help admin to troubleshoot the system
/var contains spool directories, log files, accounting information and various other items.
True
False
Linux/Unix, allow you to put a list of commonly used commands into a text file and run them all together. What is this kind of file called in Unix like operating systems.
Shell Script
Shell
Shell file
Scripting demon file
What permission is required before you run a script ?
Execute
Read
Write
None of the above
What is the correct command to change permission before you run ./script.
chmod +x scriptName
chmod +r scriptName
chmod +w scriptName
None of the above
What is the purpose of the first line in your script #!/bin/bash
Special comment to inform compiler about bash interpreter
Special comment to inform compiler that you are running a script
Special comment to inform compiler about Operating system.
None of the above
Which command is correct to store the value of 5 in the variable called num
num = 5
num=5
5=num
numis5
What system will print if you write a command echo $user
The password of the user running the script
The crontab of the user running the script
The process status of the user running the script
The username of the user running the script
What ":echo $USERHOST" command will print on screen.
The web server of the machine the script is running on
The username of the machine the script is running on
The hostname of the machine the script is running on
The server name of the machine the script is running on
What are $1 to $9 are called in bash script.
The first 9 usernames to the Bash script
The first 9 arguments to the Bash script
The first 9 file names to the Bash script
None of the above
$LINENO - Returns the _____________ number in the Bash script.
Random line
current line
Input and output line
None of the above
How does for loop ends
done
do
enod
None of the above
How function starts and ends. (Using what symbols)
{ }
[ ]
( )
None of the above
What does crond process does ?
crond process find the list of devices to schedule and
It looks in every devices cron data-base
crond file is a deamon and it find the list of jobs to end and
It looks in every user’s crontab data-base
crond process find the list of jobs to schedule and
It looks in every user’s cron data-base
Look at the crontab below and select the correct answer.
10 13 8 12 0 /bin/bash /home/imran/script.sh
This crontab will run the script.sh at 10:13 on 8th December and on Sunday
This crontab will run the script.sh at 13:10 on 8th December or on Sunday
This crontab will run the script.sh at 13:10 on 8th December on Sunday
None of the above
Select the correct command to run a script with the name MyScript.sh
./MyScript.h
./MyScript.sh
.MyScript.sh
run MyScript.sh
Ahmed is writing a script which will run on bash, what should be the first line in his script.
$#/bin/bash
#!/bin/bash
!#/bin/bash
#!/bash/bash
Arun want to edit the crontab, which command Arun should use to edit the crontab.
cron -e
crontab -e
crontab -l
crontab -r
Arun want to remove the crontab, which command Arun should use to remove the crontab.
crontabb -r
crontab -r
cron -r
cron -l
Arun want to list the crontabs he created, which command Arun should use to list the crontab.
crontab -l
crontab -e
crontab -r
cron -l
