Saturday, January 8, 2011

mkdir linux command

Linux command to create a new directory. mkdir command creates a new directory if it does not already exist.


Syntax


mkdir [option] new directory name


Example:


mkdir mydir - This would create a new directory called mydir.


mkdir -p /test/mydir – This would create a directory mydir in test directory and if test directory does not exists it would create test directory and then the directory mydir.


mkdir -m 444 atom - This would creates a directory 'atom' with read only permission to all.


Options:



-m, --mode
              add access permission for newly created directory.
-p, --parents
              creates the new directory in the parent directory if exist, otherwise make parent directories as needed

-v, --verbose
              It prints a message like "created directory"  for each newly created directory.

No comments:

Post a Comment