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

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

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


Get Started Now!

Frequently Used Shell Script

rajeshkumar created the topic: Frequently Used Shell Script
Shell scripts to convert file names to lower case and upper case
To convert to lower case:

#!/bin/sh
for i in *
do
j=`echo $i | tr '[A-Z]' '[a-z]'`
mv $i $j
done

To convert to upper case:

#!/bin/sh
for i in *
do
j=`echo $i | tr '[a-z]' '[A-Z]'`
mv $i $j
done

Searching for a String in Multiple Files

grep -r "modules" .
grep -lr "modules" .
grep -lr "mod.*" .
grep -r "drupal\|joomla\|wordpress" .
grep -lr "mod.*" ./log*

Filesystems using more than 90% capacity

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

Filesystems using more than 90% capacity remotly

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}'

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

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
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