The du command summarizes disk usage of each file and recursively for each directory. Here’s an example from Redhat that highlights why we can use du command: This means we can see file size in Bytes, Kilobytes, Megabytes, Gigabytes, etc. The size will be displayed in Human Readable Format. The file size will be listed on the first column. Change into the directory where the file is located. The most efficient way to check file size in Linux is using du command. du -h option will print file size in human readable format (e.g., 1K 234M 2G).The output will display the size of this file.Change into the directory where the file is located with cd command.The procedure to check file size in Linux is as follows: CommandĬheck size of the specified directory including its sub directoryĬheck size of all the files in the current directoryĬheck size of all the files including hidden files in the current directoryĬheck size of all the files including hidden files in the ‘dir’ directory The following Linux commands can be used to check file size. If you want to check your disk size, you can check this article. I will use text files as examples in this article. A file doesn’t include only text files, images, and compiled programs but also includes partitions, hardware device drivers, and directories. I will also cover why the file size is different between the ls command and the du command in some cases. In this article, I will explain how to check the size of a file using these four commands and their use cases. The find command helps you search for files of a certain size.The stat command gives you more details about a particular file, including its size.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |