How Much Do You Know About Linux? Trivia Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Golf_pro90
G
Golf_pro90
Community Contributor
Quizzes Created: 2 | Total Attempts: 381
| Attempts: 127 | Questions: 85
Please wait...
Question 1 / 85
0 %
0/100
Score 0/100
1. Identify the Linux command that renames a file named oldfile  to  newfile  in current working directory.

Explanation

The correct answer is "mv oldfile newfile". The "mv" command in Linux is used to move or rename files and directories. In this case, it renames the file named "oldfile" to "newfile" in the current working directory.

Submit
Please wait...
About This Quiz
How Much Do You Know About Linux? Trivia Quiz - Quiz

Test your knowledge on Linux with this trivia quiz! It covers essential commands and concepts, such as navigation, file operations, and user directory management. Perfect for anyone looking... see moreto enhance their Linux skills or prepare for certification exams. see less

2. You use the ______ symbol to mark the beginning of a comment in a script.

Explanation

The correct symbol to mark the beginning of a comment in a script is the "#" symbol. This symbol is commonly used in programming languages to indicate that the following text is a comment and should be ignored by the compiler or interpreter. Comments are used to add explanatory notes or documentation to the code, making it easier for other programmers to understand the purpose or functionality of certain sections of the script.

Submit
3. Which of the following are all valid basic file permissions under Linux?

Explanation

The correct answer is "Read, Write, Execute." These are the three basic file permissions under Linux. "Read" allows a user to view the contents of the file, "Write" allows a user to modify or delete the file, and "Execute" allows a user to run the file as a program. These permissions can be set separately for the owner of the file, the group that the file belongs to, and other users. The other options listed in the question either include invalid permissions or do not include all three basic permissions.

Submit
4. ____________ is the symbol used to separate commands in a list, which are executed sequentially.

Explanation

The symbol ";" is used to separate commands in a list, which are executed sequentially. This means that each command will be executed one after the other, in the order they appear in the list.

Submit
5. Identify the linux command used to display the inode number of /etc/fstab

Explanation

The correct answer is "ls -i /etc/fstab". The "-i" option is used with the "ls" command to display the inode number of a file or directory. In this case, it is used to display the inode number of the /etc/fstab file.

Submit
6. What value of the variable name total will be displayed after executing the following statements? ((total=0)) for ((num1=1; num1<=3; num++)) do         for ((num2=1; num2<=2; num2++))         do                    for ((num3=10; num3 >=1; num--))                        ((total++))                        done            done done echo $total

Explanation

The value of the variable total will be 60. This is because the nested loops are executed multiple times. The outer loop runs 3 times, the middle loop runs 2 times, and the inner loop runs 10 times. Each time the innermost loop runs, the total variable is incremented by 1. So, the total variable will be incremented 3 * 2 * 10 = 60 times.

Submit
7. The command find . -name practice would search from?

Explanation

The command "find . -name practice" would search for files or directories with the name "practice" in the current directory. The dot (.) represents the current directory in this command.

Submit
8. The command that displays the name of current shell is ____________________.

Explanation

The correct answer is "echo $SHELL" because the "echo" command is used to display the value of a shell variable, and "$SHELL" is a built-in environment variable that holds the name of the current shell. By running this command, the name of the current shell will be displayed on the terminal.

Submit
9. Login as joot, to change to login shell to /bin/csh  for user1, you type ____________.

Explanation

To change the login shell to /bin/csh for user1, you would use the command "usermod -s /bin/csh user1". This command modifies the user's account information and sets the login shell to /bin/csh.

Submit
10. Identify the command that is used to delete an existing group in Linux

Explanation

The command "groupdel" is used to delete an existing group in Linux.

Submit
11. To immediately shutdown and halt a Linux machien from command line, you should:

Explanation

The correct answer is "Log in as root and type: shutdown -h now". This command is used to shutdown and halt a Linux machine immediately. The "-h" option stands for halt, and "now" indicates that the shutdown should happen immediately. Logging in as root is necessary to have the required privileges to execute this command.

Submit
12. Given the following -rwxr-x-w- 2  paul students    127 Oct 5 13:37 filetwo Who is the owner of filetwo?

Explanation

The owner of the file "filetwo" is "paul" because "paul" is the first entry in the given file permissions string "-rwxr-x-w-".

Submit
13. What is the command used to quit without saving in vim?

Explanation

The command ":q!" is used to quit Vim without saving any changes made to the file. It forcefully exits the editor and discards any unsaved modifications.

Submit
14. Which of the following uses the bash shell for the command interpreter in a script?

Explanation

The correct answer is "#!/bin/bash". This is because the "#!" symbol at the beginning of a script is called a shebang, and it specifies the interpreter to be used for executing the script. In this case, "/bin/bash" is the path to the bash shell, indicating that the bash shell should be used as the command interpreter for the script.

Submit
15. __________ is the operator that is used when you want one command to execute only if another command executes successfully.

Explanation

The && operator is used when you want one command to execute only if another command executes successfully. This operator is commonly used in programming languages and shell scripting to create conditional statements and control the flow of execution. When the command on the left side of the && operator executes successfully, the command on the right side will be executed. If the command on the left side fails, the command on the right side will not be executed.

Submit
16. Which of the following commands deletes user1 from /etc/passwd and removes user1's home directory and any files stored in it?

Explanation

The correct answer is "userdel -r user1." This command is used to delete a user account and its home directory. The option "-r" stands for "remove," which ensures that the user's home directory and any files stored in it are also deleted. The other options mentioned do not include the "-r" option, so they would not remove the home directory and its files.

Submit
17. The command that will set an option so a search of substitute ignores cases in vim:

Explanation

The correct answer is ":set ic". This command sets the "ignorecase" option in vim, which means that when searching or substituting, the case of the text will be ignored. This allows for more flexible and inclusive searches, as it will match both uppercase and lowercase letters.

Submit
18. Based on /etc/fstab: /dev/sda1                     /                        ext3                defaults                              1    1 /dev/sda2                     swap                swap              defaults                              0    0 /dev/sda3                    /mnt/new          ext3                noauto                                2    2 /dev/fd0                      /mnt/floppy       ext2                auto, users                         0    0 /dev/cdrom                /mnt/cdrom       iso9660          auto, nouser                       0    0 To successfully mount /dev/cdrom , you should log on as _______.

Explanation

To successfully mount /dev/cdrom, you should log on as root. Mounting a device requires administrative privileges, which are typically only granted to the root user.

Submit
19. What is the result of the following statements? ((g=5)) until [ $g -lt 1 ] do           echo $g          ((g--)) done

Explanation

The given code initializes the variable "g" to 5. Then, it enters a loop that continues until the value of "g" is less than 1. Inside the loop, it prints the value of "g" and decrements it by 1. This process continues until "g" becomes 0. Therefore, the result of the code is that the numbers 5, 4, 3, 2, and 1 are displayed on separate lines.

Submit
20. What is the file that stores encrypted user passwords?

Explanation

The file that stores encrypted user passwords is /etc/shadow. This file is commonly found in Unix-like operating systems and it contains the password hashes for user accounts. The passwords are stored in an encrypted format, providing an extra layer of security. Access to this file is restricted to the root user, ensuring that only authorized individuals can view or modify the password information.

Submit
21. What command can you use to remove a directory with files in it in Linux.

Explanation

The command "rm -r" is used to remove a directory with files in it in Linux. The "rm" command is used to remove files, and the "-r" option is used to remove directories recursively, meaning it will remove the directory and all its contents. Therefore, "rm -r" is the correct command to remove a directory with files in it.

Submit
22. What are the permissions in octal mode of the file fileone, given the file listing below: -rwxr-x-w- 2 steven studends   12 Feb 6 10:37 fileone

Explanation

The file listing "-rwxr-x-w-" indicates that the owner has read, write, and execute permissions, the group has read and execute permissions, and others have write permissions. In octal mode, the permissions are represented as follows: read (4), write (2), and execute (1). Therefore, the owner has permissions 7 (4+2+1), the group has permissions 5 (4+1), and others have permissions 2 (2). Thus, the octal mode of the file fileone is 752.

Submit
23. What is the output of the following? echo "$(pwd)"

Explanation

The given command "echo "$(pwd)"" will output the current directory. The "$(pwd)" is a command substitution that will be replaced with the output of the "pwd" command, which stands for "print working directory". Therefore, the output will be the current directory in which the command is being executed.

Submit
24. You can keep your preferred settings by creating a ________ file in vim.

Explanation

In order to keep preferred settings in vim, you can create a "vimrc" file. This file allows you to customize the behavior and appearance of vim according to your preferences. By adding specific configurations and settings to the vimrc file, you can ensure that these preferences are applied every time you use vim.

Submit
25. Answer based on the output of fdisk -l /dev/sda: Disk /dev/sda: 16/1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device                     Boot                   Start                    End                 Blocks                Id                 System /dev/sda1                   *                         1                       1657                 13309821           83                  Linux /dev/sda2                                           1658                   1912                  2048284+          82                  Linux swap/Solaris /dev/sda3                                           1913                   1929                  56227+              5                    Extended /dev/sda5                                           1913                   1914                  16033+             82                   Linux swap/Solaris /dev/sda6                                           1915                   1916                  16033+             83                   Linux /dev/sda7                                           1917                   1919                  24066               83                   Linux The extended partition is __________?

Explanation

Based on the output of the fdisk command, the extended partition is /dev/sda3. This can be determined by looking at the "System" column, where the partition with the "Extended" system type is labeled as /dev/sda3.

Submit
26. What do you type to pause your script for two seconds?

Explanation

