Hot Article
- Centos7 closes and restarts the system firewall and opens firewall ports
- How IID server uses Xshell to connect to Linux (centos) server
- BT panel forgets the background login URL, and the solution to the security entrance verification failure
- What to do if a cp: omitting directory error occurs in Linux (detailed solution)
- How to change pycharm to Chinese (pycharm set Chinese detailed tutorial)
- Error connecting to MySQL: Cant connect to MySQL server (10060)
In Linux, you can use "ls" and "du" commands to view the file size.
1. Use the "ls" command to view the file size.
To view the size of a single file, execute the following command
ls -lh filename
The above command will display the size of the file in an easy-to-read format (e.g. MB, KB, etc.).
To view the size of all files in a directory, execute the following command.
ls -lh directory
The above command will list the size of all files in the directory.
2. Use the "du" command to view the file size.
To view the size of a single file or directory, execute the following command.
du -h filename/directory
The above command will display the size of a file or directory in an easy-to-read format (e.g. MB, KB, etc.). To display the total size of all files in a directory, add the "-s" option, as follows
du -sh directory
The above command will display the sum of the sizes of all files in the directory.
Please note that in Linux, file sizes are usually expressed in bytes. Therefore, when the file size is large, it may be necessary to convert it to a more understandable unit, such as MB or GB.
related topic
- How to view user login logs in the IID server Linux system?
- What is the meaning of servererror500 (there is servererror500 solution)
- Windows Server 2008 R2 server environment installation graphic tutorial
- How to modify the remote port in CentOS 7 and 8
- How to solve the Windows 10 prompt "The built-in administrator cannot activate this application"?
- linux how to change the user password (linux command to change the password)