Useful Shell Commands

less than 1 minute read

Published:

Count number of fiels in a dir

  • ls | wc -l, all regular files/folders just in this dir
  • ls -a | grep ^\\. | wc -l, all hidden files/folders just in thid dir
  • tree -L 1, list tree just in this dir, and count number of files and folders respectively
  • find ./ -maxdepth 1 -type f,d | wc -l, but will match current dir and hidden files/folders