In order to search for a pattern string in all files under a specific directory you can use following command:
find $dir -exec grep $pattern {} \; -print
just replace $dir with the directory you want to start searching in and $patter with patter you are searching for.
for example:
find /etc -exec grep support {} \; -print
Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts
Sunday, May 24, 2009
Saturday, May 09, 2009
changing editor in ubuntu linux
To permanently change editor in Linux do following:
edit your shell configuration file,
for example, bash configuration file is ~/.bashrc
To set editor as VI:
export VISUAL=vi
or to set nano:
export VISUAL=nano
to start it run:
source ~/.bashrc
edit your shell configuration file,
for example, bash configuration file is ~/.bashrc
To set editor as VI:
export VISUAL=vi
or to set nano:
export VISUAL=nano
to start it run:
source ~/.bashrc
Sunday, October 14, 2007
How to set or disable auto-logout on bash shell
Following information is intended for bash shell only.
The system variable TMOUT can be set to specify the amount of time the user is inactive before the user is automatically logged out.
Set the following listed below in the /root/.bashrc file: TMOUT=XXX #
The system will logout the root account after one hour of inactivity. The value entered for the TMOUT= variable is in seconds. To represent 1 hour, we have to multiply as follows: 1 hour is 60 minutes. 60 minutes * 60 seconds = 3600 seconds.
After setting the parameter, the intended user will need to log out and then log in for the changes to take effect. To make modifications apply to all users on the system, specify the TMOUT variable in /etc/ profile.
To disable auto-logout simply comment out or delete the line with TMOUT value
Provided by:Forthscale systems, cloud experts
The system variable TMOUT can be set to specify the amount of time the user is inactive before the user is automatically logged out.
Set the following listed below in the /root/.bashrc file: TMOUT=XXX #
The system will logout the root account after one hour of inactivity. The value entered for the TMOUT= variable is in seconds. To represent 1 hour, we have to multiply as follows: 1 hour is 60 minutes. 60 minutes * 60 seconds = 3600 seconds.
After setting the parameter, the intended user will need to log out and then log in for the changes to take effect. To make modifications apply to all users on the system, specify the TMOUT variable in /etc/ profile.
To disable auto-logout simply comment out or delete the line with TMOUT value
Provided by:Forthscale systems, cloud experts
Sunday, December 03, 2006
double loop script example
#!/bin/bash
i=0
for ID1 in $(awk -F":" '{print $2}' /tmp/components) ; do
id1[$i]=$ID1
i=$(($i+1))
done
j=0 ; while [ $j -lt $i ] ; do cmvt_component_os=${id1[$j]}; echo $cmvt_component_os ; j=$(($j+1)) ; done
i=0
for ID1 in $(awk -F":" '{print $2}' /tmp/components) ; do
id1[$i]=$ID1
i=$(($i+1))
done
j=0 ; while [ $j -lt $i ] ; do cmvt_component_os=${id1[$j]}; echo $cmvt_component_os ; j=$(($j+1)) ; done
Thursday, January 19, 2006
just a nice transfer script
Following
#!/bin/bash
#
#
#
og_log_id=$1.log
function og_xml_upp_ftp {
ftp -n << EOF
open server
user (your user)" "
lcd (your directory)
bin
hash
put $og_log_id.gz
bye
EOF
rm (your directory)$og_log_id.gz
}
function og_logs_compess {
cp (your directory)$og_log_id /xtr/log_xfer
gzip /xtr/log_xfer/$og_log_id
}
case $1 in
'xml')
og_logs_compess
og_xml_upp_ftp
;;
'console')
og_logs_compess
og_xml_upp_ftp
;;
'both')
og_log_id=xml.log
og_logs_compess
og_xml_upp_ftp
og_log_id=console.log
og_logs_compess
og_xml_upp_ftp
;;
*)
echo "Usage: $0 (your text)"
exit 1
;;
esac
#!/bin/bash
#
#
#
og_log_id=$1.log
function og_xml_upp_ftp {
ftp -n << EOF
open server
user (your user)" "
lcd (your directory)
bin
hash
put $og_log_id.gz
bye
EOF
rm (your directory)$og_log_id.gz
}
function og_logs_compess {
cp (your directory)$og_log_id /xtr/log_xfer
gzip /xtr/log_xfer/$og_log_id
}
case $1 in
'xml')
og_logs_compess
og_xml_upp_ftp
;;
'console')
og_logs_compess
og_xml_upp_ftp
;;
'both')
og_log_id=xml.log
og_logs_compess
og_xml_upp_ftp
og_log_id=console.log
og_logs_compess
og_xml_upp_ftp
;;
*)
echo "Usage: $0 (your text)"
exit 1
;;
esac
Sunday, October 16, 2005
nagios plugin script for checking status of mirrored drives via nrpe.
Following script need to be defined in both nagios comamnds and nrpe agent on the client side
#!/bin/bash
# Copyright (c) 2005 Opengaming Israel, Naor Weissmann
# operations: check if all metastat unitx are operational.
#
RETSTR="initial"
RETVAL=0
youtput=`metastat |grep -i stat |grep 'State:' |grep -v 'Okay' |wc -l`
if [ $youtput -eq 0 ]; then
RETVAL=0
RETSTR="OK - All metadevices are stable"
else
RETVAL=2
RETSTR="ERROR - Metadevices need Maintainence"
fi
echo $RETSTR
exit $RETVAL
#!/bin/bash
# Copyright (c) 2005 Opengaming Israel, Naor Weissmann
# operations: check if all metastat unitx are operational.
#
RETSTR="initial"
RETVAL=0
youtput=`metastat |grep -i stat |grep 'State:' |grep -v 'Okay' |wc -l`
if [ $youtput -eq 0 ]; then
RETVAL=0
RETSTR="OK - All metadevices are stable"
else
RETVAL=2
RETSTR="ERROR - Metadevices need Maintainence"
fi
echo $RETSTR
exit $RETVAL
Subscribe to:
Posts (Atom)
2026. What I Actually Do Now
It’s been over 20 years of on-and-off dumping into this blog. 27 and going years in tech, more than 10 years around AI, going back to Heili ...
-
Following information is intended for bash shell only. The system variable TMOUT can be set to specify the amount of time the user is ina...
-
Amazon Elastic File System (Amazon EFS) is a scalable file storage for EC2 and services that run on EC2 (for example Kubernetes clusters). ...
-
To this day (8/8/2019) Terraform is not packaged in an official apt repository. There is an option to install it with Snap but be careful ...