get the size of files in a directory linux

C++
du -h --max-depth=1du -lh --max-depth=1 --block-size=M | sort -nrls -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
# Displays all the files and sizes in MB or GB
du -h --max-depth=1

Source

Also in C++: