How do you create a directory in Unix?
๐ก 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