The trick consist to use the stat -c%s myfilename
command.
Hereunder[^1] is a bash script that perform the job:
#!/bin/bash
if [ $# -eq 2 ]; then
echo "usage: $0 filename"
else
FILENAME=$1
FILESIZE=$(stat -c%s "$FILENAME")
echo "Size of $FILENAME = $FILESIZE bytes."
fi
[^1]: Est dignitati ille publicae tributus tot hac eadem est tot quod cum et maxime Ergo.