The correct answer is "sleep 2". In programming, the "sleep" command is used to pause the execution of a script for a specified amount of time. In this case, "sleep 2" means that the script will pause for 2 seconds before continuing with the next line of code.

Submit
27. Which of the following options for useradd command is used to prevent Linux from creating a group with the same name as username?

Explanation

The option "-N" for the useradd command in Linux is used to prevent the system from creating a group with the same name as the username. This means that when a new user is added, a group with the same name will not be automatically created. This option is useful when the user wants to have more control over the group creation process and wants to manually manage the groups for each user.

Submit
28. The Linux command that allows for deleting a directory, but only if it is empty_____________.

Explanation

The correct answer is "rmdir". The "rmdir" command in Linux is used to remove a directory, but it can only delete the directory if it is empty. If the directory contains any files or subdirectories, the "rmdir" command will not work and will display an error message.

Submit
29. Which of the following commands can be used to verify if user has been created in the file system?

Explanation

The command "cat /etc/passwd|grep user1" can be used to verify if a user named "user1" has been created in the file system. The "cat /etc/passwd" command displays the contents of the /etc/passwd file, which contains information about all the users on the system. The "|grep user1" part of the command filters the output and only displays the lines that contain "user1", allowing us to see if the user exists in the file system.

Submit
30. Login as root and run the following commands: groupadd group1 groupadd group2 useradd user1 useradd -G group1, group2 user3 useradd -G group2, user2 user3 useradd -g group2 user4 gpasswd -a user1 group1 gpasswd -d user2 group2 groups user4 What is the output produced by command: groups user4

Explanation

The output produced by the command "groups user4" is group2. This is because the "groups" command displays the groups that a user belongs to, and in this case, user4 is only a member of group2.

Submit
31. Given the file permission  rw-r--r-- for a file names script1 , identify the chmod command that adds executable permissions for owner and group and removes read permission from others:

Explanation

The given file permission "rw-r--r--" means that the owner has read and write permissions, the group has only read permission, and others have only read permission. To add executable permissions for the owner and group and remove read permission from others, we need to use the chmod command with the permissions "750". This means that the owner will have read, write, and execute permissions, the group will have read and execute permissions, and others will have no permissions. Therefore, the correct answer is "chmod 750 script1".

Submit
32. You use the _______ statement to display all the elements in an array named labs.

Explanation

The correct answer is "echo ${labs[*]}". This statement is used to display all the elements in an array named "labs". The asterisk (*) is used as a wildcard character to represent all the elements in the array.

Submit
33. Login as root to create a user account based on the following: username: user1 home directory: /home/userone What command should be used?

Explanation

The correct answer is useradd -d /home/userone -m user1. This command is used to create a new user account with the specified username "user1" and sets the home directory to "/home/userone". The -d option specifies the home directory and the -m option creates the home directory if it does not already exist.

Submit
34. What is the result? for animal in cat dog bear do echo $animal done

Explanation

The correct answer is "cat", "dog", and "bear" are displayed on separate lines. This is because the given code is a loop that iterates through the words "cat", "dog", and "bear" one by one and prints each word on a separate line using the "echo" command. Therefore, the output will be "cat", "dog", and "bear" displayed on separate lines.

