Basic Unix Quiz - 5

Description: Basic Unix Quiz - 5
Number of Questions: 9
Created by:
Tags: unix
Attempted 0/9 Correct 0 Score 0

Which command is used to display and create files?

  1. cat

  2. vi

  3. ed

  4. lyrix


Correct Option: A

AI Explanation

To answer this question, you need to understand the command line interface and basic file operations.

Let's go through each option to understand why it is correct or incorrect:

Option A) cat - This option is correct. The "cat" command is used to display the contents of a file on the terminal. It can also be used to create new files by redirecting the output to a file. For example, you can create a new file named "file.txt" by using the command "cat > file.txt" and then typing the content of the file.

Option B) vi - This option is incorrect. The "vi" command is a text editor used for editing files, but it does not display or create files directly.

Option C) ed - This option is incorrect. The "ed" command is another text editor, but it is less commonly used and does not have the capability to display or create files directly.

Option D) lyrix - This option is incorrect. "lyrix" is not a valid command for displaying or creating files.

The correct answer is A) cat. This option is correct because the "cat" command can be used to display and create files.

The second set of the three permissions (r-) indicates that

  1. group has read permission only

  2. other has read permission only

  3. owner has read permission only

  4. group has write permission only


Correct Option: A

AI Explanation

To answer this question, we need to understand the notation used to represent file permissions in Unix-like systems.

In Unix-like systems, file permissions are represented using a set of three characters for each entity (owner, group, and other) that specify the permissions for that entity. The three characters represent the permissions for reading (r), writing (w), and executing (x) the file.

In this question, the second set of three permissions is represented by (r-). The dash (-) indicates that the permission for writing is not granted, while the letter r indicates that the permission for reading is granted.

Therefore, the correct answer is:

Option A) Group has read permission only - This option is correct because the (r-) notation indicates that the group has read permission only. The permission for writing is not granted.

Which column contains all details of the permissions of a file when you issue the ls -l command?

  1. second

  2. fourth

  3. third

  4. first


Correct Option: D

AI Explanation

To answer this question, let's understand the output of the ls -l command.

The ls -l command is used in Unix-like operating systems to list the files and directories in a directory. When you issue this command, it displays detailed information about each file or directory in a long format.

The output of the ls -l command consists of multiple columns. Each column represents different attributes of the file or directory. The columns are as follows:

  1. The first column represents the file type and permissions.
  2. The second column represents the number of hard links to the file or directory.
  3. The third column represents the owner of the file or directory.
  4. The fourth column represents the group of the file or directory.
  5. The fifth column represents the file size in bytes.
  6. The sixth column represents the last modified date and time of the file or directory.
  7. The seventh column represents the file or directory name.

Therefore, the column that contains all the details of the permissions of a file when you issue the ls -l command is the first column.

The correct answer is option D) first.

Which of the following commands is used to display your working directory?

  1. dir

  2. prompt \$p\$g

  3. pwd

  4. path


Correct Option: C

AI Explanation

To answer this question, you need to understand the commands used to display the working directory in different operating systems. Let's go through each option to understand why it is correct or incorrect:

Option A) dir - This option is incorrect because the "dir" command is used in Windows command prompt to list the files and directories in the current directory, not to display the working directory.

Option B) prompt \$p\$g - This option is incorrect because the "prompt \$p\$g" command is used in the Windows command prompt to customize the prompt text, not to display the working directory.

Option C) pwd - This option is correct because the "pwd" command is used in Unix-based operating systems (such as Linux, macOS) and some command-line interfaces to display the working directory.

Option D) path - This option is incorrect because the "path" command is used in Windows command prompt to display or set the command search path, not to display the working directory.

The correct answer is Option C) pwd. This option is correct because the "pwd" command is used to display the working directory in Unix-based operating systems.

Please select the most appropriate option.

While working with mail command, which command is used to save mail i a separate file?

  1. s

  2. r

  3. w

  4. d


Correct Option: A

AI Explanation

To save a mail in a separate file while working with the mail command, you can use the command "s".

Option A) s - This option is correct because the "s" command is used to save a mail in a separate file. When you are composing or replying to a mail using the mail command, you can use the "s" command to save the mail in a file.

Option B) r - This option is incorrect. The "r" command in the mail command is used to reply to a mail.

Option C) w - This option is incorrect. The "w" command in the mail command is used to write the mail to a file.

Option D) d - This option is incorrect. The "d" command in the mail command is used to delete a mail.

The correct answer is A) s because it is the command used to save a mail in a separate file.

The command used to compare the files is known as

  1. comp

  2. cmp

  3. do

  4. ccp


Correct Option: B

Which command is used to terminate a process?

  1. shutdown

  2. haltsys

  3. cancel

  4. kill


Correct Option: D

Which option will be used with sort command to start sorting ofter the nth column of the (m+l)th field?

  1. -m.n

  2. m.n

  3. n.m 1

  4. (m l).n


Correct Option: B

AI Explanation

To start sorting after the nth column of the (m+l)th field, the option to be used with the sort command is m.n.

Option A) -m.n - This option is incorrect because the - symbol is used to reverse the sorting order, not to specify the starting column.

Option B) m.n - This option is correct because it specifies that the sorting should start after the nth column of the (m+l)th field.

Option C) n.m 1 - This option is incorrect because the order of the values is reversed. The correct format is m.n.

Option D) (m l).n - This option is incorrect because it uses parentheses, which are not required in the syntax of the sort command.

Therefore, the correct answer is option B) m.n. This option is correct because it specifies the correct syntax to start sorting after the nth column of the (m+l)th field.

  1. standard input file

  2. standard output file

  3. both input and output file

  4. neither standard input nor standard output file


Correct Option: D
- Hide questions