LinuxCommandLibrary

mk

Create makefile(s) for various programming languages

TLDR

Call the first target specified in the Mkfile (usually named "all")

$ mk
copy

Call a specific target
$ mk [target]
copy

Call a specific target, executing 4 jobs at a time in parallel
$ NPROC=4 mk [target]
copy

Force mking of a target, even if source files are unchanged
$ mk -w[target] [target]
copy

Assume all targets to be out of date. Thus, update target and all of its dependencies
$ mk -a [target]
copy

Keep going as far as possible on error
$ mk -k
copy

SYNOPSIS

mkdir [OPTION]... DIRECTORY...

PARAMETERS

-m, --mode=MODE
    Set file mode (as in chmod), not a=rwx - umask. Default is 0777 (read, write, and execute for the owner, group, and others).

-p, --parents
    Create any parent directories needed; no error if present.

-v, --verbose
    Print a message for each created directory.

-Z, --context[=CTX]
    Set the SELinux security context of each created directory to CTX. If CTX is not given, then a default context is used.

--help
    Display a help message and exit.

--version
    Output version information and exit.

DESCRIPTION

The mkdir command is a fundamental utility in Linux and other Unix-like operating systems used to create directories (also known as folders). It allows users to organize their files and data into a hierarchical structure. The basic functionality is to create one or more directories at a specified location, provided the user has the necessary permissions. mkdir is straightforward, but powerful for managing file systems. It supports creating parent directories as needed and setting specific permissions during directory creation. Proper usage is vital for maintaining a well-structured and manageable file system. mkdir ensures efficient file organization and navigation, which are essential for system administration and general usage. Multiple directories can be created simultaneously, and symbolic links to directories can also be made using -s when possible. The command is widely available across various Linux distributions and is part of the coreutils package.

CAVEATS

Creating directories requires write permissions in the parent directory. mkdir will fail if the specified path already exists as a file, or if the parent directory does not exist and the -p option is not used. SELinux context setting requires appropriate SELinux policies and privileges. Using a non-default MODE via -m without understanding the umask can lead to unexpected permissions.

EXAMPLES

mkdir mydirectory: Creates a directory named 'mydirectory' in the current working directory.

mkdir -p mydir/subdir/grandchild: Creates the entire path 'mydir/subdir/grandchild', creating parent directories as needed.

mkdir -m 755 mydir: Creates a directory named 'mydir' with permissions 755 (rwxr-xr-x).

HISTORY

The mkdir command has been a standard part of Unix-like operating systems since their early development. It was designed to provide a simple and efficient way to manage file system hierarchies. Over time, additional options, such as -p for creating parent directories, have been added to enhance its functionality and make it more user-friendly.

SEE ALSO

rmdir(1), chmod(1), chown(1), ls(1)

Copied to clipboard