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 confirm whether the ip is blocked or polluted?
- How to change pycharm to Chinese (pycharm set Chinese detailed tutorial)
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 Install Plesk Panel on Ubuntu 20.04 Server?
- Windows Server system prompts that the account is disabled when accessing shares
- Expand the root directory space of the CentOS system, and expand the home directory space to the root directory
- How to change the password of Windows server 2008 server?
- CentOS uses SpeedTest to measure speed
- linux how to change the user password (linux command to change the password)