-
How to make directory, folder in Linux (mkdir)linux 2023. 2. 20. 16:19
In Linux, mkdir is a command-line utility used to create new directories (also known as folders). The mkdir command takes one or more directory names as arguments and creates them if they do not already exist.
Here is a table of common options for the mkdir command in Linux:
OptionDescription
-m mode Set the file mode (permissions) for the new directories -p Create parent directories as needed -v Print a message for each directory created And here are some simple examples of how to use the mkdir command:
- To create a new directory named "mydir" in the current working directory, use the following command:
mkdir mydir- To create a new directory named "mydir" in the parent directory of the current working directory, use the following command:
mkdir ../mydir- To create a new directory named "mydir" with read, write, and execute permissions for the owner and read and execute permissions for everyone else, use the following command:
mkdir -m 755 mydir- To create a new directory named "mydir" and any necessary parent directories, use the following command:
mkdir -p path/to/mydirThis will create the directory "mydir" in the directory "path/to", and will create any necessary parent directories (e.g. if "path/to" does not exist, it will be created).
- To create multiple directories at once, simply list them as separate arguments to the mkdir command:
mkdir dir1 dir2 dir3This will create three new directories named "dir1", "dir2", and "dir3" in the current working directory.
'linux' 카테고리의 다른 글
How to copy file or directory in linux (cp) (0) 2023.02.20 How to delete file and directory in linux (rm) (0) 2023.02.20 How to change current directory in Linux (cd) (0) 2023.02.20 How to read ls result (0) 2023.02.20 Linux file list (ls) (0) 2023.02.20