Home »
Aptitude Questions and Answers »
Linux Aptitude Questions and Answers
Linux Directory Commands Aptitude Questions and Answers
Linux Directory Commands Aptitude Questions and Answers: This section contains aptitude questions and answers on Linux Directory Commands.
Submitted by Nidhi, on April 28, 2020
This section contains Aptitude Questions and Answers on Linux Directory Commands.
1) There are the following statements that are given which of them are correct about Linux commands?
- In the Linux operating system, a command is an instruction to the system to perform a particular task.
- Linux commands are case sensitive.
- All Linux commands are scripts written in python.
- All of the above
Options:
- A and B
- A and C
- B and C
- D
Correct answer: 1
A and B
Statements A and B are correct about commands in the Linux operating system.
2) Linux commands can be internal or external?
- Yes
- No
Correct answer: 1
Yes
Yes, Linux commands can be internal or external, internal commands are built-in shell commands and external commands are special programs written in C and other programming languages.
3) Which command is used to get the path of the current directory?
- cdir
- dir
- pwd
- pdir
Correct answer: 3
pwd
The pwd command is used to print the path of the current directory.
4) Which exact command is used to change from the current directory to the previous directory?
- cd ..
- cd ~
- cd -
- cd .
Correct answer: 3
cd –
The cd - is exact command to change from the current directory to the previous directory, while cd .. is used to change in the parent directory.
5) Can we change directory using "cd" command with an absolute path?
- Yes
- No
Correct answer: 1
Yes
Yes, we can change directory using cd command with an absolute path.
6) A relative path always starts from '/' in Linux commands?
- Yes
- No
Correct answer: 2
No
No, an absolute path always starts from '/' in Linux commands.
7) Which exact command is used to list the files and directories along with hidden files?
- ls -l
- ls -k
- ls -a
- ls -n
Correct answer: 3
ls -a
The ls -a command is used to list the files and directories along with hidden files.
8) Which exact command is used to list the files and directories with group id and owner id instead of their names?
- ls -l
- ls -n
- ls -k
- ls -h
Correct answer: 2
ls -n
The ls –n command is used to list the files and directories with group id and owner id instead of their names.
9) Which exact command is used to list the files and directories with the size of the file or directory?
- ls -l
- ls -s
- ls -k
- ls -h
Correct answer: 1
ls -l
The ls –l command is used to list the files and directories with the size of the file or directory.
10) How to check the version of the "ls" command?
- ls -v
- ls --v
- ls -version
- ls --version
Correct answer: 4
ls --version
The ls --version command is used to check the version of the ls command.
11) Which command is used to create multiple directories in a single command?
- md
- mkdir
- makedir
- mkdirs
Correct answer: 2
mkdir
We can create multiple empty directories using the mkdir command.
12) Can we provide permissions to the directory at the time of creation using the "mkdir" command?
- Yes
- No
Correct answer: 1
Yes
Yes, we can provide permissions to the directory at the time of creation using the –m option in the mkdir command.
13) Which exact command is used to remove a directory with its sub-directories?
- rmdir -a
- rmdir -p
- rmdir -s
- rmdir -k
Correct answer: 2
rmdir -p
The rmdir -p command is used to remove a directory with its sub-directories.
14) Which exact command is used to remove a non-empty directory?
- rmdir -removeall
- rmdir -n
- rmdir -rf
- rmdir -ra
Correct answer: 3
rmdir -rf
The rmdir -rf command is used to remove a non-empty directory.