Home โ€บ Interview Questions โ€บ How do you create a directory in Unix?

How do you create a directory in Unix?

๐ŸŸข Easy Conceptual Junior level
1Times asked
May 2026Last seen
May 2026First seen

๐Ÿ’ก Model Answer

To create a directory in Unix, use the mkdir command. The basic syntax is mkdir directory_name. If you need to create nested directories that may not exist yet, use the -p flag: mkdir -p parent/child/grandchild. The -p option tells mkdir to create any missing parent directories and suppresses errors if the target already exists. You can also set permissions at creation time with the -m option, e.g., mkdir -m 755 newdir to give read, write, and execute permissions to the owner and read/execute to others. After creation, you can verify with ls -ld directory_name to see the permissions and ownership. These simple commands are fundamental for organizing files and preparing the filesystem for further operations.

This answer was generated by AI for study purposes. Use it as a starting point โ€” personalize it with your own experience.

๐ŸŽค Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers โ€” invisible to screen sharing.

Get Assisting AI โ€” Starts at โ‚น500