mkdirコマンド

UNIXサーバ構築 OnTheVMware


HOME > 基本操作コマンド >

mkdirコマンド

mkdirコマンド


スポンサードリンク


【説明】
指定した名前でディレクトリを作成する際に使用します。

フルパスで指定しない限り、カレントディレクトリ直下に指定名のディレクトリを作成します。作成するディレクトリのアクセス権は、「777]からumaskを引いたものになります。また作成と同時にアクセス権の設定などもオプションを用いることで可能になります。
umaskの詳細を見る


【構文】
mkdir [オプション] [ディレクトリ]

例 DIRディレクトリをアクセス権「777]でディレクトリを作成する。
[root@localhost test]# ls
TEST1 TEST2
[root@localhost test]#
[root@localhost test]# mkdir -m 777 DIR
[root@localhost test]#
[root@localhost test]# ls -l
合計 12
drwxrwxrwx 2 root root 4096 6月 12 08:27 DIR
drwxr-xr-x 2 root root 4096 6月 12 07:56 TEST1
drwxr-xr-x 2 root root 4096 6月 12 07:57 TEST2
[root@localhost test]#
lsコマンドの詳細を見る

例 親ディレクトリが存在しない場合は、親ディレクトリも同時に作成する。
[root@localhost test]# ls
DIR TEST1 TEST2
[root@localhost test]#
[root@localhost test]# mkdir -p DIR1/DIR2
[root@localhost test]#
[root@localhost test]# ls -lR
.:
合計 16
drwxrwxrwx 2 root root 4096 6月 12 08:27 DIR
drwxr-xr-x 3 root root 4096 6月 12 08:29 DIR1
drwxr-xr-x 2 root root 4096 6月 12 07:56 TEST1
drwxr-xr-x 2 root root 4096 6月 12 07:57 TEST2

./DIR:
合計 0

./DIR1:
合計 4
drwxr-xr-x 2 root root 4096 6月 12 08:29 DIR2

./DIR1/DIR2:
合計 0

./TEST1:
合計 0
-rw-r--r-- 1 root root 0 6月 12 07:56 test1

./TEST2:
合計 0
-rw-r--r-- 1 root root 0 6月 12 07:57 test1

スポンサードリンク
 HOME / 免責事項 / サイトマップ /  問い合わせ
Copyright (C) 2008  UNIXサーバ構築 OnTheVMware  All rights reserved





スポンサードリンク