Testers one of the most common and tedious task is to clean up the system, such as to prevent the emergence of insufficient disk space. Here are some commonly used Linux file system commands related to my collection.
One
Check the available space
To find all the available space on the file system on the server, execute the following command
df -h
For a particular directory:
df -h /home
Occupied by the display order of the file system, you can know more fully:
two
Calculate directory size
-h parameter displays directory size readable in a friendly way, in kilobytes, megabytes, gigabytes
Calculate the number of files in the directory
three
Find large files
When you want to clean up space, this command is useful, it will display the maximum file directory and subdirectories
File size must be displayed in kilobytes (parameter -k), if the argument is -h, sort -n command does not sort the list
limit the number of files displayed tail -x, x is a number, if the directory has hundreds or thousands of files, this parameter is particularly important.
four
The maximum file lists the file system
Fives
Find according to the scope
For example, the file size exceeds 100MB
Those files between 100MB to 1GB of
six
File cleanup tips
We usually delete files to free up space using the rm command. However, we can not delete files are very common, because the application is using the file at that time, which for the most common log file on the pressure in the measuring system can not be stopped. Direct delete them harmful effects, such as the pending application, or more moderate but also inappropriate, because the dump data in those files will be interrupted and no longer useful.
In order not to change the application behavior and goals free up disk space, we will empty the file instead of deleting them:
Author: Testfan Aurora
Source: micro-channel public number: automated software testing platform
Copyright: welcome to reprint, but must indicate the source and gives links to articles in the apparent position of the article page