Font size
WorksheetsQUIZ 4
Total questions: 25
Worksheet time: 17mins
Which file contains the list of user accounts on a Linux system?
/etc/users
/etc/passwd
/etc/groups
/etc/accounts
To make a script executable in Linux, which command would you use?
exec
chmod
execute
run
Which command is used to display the disk usage of files and directories in Linux?
du
df
diskutil
diskfree
Which file contains the hostname of the system in Red Hat Enterprise Linux?
/etc/hostname
/etc/sysconfig/hostname
/etc/host
/etc/hosts
What is the purpose of the grep command in Linux?
To display the calendar
To search for patterns in files
To compress files
To display disk usage
Answer
What is the purpose of the tar command in Linux?
To compress files
To copy files
To manipulate tape archives
To manage tasks
Answer
What is the purpose of the systemctl command in Red Hat Enterprise Linux?
To schedule tasks
To display system information
To configure network settings
To manage services
Out of the six fields of crontab what field number 3 signifies?
Hour of day
Day of week
Month of year
Day of month
The cron daemon will run the script ‘/home/user1/script1.sh’ every tenth minute past the hour on the 2nd, 3rd, 4th, 5th, and 6th day of every 6th month.
(a)
Schedule one job with at command that will run it at 1am on December 12, 2024.
(a)
What does -c operation do in grep command?
Matches either upper or lowercase
Prints only the count of matching lines.
Prints the matched line and its line number.
Prints all lines that do not match pattern.
Which command is used (most appropriate) to copy all files having the string ramp and any two characters after that to the progs directory?
cp ramp?? progs
cp ramp* progs
cp ramp[12] /progs/*.*
cp ramp?? /progs/*
What does the following command do?
$ echo *
error
undefined behavior
displays “*”
lists all filenames in the current directory
How will you list only the empty lines in a file name.txt (using grep)?
grep “$^” name.txt
grep “$” name.txt
grep “^$” name.txt
grep $^ name.txt
Given the script echo.sh containing
echo "$4", "$3", "$2", "$1"
What is the output of
$ ./echo.sh a b "c d"
a, b, c, d
d, c, b, a
c d, b, a
c d, b, a
User named "Ram" is member of groups linux and shell. Which of the following command will append group LPU to him?
usermod -a -G LPU Ram
useradd -aG LPU Ram
usermod -g LPU Ram
usermod -gG LPU Ram
Which of the following will accuratly search all files with name "passwd" in /etc directory and copy it to directory named "New"?
find /etc -name passwd -exec cp {} NEW \;
find /etc -name passwd
find /etc passwd -exc -name cp {} NEW \;
find / -name passwd -exec cp {} NEW \;
SELinux labels have several contexts:
Follow the below syntax and tell what third field represents:
unconfined_u: object_r: httpd_sys_content_t: s0 /var/www/html/file2
User
Role
Type
Sensitivity
(a)
You work as a system admin for NYK.ltd. you want to add swap space of 512MB to /dev/sda1 hard drive of your system to run the applications. Which of the following correct order of the commands should you run to accomplish this task. select the correct answer.
I. mkswap /dev/sda1
II swapon /dev/sda1
III. swap /dev/sda1
Only I
Only II and III
Only I and II
Only I, II, III
Set permissions on the /home/operators directory so it is set GID, the owner and group have full read/write/execute permissions, and other users have no permissions on the directory.
(a)
Write the syntax to change the default user shell to the KornShell for user bsmith.
(a)
To create a tarball called /tmp/files.tar containing multiple files(/etc/host.conf /etc/shadow /etc/passwd /etc/yum.conf) from the /etc directory:
(a)
Change both ownership and group membership to user200 recursively on dir10.
(a)
Write the complete command to send the public key of the SSH key pair to student1 on serverb.
(a)
