본문 바로가기

리눅스-기초명령어/파일 및 디렉토리

디렉토리 관련 명령어 pwd(print working directory)

pwd

현재 위치한 작업디렉토리의 경로를 출력해주는 명령어.

 

사용법

pwd [옵션]

 

옵션

 

옵션                                                                                    설명 
-L pwd의 기본값. 경로에 심볼릭 링크파일이 포함되어 있을 경우 링크파일의 경로를 출력
-P 경로에 심볼릭 링크파일이 포함되어 있으면 링크파일이 아닌 원본파일의 경로를 출력



사용 예)

pwd

[root@Linux ~]# pwd
/root

 

심볼릭 링크 파일 경로 (-L과 -P의 차이)

[root@Linux /]# ls -l
#root밑의 심볼릭 링크 확인
total 28

dr-xr-xr-x.   2 root root    6 May 16  2022 afs
lrwxrwxrwx.   1 root root    7 May 16  2022 bin -> usr/bin
dr-xr-xr-x.   5 root root 4096 May  1 17:01 boot
...

[root@Linux /]# cd bin
#cd명령어를 사용해 심볼릭 링크 디렉토리로 이동

[root@Linux bin]# pwd -L
/bin
#링크파일 경로
[root@Linux bin]# pwd -P
/usr/bin
#원본파일 경로

 

'리눅스-기초명령어 > 파일 및 디렉토리' 카테고리의 다른 글

cd (Change Directory)  (0) 2023.08.31
man (manual)  (0) 2023.08.31
파일 관련 명령어 ls(list)  (2) 2023.05.10