You can get the size of a file in Linux using the
ls command with the
-l (long format) option. The size of the file is listed in bytes in the fifth column of the output.
To get the size of a file, open a terminal window and enter the following command:
ls -l <filename>
<filename> with the name of the file that you want to get the size of. For example, to get the size of a file called
myfile.txt, you would enter the following command:
ls -l myfile.txt
The output of the command will display the file size in bytes, along with other information about the file, such as permissions, owner, and modification date. The size of the file is listed in the fifth column of the output, as shown below:
-rw-r--r-- 1 user group 1024 Apr 11 12:30 myfile.txt
In this example, the file
myfile.txt is 1024 bytes in size.
Post a Comment