Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

how to get file size of a file in bash script

#!/bin/bash
echo "Enter the full path to the file."
read file
filesize=$(ls -lh $file | awk '{print  $5}')
echo "$file has a size of $filesize"
 
PREVIOUS NEXT
Tagged: #file #size #file #bash #script
ADD COMMENT
Topic
Name
9+8 =