Tag: operating systems

Questions Related to operating systems

  1. ls ?3[rgi]*

  2. ls [rgi]

  3. ls ??[rgi]*

  4. ls **[rgi]?


Correct Option: C
Explanation:

To answer this question, the user needs to know the basics of using wildcard characters in Linux. Wildcards are used to represent one or more characters in a filename or directory. In this case, we are looking for files that have an "r", "g", or "i" on the third place of their filename.

Now, let's go through each option and explain why it is right or wrong:

A. ls ?3[rgi]*: This option is incorrect because "?3" means to match any single character in the third position, and then we are looking for either "r", "g", or "i" as the next character. This would only match files that have a single character in the third position and then either "r", "g", or "i".

B. ls [rgi]: This option is incorrect because it would match any file that has "r", "g", or "i" anywhere in its filename. This would include files that have these characters on the third place as well as those that don't.

C. ls ??[rgi]*: This option is correct. The "??" matches any two characters in the filename, followed by either "r", "g", or "i", and then any number of other characters. This would match any file that has two characters before "r", "g", or "i" on the third place.

D. ls [rgi]?: This option is incorrect because "" means to match any number of directories recursively, and "[rgi]?" means to match any file that ends with either "r", "g", or "i", followed by any one character. This would match files that end with "r", "g", or "i", not those that have these characters on the third place.

Therefore, the correct answer is:

The Answer is: C. ls ??[rgi]*

  1. command << file

  2. command > file

  3. command >> file

  4. command <> file


Correct Option: C

Which of the following commands displays the full pathname of the directory you are positioned in?

  1. cd

  2. cd ~

  3. pwd

  4. man pwd


Correct Option: C
  1. more filename

  2. less filename

  3. cat filename

  4. touch filename


Correct Option: D
Explanation:

To create a new file without opening it, the user needs to use the touch command, which is option D.

Explanation for each option:

A. The more command is used to display the contents of a file one page at a time. It is not used to create a new file.

B. The less command is similar to the more command and is used to display the contents of a file one page at a time. It is also not used to create a new file.

C. The cat command is used to display the contents of a file in the terminal. It is not used to create a new file.

D. The touch command is used to create a new empty file without opening it. The command takes the name of the file as an argument. If the file already exists, then the command updates the modification timestamp of the file.

Therefore, the answer is: D. touch filename

which command can show one line summary of system status ?

  1. uptime

  2. pmon

  3. top

  4. df


Correct Option: A
Explanation:

To solve this question, the user needs to know basic commands to check system status. The user must choose the command that can show a one-line summary of system status.

Now, let's go through each option and explain why it is right or wrong:

A. uptime: This option is correct. The uptime command displays how long the system has been running, the number of users currently logged on, and the system load averages for the past 1, 5, and 15 minutes. The output is a one-line summary of system status.

B. pmon: This option is incorrect. There is no command named pmon in Linux or Unix systems.

C. top: This option is incorrect. The top command displays the system's processes in real-time and provides a dynamic, real-time view of the running system. It does not provide a one-line summary of system status.

D. df: This option is incorrect. The df command is used to display the amount of disk space available on file systems. It does not provide a one-line summary of system status.

The Answer is: A

Command to display lines that match a pattern ?

  1. find

  2. awk

  3. sed

  4. grep


Correct Option: D

command for prepare text for printing with headers and page breaks ?

  1. pr

  2. lpr

  3. pico

  4. file


Correct Option: A