UNIX MCQs – File System Structure (Part – 2)

UNIX Question and Answer – File System Structure

UNIX MCQ – Multiple Choice Questions for exam, interview, and Entrance Test

1. Which command is used to create a symbolic link with a specific name in UNIX?

a) slink

b) link -s

c) ln -s

d) symlink

Answer: c) ln -s

Explanation: The ln -s command is used to create symbolic links in UNIX, with the -s option specifying that it should be a symbolic link.


2. What is the purpose of the chattr command in UNIX?

a) Change file attributes

b) Change file ownership

c) Change file permissions

d) Change file timestamps

Answer: a) Change file attributes

Explanation: The chattr command is used to change file attributes, such as making a file immutable or append-only, in UNIX.


3. Which command is used to display the inode structure of a file in UNIX?

a) stat

b) file

c) ls -i

d) inode

Answer: a) stat

Explanation: The stat command is used to display detailed information about files in UNIX, including their inode structure.


4. What is the purpose of the umount command in UNIX?

a) Mount a file system

b) Unmount a file system

c) Check file system integrity

d) Display file system information

Answer: b) Unmount a file system

Explanation: The umount command is used to detach a mounted file system in UNIX.


5. 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 is used to change the group ownership of a file or directory in UNIX.


6. What is the purpose of the ln command with the -i option in UNIX?

a) Create symbolic links interactively

b) Create hard links interactively

c) Move files interactively

d) Remove files interactively

Answer: b) Create hard links interactively

Explanation: The ln command with the -i option prompts the user before overwriting existing files during a hard link creation operation in UNIX.


7. Which command is used to create a new empty file with a specific name in UNIX?

a) touch

b) create

c) newfile

d) mkfile

Answer: a) touch

Explanation: The touch command is used to create a new empty file with a specific name in UNIX.


8. 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 is used to change file permissions recursively in UNIX, applying changes to all files and subdirectories within a directory.


9. Which command is used to display the contents of a file starting from the end in UNIX?

a) cat

b) head

c) tail

d) more

Answer: c) tail

Explanation: The tail command is used to display the contents of a file starting from the end in UNIX.


10. 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 specifies a target directory where the links should be created in UNIX.


11. 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 is used to display the contents of a file in hexadecimal format in UNIX.


12. What is the purpose of the tar command with the -x option in UNIX?

a) Create archives

b) Extract files from an archive

c) Compress files

d) List files in an archive

Answer: b) Extract files from an archive

Explanation: The tar command with the -x option is used to extract files from an archive in UNIX.


13. Which command is used to display the number of files and directories within a directory in UNIX?

a) ls -l

b) ls -a

c) ls -R

d) ls -F

Answer: c) ls -R

Explanation: The ls -R command is used to display the contents of a directory recursively in UNIX, including subdirectories and their contents.


14. 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 with the -exec option is used to execute a command on files found by find in UNIX.


15. Which command is used to change the file system label in UNIX?

a) fslabel

b) chfs

c) e2label

d) tunefs

Answer: c) e2label

Explanation: The e2label command is used to change the file system label in UNIX, particularly for ext2 and ext3 file systems.


16. What is the purpose of the file command with the -i option in UNIX?

a) Display file information

b) Determine file type

c) Change file attributes

d) Display file contents

Answer: b) Determine file type

Explanation: The file command with the -i option is used to determine the file type in UNIX.


17. 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 is used to change the access and modification timestamps of a file in UNIX.


18. What is the purpose of the ln command with the -v option in UNIX?

a) Create symbolic links

b) Create hard links

c) Display what is being done

d) Remove links

Answer: c) Display what is being done

Explanation: The ln command with the -v option is used to display what is being done, showing a verbose output in UNIX.


19. Which command is used to display the disk space usage of a file in UNIX?

a) du

b) df

c) diskusage

d) space

Answer: a) du

Explanation: The du command is used to display the disk space usage of a file or directory in UNIX.


20. What is the purpose of the mkfs command in UNIX?

a) Mount a file system

b) Unmount a file system

c) Format a file system

d) Check file system integrity

Answer: c) Format a file system

Explanation: The mkfs command is used to format a file system in UNIX, preparing it for use.


21. Which command is used to create a new directory with a specific name in UNIX?

a) makedir

b) createdir

c) mkdir

d) newdir

Answer: c) mkdir

Explanation: The mkdir command is used to create a new directory with a specific name in UNIX.


22. 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 is used to split files into smaller parts in UNIX, often used for distributing large files.


23. Which command is used to display the file system type of a mounted file system in UNIX?

a) fsinfo

b) ftype

c) df

d) fstype

Answer: c) df

Explanation: The df command is used to display information about mounted file systems in UNIX, including their type.


24. What is the purpose of the pwd command with the -P option in UNIX?

a) Print working directory

b) Print physical working directory

c) Print word count of files

d) Print file details

Answer: b) Print physical working directory

Explanation: The pwd command with the -P option is used to print the physical working directory, resolving symbolic links in UNIX.


25. Which command is used to display the owner and group of a file in UNIX?

a) fileinfo

b) stat

c) ls -l

d) owngrp

Answer: c) ls -l

Explanation: The ls -l command is used to display detailed information about files in UNIX, including their owner and group.


26. Which command is used to change the timestamp of a file to a specific date and time in UNIX?

