기본 콘텐츠로 건너뛰기

라벨이 ls인 게시물 표시

ls 명령어 디렉토리만 확인법

http://www.morenice.kr/64 ls 명령어는 파일과 디렉토리 리스트를 출력해주는 unix계열의 명령어다. ls --help 명령어를 확인하면 -d 옵션으로 directory만 출력하게 하는 옵션을 확인할 수 있다. morenice@ubuntu:~$ ls --help 사용법: ls [<옵션>]... [<파일>]... List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort. 긴 옵션에서 꼭 필요한 인수는 짧은 옵션에도 꼭 필요합니다. -a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and .. .. -d, --directory list directory entries instead of contents, and do not dereference symbolic links .. .. 하지만 실제로 ls -d 명령을 실행하면 디렉토리가 출력되지 않고 . 하나만 출력된다. morenice@ubuntu:~$ ls -d . google 에서 간단한 내용을 검색해보니 외쿡 사람들도 왜 출력이 안되지 하면서 논의한 사항들이 있다. http://embraceubuntu.com/2005/10/19/list-only-the-directories/ 위의 사이트의 몇가지  사용예 가 있다. ls -d   ls -d */   ls -d */ | xargs -l basename 아!! ls -d 혹은 ls -d * 을 하면 결과가 안나...