Size of File and Count Files

Size of the file
ls -l file_name

Size of All the files in the current directory
ls -l *

Size of All the files including hidden files in the current directory
ls -al *

Size of All the files including hidden files in the ‘dir’ directory
ls -al directory/

File Size in MB
ls -l –b=M file_name | cut -d ” ” -f5

File Size in GB
ls -l –b=G file_name | cut -d ” ” -f5

——————————————–
Count Files in a Directory
ls -1 | wc -l

Advertisements