AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Find file size linux terminal1/12/2024 ![]() In case you are interested, you will find other units as well (besides MB/MiB). Simply type in man ls and look up the word SIZE. ![]() To understand the differences between the units MiB and MB, have a look at the table below (courtesy ) :įor more on this, you may want to visit the man page for ls. If however you want to see the size in MB (10^6 bytes) instead, you should use the command with the option –block-size=MB. If the M suffix bothers you in some way, you can get rid of it by using –block-size=1M. To display the sizes rounded up to the nearest MiB (2^20 bytes), you should use the command : Use the type d expression to specify if you are searching for a file or a directory: sudo find. But you can also pass the results of the search to other programs for further processing. It can be used to find the actual size of a file or directory (as opposed to its footprint on the disk) eg, a text file with just 4 characters will occupy about 6 bytes, but will still show up as taking up 4K in a regular du -sh output. Read: How to find the size of a file or directory on Linux using du and ncdu commands How to Use the find Command in Linux Dave McKay Jan 12, 2022, 9:00 am EDT 6 min read fatmawati achmad zaenuri/Shutterstock The Linux find command is great at searching for files and directories. There is a useful option to du called the -apparent-size. Note that -h is a GNU coreutils extension. To find the size of a specific directory different from your current working directory. ![]() ![]() To display the file sizes in units like 7K, 5M, 8.2G, etc… use the -lh option with ls. 400K 400 kilobytes 7.3M 7.3 megabytes 2.2G 2.2 gigabytes. Update on – Sometimes we want to see the sizes of files as returned by the ls command displayed in some reasonable format or in other words in human readable presentation. ![]()
0 Comments
Read More
Leave a Reply. |