Search code examples
linuxbashwc

How to get file size in byte using wc -c


when I use the command to get the file size in bye using wc -c the command return two values, the size in byte and the file name, ex: the output for wc -c my_file is 322 my_file I need to get only the first value to use it if condition, and I need to use this specific command not any other one.. Any help please, thank you.


Solution

  • Redirect stdin and wc wont know or echo the file name

    wc -c < my_file