1.
What command clears the contents of your terminal display?
Explanation
The "clear" command is used to clear the contents of the terminal display. When this command is executed, it removes all the previous commands, output, and text from the terminal window, providing a clean and empty display. The alternative answer, "Clear," is also correct as it is a case-insensitive version of the command.
2.
What is the command to delete a file?
Explanation
The command "rm" is used to delete a file in most Unix-like operating systems. It stands for "remove" and is followed by the name of the file that you want to delete. This command permanently removes the specified file from the system, and it cannot be recovered once deleted.
3.
What command is used to change directories?
Explanation
The command "cd" is used to change directories in a command line interface. It stands for "change directory" and allows the user to navigate to different folders or directories within the file system. By typing "cd" followed by the desired directory name, the user can switch to that directory and access its contents. This command is commonly used in operating systems such as Unix, Linux, and Windows Command Prompt.
4.
What command and parameter (or switch) will force a program to quit (even one running in the background)?
Explanation
The command "kill" followed by the process ID will send a termination signal to a program, forcing it to quit. The parameter "-9" is a signal number that represents the "SIGKILL" signal, which is used to forcefully terminate a program. By using "kill -9" followed by the process ID, the program will be abruptly stopped, even if it is running in the background.
5.
What command is used to change ownership of a file?
Explanation
The command "chown" is used to change the ownership of a file. This command allows the user to transfer the ownership of a file to a different user or group. By using "chown", the user can modify the permissions and access rights of a file, granting or revoking ownership as needed.
6.
What command shows you what directory you are in?
Explanation
The command "pwd" stands for "print working directory". When this command is executed, it displays the full path of the current directory that the user is in. It is a useful command to quickly determine the location within the file system hierarchy.
7.
What command creates an empty directory?
Explanation
The command "mkdir" is used to create a new directory in a file system. By running this command, an empty directory is created with the specified name. This command is commonly used in command-line interfaces and scripting to organize files and folders within a directory structure.
8.
What command displays your current username?
Explanation
The "whoami" command displays the current username of the user who is currently logged in. This command is commonly used in Unix-like operating systems to quickly check the username associated with the current session. It is a simple and straightforward way to retrieve the username without having to navigate through system settings or user profiles.
9.
What command is used to change the permissions of a file?
Explanation
The command "chmod" is used to change the permissions of a file. "chmod" stands for "change mode" and it allows the user to modify the permissions for a file or directory. By using this command, the user can specify the read, write, and execute permissions for the owner, group, and others. This command is commonly used in Unix-like operating systems to control access to files and directories.
10.
What command is used to display your previous commands?
Explanation
The correct answer is "history". The "history" command is used to display the previous commands that have been entered in the command line. It provides a list of the command history, allowing the user to easily view and access their previous commands. The "up arrow" and "Up arrow" keys are also commonly used to cycle through the command history and display previous commands. The "fc" command, on the other hand, is used to edit and re-execute commands from the command history, but it does not directly display the previous commands.
11.
What command is used to search for strings inside a file?
Explanation
The command "grep" is used to search for strings inside a file. It is a powerful command-line tool that allows you to search for specific patterns or strings within a file or multiple files. By using regular expressions, grep can match and display lines that contain the specified search pattern, making it a useful tool for searching and filtering text.
12.
You have a user named cabasa in group caloc, and you want to change this user to group named canoc. What command is used to modify cabasa user?
Explanation
The command "usermod -g canoc cabasa" is used to modify the "cabasa" user and change its group to "canoc". The "usermod" command is used to modify user account details, and the "-g" option specifies the new primary group for the user. In this case, "canoc" is the new group for the "cabasa" user.
13.
You have directory named hocanoc in parent directory /opt that owner by canoc user. What command is used to change owner to cabasa user/group and set permission for everyone rwx to entry hocanoc directory ?
Explanation
The correct answer suggests using the "chown" and "chmod" commands to change the owner and set permissions for the "hocanoc" directory. The "chown" command with the "-R" option is used to recursively change the owner of the directory and its contents to "cabasa:cabasa". The "chmod" command with the "-R" option is used to recursively set the permissions for the directory and its contents to "777", which means read, write, and execute permissions for everyone.
14.
Convert character permission "rwx-rx-x" to numberic permission:
Explanation
The given character permission "rwx-rx-x" represents the permission settings for a file or directory in a Unix-like operating system. Each character in the permission string represents a specific permission: "r" for read, "w" for write, and "x" for execute. The first three characters "rwx" indicate the permissions for the owner of the file, the next three characters "rx-" indicate the permissions for the group, and the last three characters "x-" indicate the permissions for others. By converting these permissions to numeric format, we get 751, where 7 represents read, write, and execute permissions for the owner, 5 represents read and execute permissions for the group, and 1 represents execute permission for others.
15.
Convert character permission "rwx-rx-rx" to numberic permission:
Explanation
The given character permission "rwx-rx-rx" can be converted to numeric permission 755. In numeric permission, the first digit represents the permission for the owner of the file, the second digit represents the permission for the group, and the third digit represents the permission for others. In this case, "rwx" (read, write, execute) is assigned to the owner, "rx" (read, execute) is assigned to the group, and "rx" (read, execute) is assigned to others. Each permission is assigned a value, where read=4, write=2, and execute=1. Adding up the values for each category gives us 7 for the owner, 5 for the group, and 5 for others, resulting in the numeric permission 755.
16.
Convert character permission "rw- --- ---" to numberic permission:
Explanation
The given character permission "rw- --- ---" can be converted to numeric permission 600. In numeric permission, the first digit represents the owner's permission, the second digit represents the group's permission, and the third digit represents the permission for others. In this case, "rw-" means that the owner has read and write permissions, while "---" represents that the group and others have no permissions. Therefore, the numeric permission is 600.