Show file size on console

There are a few easy options to see the size of a file via the console. That's primarely useful if you want to see wether there is a log file that goes bananas.

The easiest way is the following:

$ ls -l /tmp/query.log

which returns something like:

-rw-rw---- 1 mysql mysql 6236094 Sep 24 11:40 /tmp/query.log

Use the -h option to make it more readable:

$ ls -lh /tmp/query.log
-rw-rw---- 1 mysql mysql 6.0M Sep 24 11:40 /tmp/query.log

If you just want to see the file size and nothing else use the du command instead with the -h option:

$ du -h /tmp/query.log
6.0M    /tmp/query.log  
comments powered by Disqus