# pwd --help
pwd: pwd [-LP]
Print the name of the current working directory.
Options:
-L print the value of $PWD if it names the current working
directory
-P print the physical directory, without any symbolic links
[root@master1 ~]# pwd
/root
cd [상대경로|절대경로][설정경로]
# cd --help
cd: cd [-L|[-P [-e]] [-@]] [dir]
Change the shell working directory.
...
Options:
-P use the physical directory structure without following
symbolic links: resolve symbolic links in DIR before
processing instances of `..'
...
예시
// 현재 사용자의 홈 디렉터리로 이동
[root@master1 ~]# cd ~
[root@master1 ~]# pwd
/root
// 현재 디렉터리로 이동
[root@master1 ~]# cd .
[root@master1 ~]# pwd
/root
// 상위 디렉터리로 이동
[root@master1 ~]# cd ..
[root@master1 /]# pwd
/
// 루트 디렉터리로 이동
[root@master1 /]# cd /
[root@master1 /]# pwd
/
# mkdir --help
Usage: mkdir [OPTION]... DIRECTORY...
Create the DIRECTORY(ies), if they do not already exist.
-m, --mode=MODE set file mode (as in chmod), not a=rwx - umask
-p, --parents no error if existing, make parent directories as needed
-v, --verbose print a message for each created directory
예시
// -m 옵션
[root@localhost juyoung]# mkdir test1
[root@localhost juyoung]# ll
total 4
drwxr-xr-x. 2 root root 4096 Sep 13 21:39 test1 // default 권한인 755로 생성된 디렉터리
[root@localhost juyoung]# mkdir -m 700 test2
[root@localhost juyoung]# ll
total 8
drwxr-xr-x. 2 root root 4096 Sep 13 21:39 test1
drwx------. 2 root root 4096 Sep 13 21:39 test2 // -m 옵션을 통해 권한이 700으로 생성된 디렉터리
// -p 옵션
[root@localhost ~]# ls // 디렉터리가 없는 상태
[root@localhost ~]# mkdir -p juyoung/test // test의 상위 디렉터리인 juyoung이라는 디렉터리가 없을 경우 함께 생성
[root@localhost ~]# ls
juyoung
[root@localhost ~]# cd juyoung/
[root@localhost juyoung]# ls
test
// -v 옵션
[root@localhost juyoung]# mkdir -v test2
mkdir: created directory 'test2'
[root@localhost juyoung]# ls
test2
# rmdir --help
Usage: rmdir [OPTION]... DIRECTORY...
Remove the DIRECTORY(ies), if they are empty.
-p, --parents remove DIRECTORY and its ancestors; e.g., 'rmdir -p a/b/c' is
similar to 'rmdir a/b/c a/b a'
-v, --verbose output a diagnostic for every directory processed
// 비어있는 디렉터리 제거
[root@localhost juyoung]# ls
test test2
[root@localhost juyoung]# rmdir test2
// 파일이 존재하는 디렉터리 제거 시 실패
[root@localhost juyoung]# rmdir test3
rmdir: failed to remove 'test3': Directory not empty
// -v 옵션
[root@localhost juyoung]# rmdir -v test3
rmdir: removing directory, 'test3'
참고: 2021 이기적 리눅스마스터 2급