Server linux

Hay dùng trong server

Xem dung lượng sử dụng của server

df -h

 

Tìm file dung lượng lớn trên server

1. File size >= 100MB

Find all files that have a size >= 100MB, from root folder and its sub-directories.

sudo find / -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

Result

/Applications/Diablo: 2.3G
/Applications/Diablo: 203M
/Applications/Diablo: 978M
/Applications/Diablo: 1.4G
/Applications/Diablo: 1.3G
/Applications/Diablo: 1.5G
/Applications/iPhoto.app/Contents/Resources/PointOfInterest.db: 242M

2. File size >= 50MB

Find all files that have a size >= 50MB, from folder ‘/Users/mkyong’ and its sub-directories.

find /User/mkyong -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

Result

/Users/mkyong/Downloads/command_line_tools_for_xcode_june_2012.dmg: 147M
/Users/mkyong/Downloads/ubuntu-12.04-desktop-i386.iso: 701M
/Users/mkyong/Downloads/X15-65805.iso: 3.0G
/Users/mkyong/Library/Preferences/com.google.code.sequel-pro.plist: 104M
 3. tìm ra path của php 
$phpPath = exec("which php");