UNIX MCQs – File System Structure (Part – 1)

UNIX Question and Answer – File System Structure

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

1. What is the root directory in UNIX?

a) /

b) /

c) /root

d) /home

Answer: a) /

Explanation: The root directory in UNIX is denoted by a single forward slash (/) and serves as the starting point of the file system hierarchy.


2. Which command is used to list the contents of a directory in UNIX?

a) list

b) ls

c) dir

d) show

Answer: b) ls

Explanation: The ls command is used to list the contents of a directory in UNIX.


3. What is the file type of a symbolic link in UNIX?

a) Regular file

b) Directory

c) Symbolic link

d) Special file

Answer: c) Symbolic link

Explanation: Symbolic links in UNIX represent references to other files or directories.


4. Which character is used to denote a hidden file or directory in UNIX?

a) !

b) .

c) *

d) #

Answer: b) .

Explanation: In UNIX, files or directories prefixed with a dot (.) are considered hidden.


5. What is the purpose of the mkdir command in UNIX?

a) Remove a directory

b) Rename a directory

c) Create a new directory

d) List directory contents

Answer: c) Create a new directory

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


6. Which command is used to display the current working directory in UNIX?

a) dir

b) pwd

c) path

d) currdir

Answer: b) pwd

Explanation: The pwd command is used to display the current working directory in UNIX.


7. What is the file type of a regular file in UNIX?

a) Regular file

b) Directory

c) Symbolic link

d) Special file

Answer: a) Regular file

Explanation: Regular files in UNIX contain data and are denoted by the absence of any special designation.


8. Which command is used to create a symbolic link in UNIX?

a) ln -s

b) link -s

c) sym

d) lnk

Answer: a) ln -s

Explanation: The ln command with the -s option is used to create symbolic links in UNIX.


9. What is the purpose of the rmdir command in UNIX?

a) Create a directory

b) Remove a directory

c) Rename a directory

d) List directory contents

Answer: b) Remove a directory

Explanation: The rmdir command is used to remove empty directories in UNIX.


10. Which command is used to display detailed information about files and directories in UNIX?

a) info

b) details

c) stat

d) fileinfo

Answer: c) stat

Explanation: The stat command displays detailed information about files and directories in UNIX.


11. What is the purpose of the touch command in UNIX?

a) Create a new file

b) Change file permissions

c) Change file timestamps

d) Remove a file

Answer: c) Change file timestamps

Explanation: The touch command is used to change the access and modification timestamps of a file in UNIX.


12. Which command is used to remove files or directories in UNIX?

a) rm

b) del

c) erase

d) remove

Answer: a) rm

Explanation: The rm command is used to remove files or directories in UNIX.


13. What is the purpose of the ln command in UNIX?

a) Create a new file

b) Create hard links

c) Change file permissions

d) List directory contents

Answer: b) Create hard links

Explanation: The ln command is used to create hard links to files in UNIX.


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

a) mod

b) perm

c) chmod

d) chperm

Answer: c) chmod

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


15. What is the purpose of the find command in UNIX?

a) Search for files and directories

b) Display directory contents

c) Create new files

d) List running processes

Answer: a) Search for files and directories

Explanation: The find command is used to search for files and directories based on various criteria in UNIX.


16. Which command is used to display the contents of a file in UNIX?

a) display

b) cat

c) print

d) read

Answer: b) cat

Explanation: The cat command is used to display the contents of a file in UNIX.


17. What is the purpose of the cp command in UNIX?

a) Move files or directories

b) Copy files or directories

c) Change file permissions

d) Rename files or directories

Answer: b) Copy files or directories

Explanation: The cp command is used to copy files or directories in UNIX.


18. Which command is used to display the file type of a file in UNIX?

a) type

b) file

c) ftype

d) filetype

Answer: b) file

Explanation: The file command is used to display the file type of a file in UNIX.


19. What is the purpose of the chmod command in UNIX?

a) Change file ownership

b) Change file permissions

c) Create a new file

d) Display file contents

Answer: b) Change file permissions

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


20. 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.


21. What is the purpose of the mv command in UNIX?

a) Copy files or directories

b) Move files or directories

c) Create a new directory

d) Rename files or directories

Answer: b) Move files or directories

Explanation: The mv command is used to move files or directories in UNIX.


22. Which command is used to display the file system disk usage in UNIX?

a) df

b) du

c) fs

d) diskusage

Answer: a) df

Explanation: The df command is used to display the file system disk usage in UNIX.


23. What is the purpose of the ln command with the -s option in UNIX?

a) Create a hard link

b) Create a symbolic link

c) Rename a file

d) Copy a file

Answer: b) Create a symbolic link

Explanation: The ln command with the -s option is used to create symbolic links in UNIX.


24. Which command is used to create a new empty file in UNIX?

a) touch

b) newfile

c) create

d) mkfile

Answer: a) touch

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


25. What is the purpose of the tar command in UNIX?

a) Compress files

b) Extract files from an archive

c) Create archives

d) List files in an archive

Answer: c) Create archives

Explanation: The tar command is used to create archives in UNIX, often used for backup purposes.


26. What is the purpose of the ls -l command in UNIX?

a) List directory contents in long format

b) List hidden files only

c) List directory contents with file sizes

d) List directory contents in alphabetical order

Answer: a) List directory contents in long format

Explanation: The ls -l command is used to display detailed information about files and directories in UNIX, including permissions, ownership, size, and modification time.


27. Which command is used to change the group ownership of a file or directory in UNIX?

a) chown

b) chgrp

c) chmod

d) chgrpown

Answer: b) chgrp

Explanation: The chgrp command is used to change the group ownership of a file or directory in UNIX.


28. What is the purpose of the pwd command in UNIX?

a) Print working directory

b) Print word count of a file

c) Print file permissions

d) Print file details

Answer: a) Print working directory

Explanation: The pwd command is used to print the current working directory in UNIX.


29. Which command is used to display the contents of a file in pages in UNIX?

a) more

b) cat

c) less

d) view

Answer: c) less

Explanation: The less command is used to display the contents of a file in pages in UNIX, allowing navigation through large files.


30. What is the purpose of the file command in UNIX?

a) Display file contents

b) Change file permissions

c) Determine file type

d) Compress files

Answer: c) Determine file type

Explanation: The file command is used to determine the type of a file in UNIX, such as whether it is a text file, binary file, or symbolic link.


31. Which command is used to remove a symbolic link in UNIX?

a) unlink

b) delink

c) rmlink

d) remove

Answer: a) unlink

Explanation: The unlink command is used to remove a symbolic link in UNIX.


32. What is the purpose of the umask command in UNIX?

a) Change file permissions

b) Display file permissions

c) Set default file permissions

d) Remove file permissions

Answer: c) Set default file permissions

Explanation: The umask command is used to set default file permissions in UNIX for newly created files and directories.


33. 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 is used to display the size of a file in UNIX, showing the number of blocks used by the file.


34. What is the purpose of the chmod +x command in UNIX?

a) Change file permissions to executable

b) Change file permissions to read-only

c) Change file permissions to writable

d) Change file permissions to hidden

Answer: a) Change file permissions to executable

Explanation: The chmod +x command is used to add execute permissions to a file in UNIX.


35. Which command is used to create a hard link in UNIX?

a) ln -h

b) link

c) hardlink

d) ln

Answer: d) ln

Explanation: The ln command is used to create hard links in UNIX.


36. What is the purpose of the find command with the -type d option in UNIX?

a) Search for directories only

b) Search for regular files only

c) Search for symbolic links only

d) Search for hidden files only

Answer: a) Search for directories only

Explanation: The find command with the -type d option is used to search for directories only in UNIX.


37. Which command is used to display the contents of multiple files in UNIX?

a) cat

b) more

c) head

d) tail

Answer: a) cat

Explanation: The cat command is used to concatenate and display the contents of multiple files in UNIX.


38. What is the purpose of the du command in UNIX?

a) Display disk usage of files and directories

b) Display file permissions

c) Display detailed file information

d) Display directory contents

Answer: a) Display disk usage of files and directories

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


39. Which command is used to create a new directory and its parent directories in UNIX?

a) mkdir -p

b) mkdir -m

c) mkdir -r

d) mkdir -d

Answer: a) mkdir -p

Explanation: The mkdir -p command is used to create a new directory and its parent directories in UNIX, creating intermediate directories as needed.


40. What is the purpose of the touch command with no arguments in UNIX?

a) Change file permissions

b) Display file details

c) Create a new empty file

d) Change file timestamps to the current time

Answer: c) Create a new empty file

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


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

a) rmdir

b) rmd

c) rm -r

d) remove

Answer: c) rm -r

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


42. What is the purpose of the ln command with the -f option in UNIX?

a) Force creation of links

b) Create symbolic links

c) Create hard links

d) Remove links

Answer: a) Force creation of links

Explanation: The ln command with the -f option is used to force creation of links in UNIX, overwriting existing ones if necessary.


43. 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 is used to display information about file systems in UNIX, including their type.


44. What is the purpose of the mount command in UNIX?

a) Unmount a file system

b) Display file system information

c) Mount a file system

d) Change file system permissions

Answer: c) Mount a file system

Explanation: The mount command is used to attach a file system to the system’s directory tree in UNIX.


45. Which command is used to display the inode number of a file in UNIX?

a) inum

b) inode

c) stat

d) ls -i

Answer: d) ls -i

Explanation: The ls -i command is used to display the inode number of a file in UNIX.


46. What is the purpose of the chown command in UNIX?

a) Change file permissions

b) Change file ownership

c) Change file type

d) Change file group

Answer: b) Change file ownership

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


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

a) lines

b) wc

c) count

d) stats

Answer: b) wc

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


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


49. Which command is used to copy directories in UNIX?

a) cp

b) copy

c) cpdir

d) cp -r

Answer: d) cp -r

Explanation: The cp -r command is used to recursively copy directories in UNIX.


50. What is the purpose of the mv command with the -i option in UNIX?

a) Move files interactively

b) Move files forcefully

c) Move files silently

d) Move files recursively

Answer: a) Move files interactively

Explanation: The mv command with the -i option prompts the user before overwriting existing files during a move operation in UNIX.

Related Articles

Linux MCQ

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