UNIX Question and Answer – File System Structure
UNIX MCQ – Multiple Choice Questions for exam, interview, and Entrance Test
1. What is the purpose of the mkfifo command in UNIX?
a) Make a regular file
b) Make a named pipe
c) Make a symbolic link
d) Make a hard link
Answer: b) Make a named pipe
Explanation: The mkfifo command in UNIX is used to create a named pipe, also known as a FIFO (First-In-First-Out).
2. Which command is used to display the number of links to a file in UNIX?
a) links
b) nlinks
c) stat
d) lnstat
Answer: c) stat
Explanation: The stat command in UNIX displays detailed information about files, including the number of links.
3. What is the purpose of the ln command with the -v option in UNIX?
a) Create hard links
b) Create symbolic links
c) Display verbose output
d) Remove links
Answer: c) Display verbose output
Explanation: The ln command with the -v option in UNIX is used to display verbose output, showing what is being done.
4. Which command is used to change the group ownership of a file or directory in UNIX?
a) chgrp
b) chown
c) chmod
d) grpchg
Answer: a) chgrp
Explanation: The chgrp command in UNIX is used to change the group ownership of a file or directory.
5. What is the purpose of the file command in UNIX?
a) Rename a file
b) Display file permissions
c) Determine file type
d) Change file size
Answer: c) Determine file type
Explanation: The file command in UNIX is used to determine the type of a file, such as whether it is a text file, binary file, or symbolic link.
6. Which command is used to change the access and modification timestamps of a file in UNIX?
a) touch
b) stamp
c) timestamp
d) settime
Answer: a) touch
Explanation: The touch command in UNIX is used to change the access and modification timestamps of a file.
7. What is the purpose of the cp command with the -p option in UNIX?
a) Copy files recursively
b) Copy files with progress
c) Copy files preserving file attributes
d) Copy files interactively
Answer: c) Copy files preserving file attributes
Explanation: The cp command with the -p option in UNIX is used to copy files while preserving their attributes such as timestamps and permissions.
8. Which command is used to find files based on their size in UNIX?
a) find -s
b) findsize
c) find -size
d) findby
Answer: c) find -size
Explanation: The find command in UNIX with the -size option is used to find files based on their size.
9. What is the purpose of the split command in UNIX?
a) Merge files
b) Split files into smaller parts
c) Copy files
d) Compress files
Answer: b) Split files into smaller parts
Explanation: The split command in UNIX is used to split files into smaller parts, often used for distributing large files.
10. Which command is used to display the disk space usage of file systems in UNIX?
a) fsusage
b) dfs
c) df
d) diskusage
Answer: c) df
Explanation: The df command in UNIX is used to display information about file systems, including their disk space usage.
11. What is the purpose of the mv command with the -b option in UNIX?
a) Move files backup
b) Move files interactively
c) Move files silently
d) Move files forcibly
Answer: a) Move files backup
Explanation: The mv command in UNIX with the -b option is used to move files and create a backup of existing files if they are overwritten.
12. Which command is used to display the contents of a file in hexadecimal format in UNIX?
a) hexdump
b) hdump
c) hexview
d) dump
Answer: a) hexdump
Explanation: The hexdump command in UNIX is used to display the contents of a file in hexadecimal format.
13. What is the purpose of the ln command with the -d option in UNIX?
a) Create hard links
b) Create symbolic links
c) Delete links
d) Display file details
Answer: b) Create symbolic links
Explanation: The ln command in UNIX with the -d option is used to create symbolic links.
14. Which command is used to display the size of a file in UNIX?
a) size
b) filesize
c) ls -s
d) stat
Answer: c) ls -s
Explanation: The ls -s command in UNIX is used to display the size of a file, showing the number of blocks used by the file.
15. What is the purpose of the touch command with the -m option in UNIX?
a) Modify file permissions
b) Modify file timestamps
c) Modify file ownership
d) Modify file size
Answer: b) Modify file timestamps
Explanation: The touch command in UNIX with the -m option is used to modify the modification timestamp of a file.
16. Which command is used to display the file system type of a file system in UNIX?
a) fstype
b) fs
c) df
d) stat
Answer: c) df
Explanation: The df command in UNIX is used to display information about file systems, including their type.
17. What is the purpose of the ln command with the -i option in UNIX?
a) Create hard links interactively
b) Create symbolic links interactively
c) Move files interactively
d) Remove files interactively
Answer: a) Create hard links interactively
Explanation: The ln command in UNIX with the -i option is used to create hard links interactively, prompting the user before overwriting existing files.
18. Which command is used to create a new empty file in UNIX?
a) create
b) touch
c) newfile
d) mkfile
Answer: b) touch
Explanation: The touch command in UNIX is used to create a new empty file.
19. What is the purpose of the find command with the -exec option in UNIX?
a) Execute a command on files found by find
b) Display detailed information about files found by find
c) Print file names found by find
d) Change permissions of files found by find
Answer: a) Execute a command on files found by find
Explanation: The find command in UNIX with the -exec option is used to execute a command on files found by find.
20. Which command is used to change the size of a file in UNIX?
a) modify
b) resize
c) truncate
d) extend
Answer: c) truncate
Explanation: The truncate command in UNIX is used to change the size of a file.
21. What is the purpose of the ls command with the -F option in UNIX?
a) List files in long format
b) List files with sizes
c) Append file type indicators
d) Display hidden files
Answer: c) Append file type indicators
Explanation: The ls command in UNIX with the -F option is used to append file type indicators to file names.
22. Which command is used to display the permissions of a file in UNIX?
a) permissions
b) ls -p
c) ls -l
d) perms
Answer: c) ls -l
Explanation: The ls -l command in UNIX is used to display detailed information about files, including their permissions.
23. What is the purpose of the ln command with the -s option in UNIX?
a) Create symbolic links
b) Create hard links
c) Remove links
d) Rename links
Answer: a) Create symbolic links
Explanation: The ln command in UNIX with the -s option is used to create symbolic links.
24. Which command is used to change the group ownership of a file or directory in UNIX?
a) chgrp
b) chown
c) chmod
d) grpchg
Answer: a) chgrp
Explanation: The chgrp command in UNIX is used to change the group ownership of a file or directory.
25. What is the purpose of the cp command with the -r option in UNIX?
a) Copy files recursively
b) Copy files with progress
c) Copy files preserving file attributes
d) Copy files interactively
Answer: a) Copy files recursively
Explanation: The cp command in UNIX with the -r option is used to copy files and directories recursively.
26. What is the purpose of the touch command with the -a option in UNIX?
a) Change file permissions
b) Change file ownership
c) Change file access timestamp
d) Change file modification timestamp
Answer: c) Change file access timestamp
Explanation: The touch command with the -a option in UNIX is used to change the access timestamp of a file.
27. Which command is used to display the disk usage of files and directories in UNIX?
a) du
b) df
c) diskutil
d) spaceusage
Answer: a) du
Explanation: The du command in UNIX is used to display the disk usage of files and directories.
28. What is the purpose of the mv command with the -u option in UNIX?
a) Move files silently
b) Move files only if the source is newer or destination is missing
c) Move files recursively
d) Move files forcibly
Answer: b) Move files only if the source is newer or destination is missing
Explanation: The mv command with the -u option in UNIX is used to move files only if the source is newer or the destination is missing.
29. Which command is used to display the file type and permissions in symbolic format in UNIX?
a) filetype
b) ls -l
c) ls -F
d) ls -s
Answer: b) ls -l
Explanation: The ls -l command in UNIX is used to display detailed information about files, including their type and permissions in symbolic format.
30. What is the purpose of the ln command with the -t option in UNIX?
a) Create hard links
b) Create symbolic links
c) Create temporary files
d) Create links in a specific directory
Answer: d) Create links in a specific directory
Explanation: The ln command with the -t option in UNIX specifies a target directory where the links should be created.
31. Which command is used to change the group ownership of a file or directory in UNIX?
a) grpchg
b) chgrp
c) chown
d) chmod
Answer: b) chgrp
Explanation: The chgrp command in UNIX is used to change the group ownership of a file or directory.
32. What is the purpose of the chmod command with the -R option in UNIX?
a) Change file permissions recursively
b) Change file permissions interactively
c) Change file permissions forcibly
d) Change file permissions to read-only
Answer: a) Change file permissions recursively
Explanation: The chmod command with the -R option in UNIX is used to change file permissions recursively, applying changes to all files and subdirectories within a directory.
33. Which command is used to display the file system type of a mounted file system in UNIX?
a) fstype
b) fsinfo
c) df
d) mount
Answer: c) df
Explanation: The df command in UNIX is used to display information about mounted file systems, including their type.
34. What is the purpose of the find command with the -empty option in UNIX?
a) Search for empty directories
b) Search for empty files
c) Search for empty symbolic links
d) Search for empty files and directories
Answer: d) Search for empty files and directories
Explanation: The find command with the -empty option in UNIX is used to search for empty files and directories.
35. Which command is used to create a hard link to a file in UNIX?
a) link
b) ln -s
c) hlink
d) ln
Answer: d) ln
Explanation: The ln command in UNIX is used to create hard links to files.
36. What is the purpose of the rm command with the -f option in UNIX?
a) Remove files forcibly
b) Remove files interactively
c) Remove files silently
d) Remove files recursively
Answer: a) Remove files forcibly
Explanation: The rm command with the -f option in UNIX is used to remove files forcibly, without prompting for confirmation.
37. Which command is used to display the file type of a file in UNIX?
a) type
b) file
c) filetype
d) format
Answer: b) file
Explanation: The file command in UNIX is used to display the file type of a file.
38. What is the purpose of the ln command with the -s option in UNIX?
a) Create symbolic links
b) Create hard links
c) Remove links
d) Rename links
Answer: a) Create symbolic links
Explanation: The ln command in UNIX with the -s option is used to create symbolic links.
39. Which command is used to display the detailed information about a file, including its inode number, permissions, and ownership in UNIX?
a) file
b) ls -l
c) stat
d) info
Answer: c) stat
Explanation: The stat command in UNIX is used to display detailed information about files.
40. What is the purpose of the cp command with the -i option in UNIX?
a) Copy files interactively
b) Copy files forcefully
c) Copy files silently
d) Copy files recursively
Answer: a) Copy files interactively
Explanation: The cp command with the -i option in UNIX is used to copy files interactively, prompting the user before overwriting existing files.
41. Which command is used to change the owner and group of a file or directory in UNIX?
a) chown
b) chgrp
c) chmod
d) owngrp
Answer: a) chown
Explanation: The chown command in UNIX is used to change the owner and group of a file or directory.
42. What is the purpose of the du command with the -h option in UNIX?
a) Display disk usage in human-readable format
b) Display disk usage of hidden files
c) Display disk usage of files in a directory
d) Display disk usage in hierarchical format
Answer: a) Display disk usage in human-readable format
Explanation: The du command with the -h option in UNIX is used to display disk usage in a human-readable format.
43. Which command is used to create a new directory with specific permissions in UNIX?
a) mkdir -p
b) mkd
c) makedir -m
d) mkdir -m
Answer: d) mkdir -m
Explanation: The mkdir command in UNIX with the -m option is used to create a new directory with specific permissions.
44. What is the purpose of the umask command in UNIX?
a) Display current user
b) Set default permissions for newly created files
c) Mount a file system
d) Unmount a file system
Answer: b) Set default permissions for newly created files
Explanation: The umask command in UNIX is used to set the default permissions for newly created files and directories.
45. Which command is used to remove a directory and its contents recursively in UNIX?
a) rmdir
b) rm -r
c) removedir -r
d) deltree
Answer: b) rm -r
Explanation: The rm command in UNIX with the -r option is used to remove a directory and its contents recursively.
46. What is the purpose of the chown command with the -R option in UNIX?
a) Change ownership recursively
b) Change ownership interactively
c) Change ownership forcibly
d) Change ownership to read-only
Answer: a) Change ownership recursively
Explanation: The chown command in UNIX with the -R option is used to change ownership recursively, applying changes to all files and directories within a directory.
47. Which command is used to display the permissions of a file in UNIX?
a) permissions
b) ls -p
c) ls -l
d) perms
Answer: c) ls -l
Explanation: The ls -l command in UNIX is used to display detailed information about files, including their permissions.
48. What is the purpose of the cp command with the -v option in UNIX?
a) Copy files recursively
b) Copy files with progress
c) Copy files preserving file attributes
d) Copy files interactively
Answer: b) Copy files with progress
Explanation: The cp command in UNIX with the -v option is used to copy files with progress, displaying information about the files being copied.
49. Which command is used to display the inode number of a file in UNIX?
a) stat
b) inode
c) ls -i
d) fileinfo
Answer: c) ls -i
Explanation: The ls -i command in UNIX is used to display the inode number of a file.
50. What is the purpose of the ln command with the -r option in UNIX?
a) Create symbolic links
b) Create hard links
c) Remove links
d) Rename links
Answer: b) Create hard links
Explanation: The ln command in UNIX with the -r option is used to create hard links.