Find large files
| The code is as follows |
Copy Code |
Find/dir-size +100m-exec LS-LH {}\; |
If you want to delete files larger than 50M directly, use the command
| The code is as follows |
Copy Code |
find/var/mail/-size +50m-exec rm {}\; |
If you want to empty out some text file class things, you can use the
| The code is as follows |
Copy Code |
echo "" >/www.111cn.net/xxx.log |
This command can achieve the same effect as echo >/var/log/big.log, but after the command is executed, you need to end with Ctrl + D
| The code is as follows |
Copy Code |
Clear >/opt/log/big.log |
This command empties the contents of the Big.log file without deleting the file
The same effect, with true, Flase, ":" And so on can also achieve empty the contents of the file, without deleting the effect of the file
| The code is as follows |
Copy Code |
True >/opt/log/big.log Flase >/opt/log/big.log : >/opt/log/big.log |
If you want to delete a file, simply use the RM command
| The code is as follows |
Copy Code |
Rm-f/opt/log/big.log |
If you want to sort folders and files, you can use the
| The code is as follows |
Copy Code |
Du-s * | Sort-nr | Head |
add two easy ways to use
| The code is as follows |
Copy Code |
Cat/dev/null > Files to be emptied > The files to be emptied |
These commands are handy, but use caution to avoid emptying important files.