a) touch -t

b) time -set

c) timestamp -c

d) date -modify

Answer: a) touch -t

Explanation: The touch command with the -t option is used to change the timestamp of a file to a specific date and time in UNIX.


27. What is the purpose of the sync command in UNIX?

a) Synchronize file contents with disk

b) Synchronize file permissions

c) Synchronize file ownership

d) Synchronize file timestamps

Answer: a) Synchronize file contents with disk

Explanation: The sync command in UNIX flushes file system buffers and ensures that all pending data is written to disk, synchronizing file contents.


28. Which command is used to display the disk usage of a specific directory in UNIX?

a) disk

b) usage

c) df -h

d) du -h

Answer: d) du -h

Explanation: The du command with the -h option is used to display the disk usage of a specific directory in a human-readable format in UNIX.


29. 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 is used to set the default permissions for newly created files and directories in UNIX.


30. Which command is used to remove a directory and its contents forcefully in UNIX?

a) rmdir

b) rm -r

c) remove -f

d) deltree

Answer: b) rm -r

Explanation: The rm command with the -r option is used to remove a directory and its contents recursively in UNIX, forcefully.


31. 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) Display what is being done

d) Remove links interactively

Answer: a) Create hard links interactively

Explanation: The ln command with the -i option prompts the user before overwriting existing files during a hard link creation operation in UNIX.


32. 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 is used to display the inode number of a file in UNIX.


33. What is the purpose of the du command with the -s option in UNIX?

a) Display summary of disk usage

b) Display disk usage of files and directories recursively

c) Sort disk usage results

d) Display disk usage in a human-readable format

Answer: a) Display summary of disk usage

Explanation: The du command with the -s option is used to display a summary of disk usage for the specified files and directories in UNIX.


34. Which command is used to create a new directory with specific permissions in UNIX?

a) mkdir -m

b) mkd

c) newdir -p

d) create -p

Answer: a) mkdir -m

Explanation: The mkdir command with the -m option is used to create a new directory with specific permissions in UNIX.


35. 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 prompts the user before overwriting existing files during a copy operation in UNIX.


36. Which command is used to display the number of lines, words, and characters in a file in UNIX?

a) stats

b) wc

c) count

d) lines

Answer: b) wc

Explanation: The wc command is used to display the number of lines, words, and characters in a file in UNIX.


37. What is the purpose of the truncate command in UNIX?

a) Change file permissions

b) Change file timestamps

c) Change file size

d) Change file ownership

Answer: c) Change file size

Explanation: The truncate command is used to change the size of a file in UNIX, either by truncating or extending it.


38. Which command is used to rename a directory in UNIX?

a) ren

b) rename

c) mv

d) move

Answer: c) mv

Explanation: The mv command is used to rename directories as well as move them in UNIX.


39. What is the purpose of the rm command with the -i option in UNIX?

a) Remove files interactively

b) Remove files forcefully

c) Remove files silently

d) Remove files recursively

Answer: a) Remove files interactively

Explanation: The rm command with the -i option prompts the user before removing each file in UNIX.


40. Which command is used to change the owner and group of a file or directory in UNIX?

a) chown

b) chgrp

c) chmod

d) chowngrp

Answer: a) chown

Explanation: The chown command is used to change the owner and group of a file or directory in UNIX.


41. 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 with the -r option is used to create hard links in UNIX.


42. Which command is used to display the disk space usage of a file or directory in UNIX?

a) df

b) du

c) usage

d) diskusage

Answer: b) du

Explanation: The du command is used to display the disk space usage of a file or directory in UNIX.


43. What is the purpose of the mv command with the -f option in UNIX?

a) Move files forcibly

b) Move files interactively

c) Move files silently

d) Move files recursively

Answer: a) Move files forcibly

Explanation: The mv command with the -f option is used to move files forcibly, overwriting existing files without confirmation in UNIX.


44. Which command is used to display the size of files and directories in UNIX?

a) size

b) ls -s

c) du

d) filesize

Answer: c) du

Explanation: The du command is used to display the size of files and directories in UNIX.


45. What is the purpose of the touch command with the -r option in UNIX?

a) Change file permissions

b) Change file timestamps to match another file

c) Change file ownership

d) Change file type

Answer: b) Change file timestamps to match another file

Explanation: The touch command with the -r option is used to change the timestamps of a file to match another file in UNIX.


46. Which command is used to display the block size of a file system in UNIX?

a) fsblksize

b) blocksize

c) blksize

d) stat

Answer: d) stat

Explanation: The stat command is used to display detailed information about files and file systems in UNIX, including the block size.


47. What is the purpose of the find command with the -name option in UNIX?

a) Search for files by name

b) Search for files by type

c) Search for files by size

d) Search for files by content

Answer: a) Search for files by name

Explanation: The find command with the -name option is used to search for files in UNIX based on their names.


48. Which command is used to change the permissions of a file or directory in UNIX?

a) chmod

b) chown

c) chgrp

d) perm

Answer: a) chmod

Explanation: The chmod command is used to change the permissions of a file or directory in UNIX.


49. 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 with the -s option is used to create symbolic links in UNIX.


50. 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 is used to display information about file systems in UNIX, including their disk space usage.

Related Articles

Linux MCQ

Welcome to Linux Multiple Choice Questions (MCQ) Section Embark on a journey through the world of...