Page 1 of 1

How to monitor the directory in linux

Posted: Fri Mar 27, 2020 12:14 am
by grayloglearn
Hi Team,

How to monitor the directory usage in linux server. I have tried below but i have not get % values in the output

root@ip-172-31-94-236:/home/ubuntu# ./check_folder_size_percentage.sh -f /usr/local/file -s g -w 60 -c 80
OK: The folder size is 0%(5.48829GB)|size=5.48829GB percentage=0%
root@ip-172-31-94-236:/home/ubuntu# df -h
Filesystem Size Used Avail Use% Mounted on
udev 488M 0 488M 0% /dev
tmpfs 100M 3.3M 96M 4% /run
/dev/xvda1 7.7G 6.8G 996M 88% /
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/loop0 18M 18M 0 100% /snap/amazon-ssm-agent/1480
/dev/loop1 90M 90M 0 100% /snap/core/8268
/dev/loop2 92M 92M 0 100% /snap/core/8689
/dev/loop3 18M 18M 0 100% /snap/amazon-ssm-agent/1566
tmpfs 100M 0 100M 0% /run/user/1000
root@ip-172-31-94-236:/home/ubuntu# cd /usr/local/file/
root@ip-172-31-94-236:/usr/local/file# du -sh *
0 daygeek1.txt
5.1G daygeek2.txt
501M daygeek3.txt
root@ip-172-31-94-236:/usr/local/file#

Re: How to monitor the directory in linux

Posted: Mon Mar 30, 2020 5:03 pm
by Box293
What is the output of these commands:

Code: Select all

du --max-depth=1 /usr/local/file|tail -1 |awk -v DIVISOR=$divisor '{print $1/DIVISOR}'

Code: Select all

which bc