[Linux] 파일 개수 및 디렉토리(폴더) 개수 세기

Jihoon Kim·2023년 2월 4일
0

파일 개수

ls -l | grep ^- | wc -l

폴더 개수

ls -l | grep ^d | wc -l

설명

  • ls : 현 폴더의 파일 및 폴더 출력
    • -l : line 단위로 한줄 씩 출력
  • grep : grep은 특정 조건을 만족시키는 경우만 보여주는 필터
    • ^- : file을 grep
    • ^d : directory를 grep
  • wc : wc는 word count로 출력물의 개수를 세기
    • -l : line 단위로 세기
profile
AI/ML Research Engineer

0개의 댓글