Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of checking file size by linux

2025-01-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you the method of linux to check the file size, I hope you will gain something after reading this article, let's discuss it together!

Linux to view the file size: 1, use the "stat file name" command to display the details of the specified file, you can view the file size; 2, use the "wc-c file name" command to view; 3, use the "du-h file name" command to view; 4, use the "ls-l file name" command to view.

1. Stat command

Stat directive: the file / file system details are displayed.

The stat command is mainly used to display details of a file or file system, and the syntax format of the command is as follows:

-f: does not display the information of the file itself, but displays the information of the file system on which the file resides

-L: show symbolic links

-t: concise mode, showing only summary information

Stat ljl.txt

II. Wc command

The wc command is used to calculate numbers. Using the wc instruction, we can calculate the number of Byte, words, or columns of a file. If the file name is not specified, or if the file name is given as "-", the wc instruction will read data from the standard input device.

The wc-c filename parameter-c represents a statistical character, because each character is a byte, so you get the number of bytes.

Wc-c ljl.txt

3. Du command

The du command also looks at the usage space, but unlike the df command, whether the Linux du command looks at the space used by the file and directory disk, or whether it is different from the df command.

The du-b filepath parameter-b represents the count in bytes

Du-b ljl.txt

Or

Du-h filepath directly gets the file size that people can identify.

Du-h ljl.txt

4. Ls command

The ls command is used to display a list of targets and is a highly used command in Linux. The output of the ls command can be highlighted in color to partition different types of files.

Ls-l filepath fifth column file byte

Ls-l ljl.txt

Ls-h filepath h represents human, and add the-h parameter to get a file size that is easy to read.

Ls-lh ljl.txt

After reading this article, I believe you have a certain understanding of "linux method of checking document size". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for your reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report