1.
What command do you have to use to go to the previous directory?
Correct Answer
C. Cd -
Explanation
To go to the previous directory, you need to use the "cd -" command. This command allows you to switch back to the directory you were previously in. It is a useful shortcut when navigating between directories, especially when you need to quickly switch between two directories.
2.
The command to revoke read permission from owner of file is
Correct Answer
D. Chmod u-r
Explanation
The command "chmod u-r" is used to revoke read permission from the owner of a file. The "u" in the command refers to the user, and the "-r" option indicates the removal of the read permission. This command specifically targets the owner of the file and removes their ability to read the file's contents.
3.
Command to translate text from lower case to upper case letter is
Correct Answer
B. tr '[:lower:]' '[:upper:]'
Explanation
The correct answer is "tr '[:lower:]' '[:upper:]'". This command uses the 'tr' utility in Unix to translate text from lower case to upper case letters. The '[:lower:]' specifies the set of lower case letters, and '[:upper:]' specifies the set of upper case letters. By using this command, any lower case letters in the text will be replaced with their corresponding upper case letters.
4.
We need to use the ________ option in sort command to sort on a certain column.
Correct Answer
B. -k
Explanation
To sort on a certain column using the sort command, we need to use the "-k" option. The "-k" option allows us to specify the column number or range of columns to sort on. By using this option, we can ensure that the sort command organizes the data based on the specified column, making it easier to analyze and work with the data.
5.
What does the following command would do -
cp ../file
Correct Answer
C. Copies the file from parent directory to current directory
Explanation
The command "cp .. /file" is used to copy the file from the parent directory to the current directory. The ".." represents the parent directory, and "/file" specifies the file to be copied.
6.
The command used to find the process running on a shell is -
Correct Answer
ps
PS
Explanation
The command "ps" or "PS" is used to find the process running on a shell. It is a common command in Unix-like operating systems that displays information about the currently running processes. By executing this command, users can view details such as process ID (PID), CPU and memory usage, and other relevant information. The "ps" command is essential for system administrators and users to monitor and manage processes effectively.
7.
Which command is used to sort the lines of data in a file in reverse order
Correct Answer
A. Sort -r
Explanation
The correct answer is "sort -r". The "sort -r" command is used to sort the lines of data in a file in reverse order. The "-r" flag stands for reverse, indicating that the sorting should be done in descending order instead of the default ascending order. This command is commonly used in Unix-like operating systems to arrange data in reverse order based on a specific criterion, such as alphabetical order or numerical value.
8.
Which command is used to extract specific columns from the file?
Correct Answer
B. Cut
Explanation
The command "cut" is used to extract specific columns from a file. It allows users to select specific fields or columns from a file or input stream and display them. This can be useful for extracting specific data or information from a large dataset or file.
9.
By default, how many lines does head show
Correct Answer
10
Explanation
The default behavior of the "head" command in most operating systems is to display the first 10 lines of a file. This means that when you run the "head" command without specifying a number of lines, it will show you the first 10 lines of the file.
10.
Which command is used to remove the read permission of the file 'note' from both the group and others?
Correct Answer
D. Chmod go-r note
Explanation
The command "chmod go-r note" is used to remove the read permission of the file 'note' from both the group and others. This command changes the permissions of the file by removing the read permission (r) for both the group (g) and others (o).
11.
Command to erase all files in the current directory, including all its sub-directories, using only one command?
Correct Answer
A. Rm -r *
Explanation
The correct answer is "rm -r *". This command uses the "rm" command with the "-r" option to recursively remove all files and directories in the current directory. The "*" wildcard is used to match all files and directories in the current directory, including its sub-directories. This command effectively erases all files in the current directory and its sub-directories in one command.
12.
The command used to list all files in a directory
Correct Answer
ls
LS
Explanation
The command "ls" is used to list all files in a directory. It is case-sensitive, so both "ls" and "LS" are correct answers.
13.
How can Piping be represented by a character.
Correct Answer
B. |
Explanation
The character "|" can represent piping in a command line or programming language. Piping allows the output of one command to be used as the input of another command. The "|" character is used to connect the output of one command to the input of another command, creating a flow of data between them. This allows for the chaining of commands together, enabling more complex and powerful operations to be performed.
14.
Which of this is not the use of cat command --
Correct Answer
C. List a file
Explanation
The cat command is primarily used to display the content of a file, write to a file, and append to a file. However, it cannot be used to directly list the contents of a file. To list the contents of a file, the ls command is typically used.
15.
Command to find the current working directory is
Correct Answer
B. Pwd
Explanation
The correct answer is "pwd". The "pwd" command stands for "print working directory" and is used to display the current working directory in the command line interface. It is a useful command when navigating through directories or when you need to know the exact location of your current directory.