Submit
35. Is the following the correct way of having a loop exit if 'Q' or 'q' was entered? while [  #CHOICE = 'Q' ] || [ $CHOICE = 'q' ]

Explanation

The given expression in the while loop checks if the variable CHOICE is equal to either 'Q' or 'q'. If it is, the loop will exit. Therefore, the correct answer is "no" because the given expression is the correct way to have the loop exit if 'Q' or 'q' was entered.

Submit
36. Would the following code in a script file print the contents of the variable $name? echo 'this is my $name'

Explanation

The code will not print the contents of the variable $name. This is because the variable is enclosed in single quotes within the echo statement, which prevents variable substitution. Therefore, the output will be "this is my $name" instead of the actual value stored in the variable.

Submit
37. Log in as root, and run the following commands: mkdir ~/test1 cd ~/test1 mkdir -p parent/child touch f1 f2 f3 cp f3 f4 mv f1 f2 f3 ./parent/child cp f4 ./parent/child/f5 cd parent cd ../../ pwd rmdir ~/test1/parent/child rm -r ~/test1/parent How many directories have been created (included deleted directories)?

Explanation

The correct answer is 3. The directories "test1", "parent", and "child" have been created. The "parent" directory is later deleted, but it was still created at some point. So, a total of 3 directories have been created.

Submit
38. What is the order of execution to prepare a partition for data storage in Linux?

Explanation

The correct order of execution to prepare a partition for data storage in Linux is fdisk, mkfs, fsck, mount. First, fdisk is used to create and manage partitions on the disk. Then, mkfs is used to create a file system on the partition. After that, fsck is used to check and repair the file system for any errors. Finally, mount is used to mount the partition and make it accessible for data storage.

Submit
39. The command that displays all mounted devices ________________.

Explanation

The correct answer is "mount" because the "mount" command is used to display all mounted devices on a system. This command allows the user to see the file systems that are currently mounted and their corresponding mount points.

Submit
40. The following will execute _______ time(s) for ((num=1; num<=5; num++)) do echo $num done

Explanation

The given code is a for loop that starts with num=1 and continues until num is less than or equal to 5. In each iteration of the loop, the value of num is printed using the echo command. Since the loop starts with num=1 and continues until num=5, it will execute 5 times. Therefore, the correct answer is 5.

Submit
41. What must you type in order for child shells to be able to use functions created in the parent shell?

Explanation

In order for child shells to be able to use functions created in the parent shell, you must type "export -f". This command exports the specified function to the environment, making it accessible to child shells.

Submit
42. What special variable is used to determine the exit status of a previously executed command?

Explanation

The special variable used to determine the exit status of a previously executed command is "$?". This variable holds the exit code of the last command executed, where a value of 0 typically indicates success and any non-zero value indicates an error or failure. By checking the value of "$?", one can determine the success or failure of a command and take appropriate actions based on that.

Submit
43. Identify the environment variable that defines primary prompt.

Explanation

The environment variable "PS1" defines the primary prompt in a Unix-like operating system. It specifies the format and content of the command prompt that appears when a user is ready to enter a command. By setting the value of "PS1", users can customize the appearance of their command prompt to suit their preferences or display additional information.

Submit
44. Which of the following would not place you in your home directory?

Explanation

The command "cd ~/username" would not place you in your home directory. This command would attempt to change the directory to a subdirectory named "username" within the home directory. To go directly to the home directory, the correct command would be "cd" or "cd ~". The other options "cd" and "cd /home/username" would also take you to the home directory.

Submit
45. What happens when you type the following command line at the given command prompt: user1@localhost : ~$ cd .

Explanation

When you type the command "cd ." at the command prompt, it means you are trying to change the directory to the current directory itself. Since you are already in the current directory, there is no need to change directories, so you remain in the current directory.

Submit
46. Identify the root user accounts home directory in Linux

Explanation

The root user in Linux has its home directory located at "/root". This is the default location where the root user's personal files and configurations are stored. The other options mentioned ("/", "/root/home", "/home/root") are incorrect as they do not represent the correct path to the root user's home directory.

Submit
47. Based on /etc/fstab: /dev/sda1               /                    ext3                   defaults         1 1 /dev/sda2             swap              swap                 defaults          0 0 /dev/sda3             /mnt/new       ext3                   noauto            2 2 /dev/fd0               /mnt/floppy    ext2                   auto, users     0 0 /dev/cdrom         /mnt/cdrom    iso9660             auto, nouser   0 0 Which device/partition is not mounted automatically during startup? 

Explanation

The device/partition that is not mounted automatically during startup is /dev/sda3. This is indicated by the "noauto" option specified in the /etc/fstab file for that device/partition.

Submit
48. Answer based on the output of fdisk -l /dev/sda: Disk /dev/sda: 16/1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device               Boot                Start               End                   Blocks                Id               System /dev/sda1            *                        1                 1657                   13309821           83                Linux /dev/sda2                                   1658             1912                    2048284+          82                Linux swap/Solaris /dev/sda3                                   1913             1929                    56227+              5                  Extended /dev/sda5                                   1913             1914                   16033+               82                Linux swap/Solaris /dev/sda6                                   1915             1916                   16033+              83                 Linux /dev/sda7                                   1917             1919                   24066                83                 Linux How many logical drives have been created?

Explanation

Based on the output of fdisk -l /dev/sda, there are three logical drives that have been created. This can be determined by looking at the number of partitions listed under the "System" column. In this case, there are three partitions listed: /dev/sda1, /dev/sda2, and /dev/sda5. Each of these partitions represents a logical drive that has been created. Therefore, the correct answer is 3.

Submit
49. Identify the command used to activate a swap partition

Explanation

The command used to activate a swap partition is "swapon". This command is used to enable swapping on a specified swap device or file. By using the "swapon" command, the system will start using the swap space allocated in the swap partition, allowing for efficient memory management and improving overall system performance.

Submit
50. To make user4 the administrator of group1, login as root and type ___________

Explanation

The correct answer is "gpasswd -A user4 group1". This command adds user4 as an administrator to group1. The -A option is used to specify that the user should be added as an administrator.

Submit
51. Which of the following Linux commands  prevents you from accidentally overwriting a file when you redirect output to a file?

Explanation

The correct answer is "set -noclobber". This command is used in Linux to prevent accidental overwriting of a file when redirecting output to a file. By using this command, if a file already exists with the same name, the output will not overwrite it and an error message will be displayed instead.

Submit
52. Log in as root, and run the following commands: mkdir ~/test1 cd ~/test1 mkdir -p parent/child touch f1 f2 f3 cp f3 f4 mv f1 f2 f3 ./parent/child cp f4 ./parent/child/f5 cd parent cd ../../ pwd rmdir ~/test1/parent/child rm -r ~/test1/parent How many directories have been successfully removed?

Explanation

Two directories have been successfully removed: "child" and "parent". The "rmdir" command is used to remove empty directories, and the "rm -r" command is used to remove directories and their contents recursively. In this scenario, the "child" directory is removed using "rmdir" and the "parent" directory is removed using "rm -r".

Submit
53. The following will execute _____ time(s) ((t=0)) while [ $t -eq 10 ] || [ $t -ge 0 ] do echo "blue ocean!" done

Explanation

The given code will execute an infinite number of times because the condition in the while loop is always true. The variable t is initialized to 0, and the condition checks if t is equal to 10 or greater than or equal to 0. Since t is initially 0 and the condition only checks if t is equal to 10 or greater than 0, the condition will always be true and the loop will continue indefinitely.

Submit
54. Which of the following statements is used to display the length of the data value of the second element in an array named tests.

Explanation

The correct answer is "echo ${#tests[1]}". In this statement, the "#" symbol is used to display the length of the data value of the second element in the array named "tests". This syntax is specific to Bash scripting and is used to obtain the length of a string or the number of elements in an array. The "[1]" indicates that we are referring to the second element in the array.

Submit
55. Log in as root, and run the following commands: mkdir ~/test1 cd ~/test1 mkdir -p parent/child touch f1 f2 f3 cp f3 f4 mv f1 f2 f3 ./parent/child cp f4 ./parent/child/f5 cd parent cd ../../ pwd rmdir ~/test1/parent/child rm -r ~/test1/parent What is the output of pwd  command?

Explanation

The output of the "pwd" command is "/root". This is because the "cd ../.." command is used to navigate two directories up from the current directory, which is "/root/test1/parent". So, the final directory is "/root".

Submit
56. The command used to delete all characters from the cursor position to the end of the line in vim is ________

Explanation

The command "d$" is used to delete all characters from the cursor position to the end of the line in vim.

Submit
57. What value of the variable named c will be displayed after executing the following ((x=1)) ((c=0)) while [ $x -le 5 ] do         ((y=4))          until [ $y -le 1 ]         do                    ((y--))                   echo $x $y                    ((c++))           done          ((x++)) done echo "This number of times looped is: " $c

Explanation

The value of the variable named c will be displayed as 15. This is because the loop is executed 15 times. Inside the loop, the value of c is incremented by 1 each time the loop iterates. Since the loop iterates 15 times, the final value of c will be 15.

Submit
58. Which linux command line copies directories dir1, dir2,  to dir3 (dir1,dir2 and dir3 are all located in the current working directory)?

Explanation

The correct answer is "cp -r dir1 dir2 dir3" because the "-r" flag is used to copy directories recursively, meaning it will copy all the files and subdirectories within the directories dir1 and dir2 to dir3.

Submit
59. To redirect standard output and error of script1 to a file named outerr.txt, use the ___________ command.

Explanation

The correct answer is "script1 &> outerr.txt". This command redirects both standard output and error of script1 to a file named outerr.txt. The "&>" operator is used to redirect both output streams at once.

Submit
60. Which of the following statments is used to display the length of an array named lectures.

Explanation

The correct answer is "echo ${#lectures[*]}". In Bash, the ${#variable[*]} syntax is used to display the length of an array. In this case, it will display the length of the array named "lectures".

Submit
61. Answer based on the output of fdisk -l /dev/sda: Disk /dev/sda: 16/1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device        Boot          Start        End           Blocks                     Id          System /dev/sda1     *                 1            1657           13309821                83           Linux /dev/sda2                      1658        1912           2048284+               82           Linux swap/Solaris /dev/sda3                      1913        1929           56227+                   5             Extended /dev/sda5                      1913         1914          16033+                   82            Linux swap/Solaris /dev/sda6                      1915         1916          16033+                   83           Linux /dev/sda7                      1917        1919           24066                     83           Linux Identify whether new partitions or logical drives can be created without deleting an existing partition or adding a new hard drive.

Explanation

Based on the output of fdisk -l /dev/sda, it can be determined that one primary partition and more than one logical drives can be created without deleting an existing partition or adding a new hard drive. This is indicated by the presence of the extended partition (/dev/sda3) and the logical drives (/dev/sda5, /dev/sda6, /dev/sda7) within it. The extended partition allows for the creation of multiple logical drives within it, while the primary partition (/dev/sda1) can also be used to create another partition. Therefore, the correct answer is "One primary partition and more than one logical drives can be created."

Submit
62. What is the result? ((x=5)) function functions1 () {      local x=10     echo $x } echo $x function1 ((x=x+10)) echo $x

Explanation

The correct answer is "numbers 5,10,15 displayed on separate lines" because the code first assigns the value 5 to the variable x. Then, the function function1 is defined, which declares a local variable x with the value 10 and prints it. The global variable x is then printed, which still has the value 5. After that, the global variable x is incremented by 10 and printed again, resulting in the value 15.

Submit
63. Identify all paths that represent absolute paths in Linux (SELECT ALL THAT APPLY)

Explanation

The paths "/","/home/user/test1" represent absolute paths in Linux. In Linux, an absolute path starts with a forward slash ("/") and specifies the complete directory structure from the root directory. The paths "./user/test1" and "../user/fstab" are not absolute paths because they start with a dot (".") or double dots (".."), indicating relative paths.

Submit
64. To set default directory permission to rwx-wx-wx, you should set umask to _______.

Explanation

To set the default directory permission to rwx-wx-wx, the umask value should be set to 044. Umask is a value that is subtracted from the default permissions to determine the final permissions of newly created files and directories. In this case, the default permissions are 777 (rwxrwxrwx), and when the umask value of 044 is subtracted, it results in the desired permissions of 733 (rwx-wx-wx) for directories.

Submit
65. To search a string "test2" in the BACKWARD direction in vim,  you type __________

Explanation

In Vim, to search for a string in the backward direction, you use the "?" command followed by the string you want to search for. So, the correct answer is "?test2".

Submit
66. What is the result when the following script is executed? array1={a b c d e} echo ${array1 [1+3] }

Explanation

The script creates an array called array1 with elements "a", "b", "c", "d", and "e". The echo command is used to display the element at index 1+3, which is index 4. Therefore, the script will display "e".

Submit
67. What environment variable is used to store the file name used to store command history in bash shell?

Explanation

The environment variable used to store the file name used to store command history in the bash shell is HISTFILE. This variable determines the location and name of the file where the command history is saved. By default, the command history is stored in the .bash_history file in the user's home directory. However, the user can change the value of HISTFILE to specify a different file location or name.

Submit
68. Answer based on the output of fdisk -l /dev/sda: Disk /dev/sda: 16/1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device                Boot        Start              End            Blocks            Id                        System /dev/sda1             *               1                 1657            13309821       83                        Linux /dev/sda2                           1658             1912             2048284+      82                        Linux swap/Solaris /dev/sda3                           1913             1929             56227+          5                          Extended /dev/sda5                           1913             1914             16033+          82                        Linux swap/Solaris /dev/sda6                           1915             1916             16033+          83                        Linux /dev/sda7                           1917             1919             24066            83                        Linux List all primary partitions

Explanation

The correct answer is /dev/sda1, /dev/sda2. This is because the output of the fdisk -l /dev/sda command shows two partitions with the boot flag set, which indicates that they are primary partitions. These partitions are /dev/sda1 and /dev/sda2.

Submit
69. Log in as root, and run the following commands: mkdir ~/test1 cd ~/test1 mkdir -p parent/child touch f1 f2 f3 cp f3 f4 mv f1 f2 f3 ./parent/child cp f4 ./parent/child/f5 cd parent cd ../../ pwd rmdir ~/test1/parent/child rm -r ~/test1/parent How many regular files are left in ~/test1 after executing the above commands??

Explanation

After executing the above commands, only one regular file, "f2", is left in the ~/test1 directory. All other regular files have either been moved or copied to the ~/test1/parent/child directory or deleted.

Submit
70. Which of the following statements about minimum permissions needed to delete a file in Linux is true?

Explanation

The minimum permissions needed to delete a file in Linux are write (w) and execute (x) for the directory and none for the file. This means that the user must have write and execute permissions on the directory where the file is located in order to delete it. However, no specific permissions are required for the file itself.

Submit
71. What a umask of 066, which will be the default file permission?

Explanation

A umask of 066 means that the default file permission will be rw-------. This means that the owner of the file will have read and write permissions, while all other users will have no permissions at all.

Submit
72. What is the result? function airplane () {       echo $1 } airplane $1

Explanation

The correct answer is "the value of the first positional parameter is displayed". In the given code, the function "airplane" is defined which takes a parameter. The parameter is then displayed using the "echo" statement inside the function. When the function is called with the argument "$1", it refers to the first positional parameter passed to the script. Therefore, the value of the first positional parameter will be displayed.

Submit
73. What is the command that is used to create a swap filesystem.

Explanation

The command "mkfs" is used to create a file system on a disk or a partition. However, in this question, the requirement is to create a swap filesystem. The correct command to create a swap filesystem is "mkswap". Therefore, the correct answer is "mkswap".

Submit
74. Given the file permission in octal mode 644 for a file named script2 , identify  chmod command that adds execut permissions for group and others: (SELECT ALL THAT APPLY)

Explanation

The correct answer is "chmod 655 script2" because it adds execute permissions for the group and others. The octal mode 655 represents read, write, and execute permissions for the owner, read and write permissions for the group, and read and execute permissions for others. Additionally, "chmod g+x, o+x script2" is also correct as it explicitly adds execute permissions for the group and others. The other options do not add execute permissions for both group and others.

Submit
75. If user1 is a valid account and the home directory for user1 is /home/user1, the command usermod -d /home/user1_home user1 will _________________________.

Explanation

The command "usermod -d /home/user1_home user1" will only change the home directory of user1 in the file /etc/passwd. It will not create a new directory or delete the previous directory /home/user1. The command simply modifies the user's home directory entry in the system's user database.

Submit
76. Given the following: -rwxr-x-w- 2 students 127 Oct 5 13:37 filetwo which of the following is the right command to change filetwo's owner to jack?

Explanation

The correct command to change filetwo's owner to jack is "chown filetwo jack".

Submit
77. Which of the following is true about hard link in Linux (SELECT ALL THAT APPLY)

Explanation

Hard links in Linux allow multiple file names to be associated with the same inode, or index node, which contains the metadata and location of the file's data on the disk. Therefore, you can create multiple hard links to the same file, and all hard links will have the same inode number as the original file. If the original file is removed, the hard links will still point to the same data, but they will become meaningless or orphan links. The physical file will not be removed from the disk until all hard links are deleted. Therefore, the correct answer is that you may create multiple hard links to the same file, all hard links have the same inode number as the original files, and the physical file will not be removed from the disk until all hard links are deleted.

Submit
78. Based on /etc/fstab: /dev/sda1           /                    ext3                  defaults              1     1 /dev/sda2         swap              swap                defaults               0     0 /dev/sda3         /mnt/new       ext3                  noauto                 2     2 /dev/fd0           /mnt/floppy    ext2                  auto, users          0     0 /dev/cdrom     /mnt/cdrom    iso9660            auto, nouser        0     0 Identify the correct command line that is used to mount /dev/sda3  ___________ (SELECT ALL THAT APPLY)

Explanation

The correct command line that is used to mount /dev/sda3 is "mount /dev/sda3" and "mount /mnt/new". These commands will mount the /dev/sda3 partition and the /mnt/new directory respectively. The other options are not correct because "umount /mnt/new /dev/sda3" is the command to unmount the /mnt/new directory from the /dev/sda3 partition, and "mount -t" is an incomplete command.

Submit
79. Login as root and run the following commands: groupadd group1 groupadd group2 useradd user1 useradd -G group1, group2 user3 useradd -G group2, user2 user3 useradd -g group2 user4 gpasswd -a user1 group1 gpasswd -d user2 group2 groups user4 Who is a member of group2? (SELECT ALL THAT APPLY)

Explanation

User3 and User4 are members of group2. This can be determined by analyzing the commands given in the question. The command "useradd -G group1, group2 user3" adds user3 to both group1 and group2. Similarly, the command "useradd -G group2, user2 user3" adds user3 to group2 and user2 to user3. Finally, the command "useradd -g group2 user4" adds user4 to group2. Therefore, user3 and user4 are the members of group2.

Submit
80. Login as root, identify the Linux command used to give everyone full access permission to directory /public (select all that apply)

Explanation

The Linux command used to give everyone full access permission to directory /public is "chmod 777 /public". Additionally, "chmod ugo=rwx /public", "chmod a+rwx /public", "chmod ugo+rwx /public", and "chmod a+rwx /public" are also correct commands to achieve the same result.

Submit
81. Select all the ways you can cd into test1 , a sub-directory of user1's home directory, /home/user1, given the command promt listed below (SELECT ALL THAT APPLY) user1@localhost: /bin$

Explanation

You can cd into test1 by using the commands cd ~/test1 or cd /home/user1/test1. The first command uses the ~ symbol to represent the user's home directory, and then appends /test1 to navigate to the sub-directory. The second command directly specifies the full path to the test1 directory.

Submit
82. The Linux command that prints the current working directory in absolute path

Explanation

The correct answer is "ls" because the "ls" command in Linux is used to list the contents of a directory. Although it does not directly print the current working directory in absolute path, it can be used with additional options to achieve this. For example, using the "ls -d" command will display the current directory in absolute path format.

Submit
83. Login as root and run the following commands: groupadd group1 groupadd group2 useradd user1 useradd -G group1, group2 user3 useradd -G group2, user2 user3 useradd -g group2 user4 gpasswd -a user1 group1 gpasswd -d user2 group2 groups user4 Who is a member of group1? (SELECT ALL THAT APPLY)

Explanation

Based on the given commands, user1 is added to group1 using the command "gpasswd -a user1 group1". However, user2 is removed from group2 using the command "gpasswd -d user2 group2". Therefore, user1 is a member of group1, but user2 is not a member of any group mentioned in the question.

Submit
84. Given the following: -rwxr-x-w- 2 students 127 Oct 5 13:37 filetwo to change the group students  to  faculty, you type _________________(SELECT ALL THAT APPLY)

Explanation

To change the group "students" to "faculty" for the file "filetwo", you would use the command "chgrp faculty filetwo". The command "chown .faculty filetwo" is incorrect as it changes the owner, not the group. The command "chmod jack.faculty filetwo" is incorrect as it is not a valid command. The command "chgrp filetwo faculty" is incorrect as the order of the arguments is incorrect. Therefore, the correct answer is "chgrp faculty filetwo".

Submit
85. Login as root and run the following commands: groupadd group1 groupadd group2 useradd user1 useradd -G group1, group2 user3 useradd -G group2, user2 user3 useradd -g group2 user4 gpasswd -a user1 group1 gpasswd -d user2 group2 groups user4 Who is a member of user 2? (SELECT ALL THAT APPLY)

Explanation

User2 and User3 are members of User2. User2 is added to group2 and user3 is added to both group1 and group2.

Submit
View My Results

Quiz Review Timeline (Updated): Feb 6, 2024 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Feb 06, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 17, 2012
    Quiz Created by
    Golf_pro90
Cancel
  • All
    All (85)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Identify the Linux command that renames a file named oldfile ...
You use the ______ symbol to mark the beginning of a comment in a...
Which of the following are all valid basic file permissions under...
____________ is the symbol used to separate commands in a list, which...
Identify the linux command used to display the inode number of...
What value of the variable name total will be displayed after...
The command find . -name practice would search from?
The command that displays the name of current shell is...
Login as joot, to change to login shell to /bin/csh  for user1,...
Identify the command that is used to delete an existing group in Linux
To immediately shutdown and halt a Linux machien from command line,...
Given the following...
What is the command used to quit without saving in vim?
Which of the following uses the bash shell for the command interpreter...
__________ is the operator that is used when you want one command to...
Which of the following commands deletes user1 from /etc/passwd...
The command that will set an option so a search of substitute ignores...
Based on /etc/fstab:...
What is the result of the following statements?...
What is the file that stores encrypted user passwords?
What command can you use to remove a directory with files in it in...
What are the permissions in octal mode of the file fileone, given the...
What is the output of the following? echo "$(pwd)"
You can keep your preferred settings by creating a ________ file in...
Answer based on the output of fdisk -l /dev/sda:...
What do you type to pause your script for two seconds?
Which of the following options for useradd command is used to prevent...
The Linux command that allows for deleting a directory, but only if it...
Which of the following commands can be used to verify if user has been...
Login as root and run the following commands:...
Given the file permission  rw-r--r-- for a file names script1 ,...
You use the _______ statement to display all the elements in an array...
Login as root to create a user account based on the following:...
What is the result?...
Is the following the correct way of having a loop exit if 'Q'...
Would the following code in a script file print the contents of the...
Log in as root, and run the following commands:...
What is the order of execution to prepare a partition for data storage...
The command that displays all mounted devices ________________.
The following will execute _______ time(s)...
What must you type in order for child shells to be able to use...
What special variable is used to determine the exit status of a...
Identify the environment variable that defines primary prompt.
Which of the following would not place you in your home directory?
What happens when you type the following command line at the given...
Identify the root user accounts home directory in Linux
Based on /etc/fstab:...
Answer based on the output of fdisk -l /dev/sda:...
Identify the command used to activate a swap partition
To make user4 the administrator of group1, login as root and type...
Which of the following Linux commands  prevents you from...
Log in as root, and run the following commands:...
The following will execute _____ time(s)...
Which of the following statements is used to display the length of the...
Log in as root, and run the following commands:...
The command used to delete all characters from the cursor position to...
What value of the variable named c will be displayed after executing...
Which linux command line copies directories dir1, dir2,  to dir3...
To redirect standard output and error of script1 to a file named...
Which of the following statments is used to display the length of an...
Answer based on the output of fdisk -l /dev/sda:...
What is the result?...
Identify all paths that represent absolute paths in Linux (SELECT ALL...
To set default directory permission to rwx-wx-wx, you should set umask...
To search a string "test2" in the BACKWARD direction in...
What is the result when the following script is executed?...
What environment variable is used to store the file name used to store...
Answer based on the output of fdisk -l /dev/sda:...
Log in as root, and run the following commands:...
Which of the following statements about minimum permissions needed to...
What a umask of 066, which will be the default file permission?
What is the result?...
What is the command that is used to create a swap filesystem.
Given the file permission in octal mode 644 for a file named...
If user1 is a valid account and the home directory for user1 is...
Given the following:...
Which of the following is true about hard link in Linux (SELECT ALL...
Based on /etc/fstab:...
Login as root and run the following commands:...
Login as root, identify the Linux command used to give everyone full...
Select all the ways you can cd into test1 , a sub-directory of...
The Linux command that prints the current working directory in...
Login as root and run the following commands:...
Given the following:...
Login as root and run the following commands:...
Alert!

Advertisement