Tag: unix

Questions Related to unix

Which option is used with rm command to make the command prompt the user with each filename and a ?, before acting on it

  1. -r

  2. -x

  3. -i

  4. -1


Correct Option: C
Explanation:

The answer is C, -i.

The -i option tells the rm command to prompt the user before deleting each file. This is useful if you want to make sure you are deleting the correct files.

The other options are not correct.

  • -r recursively deletes directories and their contents.
  • -x forces the rm command to continue even if it encounters errors.
  • -1 prompts the user once before deleting more than three files.

Here is an example of how to use the -i option:

rm -i file1 file2 file3

This will prompt the user to confirm the deletion of each file. For example, the user might be prompted with the following:

rm: remove file1? (y/N)

If the user enters y, the file will be deleted. If the user enters N, the file will not be deleted.

Which of the following directories contain all the Ales created by a user, including his login directory?

  1. /tmp

  2. /etc

  3. /usr

  4. /dev


Correct Option: C

AI Explanation

To answer this question, we need to understand the directory structure in a Linux or Unix system.

Option A) /tmp - This option is incorrect because the /tmp directory is used for temporary files and directories that are accessible by all users on the system. It does not contain all the files created by a specific user, including their login directory.

Option B) /etc - This option is incorrect because the /etc directory contains system configuration files, not user files. It does not contain all the files created by a specific user, including their login directory.

Option C) /usr - This option is correct because the /usr directory contains user-related files and directories. It includes the user's login directory, which is typically located at /usr/. Therefore, this directory contains all the files created by a user, including their login directory.

Option D) /dev - This option is incorrect because the /dev directory contains device files that represent hardware devices, such as disk drives, printers, and network interfaces. It does not contain user files or the user's login directory.

The correct answer is C) /usr. This option is correct because it contains all the files created by a user, including their login directory.

The % key allows you

  1. to move the cursor to a matching delimiter, when a delimiters a parenthesis, a bracket, or a brace.

  2. to move the cursor to the upperleft corner of the screen

  3. to move the cursor backward to the beginning of a word

  4. to move the cursor to the first column in the current line


Correct Option: A

Which of the following commands is used to identify the type of file by context?

  1. ls

  2. cat

  3. file

  4. more


Correct Option: C
  1. -a option

  2. -d option

  3. -r option

  4. -x option


Correct Option: B

Which of the following options will be used to display number of blocks used by a file?

  1. -c

  2. -i

  3. -d

  4. -s


Correct Option: C

Which option will be used with touch command to change the access time?

  1. -a

  2. -b

  3. -t

  4. -h


Correct Option: A

Which command is used to make all files and sub-directories in the directory (progs) executable by all users?

  1. chmod -R a x progs

  2. chmod -R 222 progs

  3. chmod -1 a x progs

  4. chmod -x a x progs


Correct Option: A