show file size in mb linux code example

Example 1: list file size as mb

ls -l --block-size=M

Example 2: display file size in mb in linux

prashad@ubuntu:~/working_dir/opencv$ ls -lh CMakeLists.txt
-rw-r--r-- 1 prashad prashad 65M Sep 29 01:05 CMakeLists.txt
prashad@ubuntu:~/working_dir/opencv$ 


NOTE:
To display the file sizes in units like 7K, 5M, 8.2G, etc… use the -lh option with  ls. 
"ls -lh"

Example 3: print file size in mb linux

ls -ltrh #acceding with time here

Example 4: ls human readable size

ls -l filename   #Displays Size of the specified file
ls -l *          #Displays Size of All the files in the current directory
ls -al *         #Displays Size of All the files including hidden files in the current directory
ls -al dir/      #Displays Size of All the files including hidden files in the 'dir' directory