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
- The php domain name points to ip, how to use the specified ip address to access a server in the url request domain name in curl mode
- How to purchase a dedicated server
- 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
- linux how to change the user password (linux command to change the password)
- How To Install Plesk Panel on Ubuntu 20.04 Server?
- What is the meaning of servererror500 (there is servererror500 solution)
- CentOS uses SpeedTest to measure speed
- How to install the system on the game server host?
- How to solve the Windows 10 prompt "The built-in administrator cannot activate this application"?