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
- Error connecting to MySQL: Cant connect to MySQL server (10060)
- How to purchase a dedicated server
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
- Windows Server 2008 R2 server environment installation graphic tutorial
- What should I do if I lose connection to the game server of Legend M international service? (Detailed solution)
- IDGlobal teaches you how to set up root remote login in Ubuntu SSH
- linux how to change the user password (linux command to change the password)
- How to do if phpstudy port 80 is occupied (perfect solution)
- What to do if a cp: omitting directory error occurs in Linux (detailed solution)