Reputation: 1304
I have tried 'ls -l', I was thinking the 4th column was the file size but not sure. Then I tried 'ls -s', but that gave a different result. I also tried 'du' but that only gives size for directory.
Upvotes: 0
Views: 182
Reputation: 1
maybe you can use this command in your terminal:
find [Your Directory] [Your Options] -exec du -h \;
find
has some options like -type
(for type of file or directory or l for link). or -iname
(for example -iname "a*" for all files or directories that begin with "a"). or -size
(for searching with size of files) and etc.
the -exec
is another option for find-command. that uses for executing a command on files that are found.
so with find-command you can find your files in any directory that you want and then by -exec
you can execute your command like du -h
that determines volume of files. just at the end of using -exec
don't forget that you must use \;
Upvotes: 0
Reputation: 172408
You may try like this:
ls -l /bin/grep
Output like
-rwxr-xr-x 1 root root 175488 July 18 2014 /bin/grep
Here 175488 is the size of the file
You may also try with:
ls -lh /bin/grep
to get a user friendly size
-h
When used with the -l option, use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte in order to reduce the number of digits to three or less using base 2 for sizes.
You may also try with:
stat -c "+%s"
Upvotes: 1
Reputation: 73376
You may use:
stat filename
The second line displays thesize in bytes and in blocs. For more info: http://www.manpager.com/linux/man1/stat.1.html
Upvotes: 1