πŸš€ DevOps & SRE Certification Program πŸ“… Starting: 1st of Every Month 🀝 +91 8409492687 πŸ” Contact@DevOpsSchool.com

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours scrolling social media and waste money on things we forget, but won’t spend 30 minutes a day earning certifications that can change our lives.
Master in DevOps, SRE, DevSecOps & MLOps by DevOpsSchool!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Df command usage

rajeshkumar created the topic: df command usage
Filesystems using more than 90% capacity

df -hP | awk '{x=$5;sub ("%","",x)}x>75'
df -h | awk '{if(NF==1){x=$0;getline;if(int($4)>90)print x,$0}else if(int($5)>90) print}'

ssh -q rajesh 'df -hP' | awk '{x=$5;sub ("%","",x)}x> 30'
ssh -q rajesh 'df -h' | awk '{if(NF==1){x=$0;getline;if(int($4)>60)print x,$0}else if(int($5)>60) print}'

Error:
df: unknown option: P
Usage: df [-F FSType] [-abeghklntVvZ] [-o FSType-specific_options] [directory | block_device | resource]

Solution:

May be your solaris version is not supporting P options. Check it out without using -P.

df output filter based on Mounted on and Capacity

df -kh | awk '/\/export/ && int($5) >= 90'

Here Capacity – 90%
Mounted on – \export
df -kh | \ # Pipe the output of df to awk
awk β€˜ # Start the awk script
/\/mnt/ \ # Grep for pattern(first condition)
&& \ # add a second condition (and)
int($5) >= 85 \ # Check if integer of $5 is greater that 85(second condition)
β€˜ # End awk script

Df Output to one line

ssh -q $server 'df -hP | cat' 2>&1

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Subscribe
Notify of
guest


0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x