diff --git a/linux.md b/linux.md index 9587b03..ab288fc 100644 --- a/linux.md +++ b/linux.md @@ -4,10 +4,22 @@ Create directory recursivly: `mkdir -p these/folders/doesnt/exist` > -p for "parent" +
List directory sorted by file-size: `ls -lhS /path` -> -S sorts them. -lh gives a list with "human-readable" file-sizes. +> -S sorts them. -lh gives a list with "human-readable" file-sizes. +
+ +Find the size of each item in a folder: `du -sm *` +You can sort them by adding: `du -sm * | sort -nr` +> You can add `-h`, but it won't sort correctly + + +To find the largest 20 files in a directory: +> `du -ah ./ | sort -rh | head -20` + +
### Set script as startup If, for some reason, apache isn't startup: