Disable proxy settings on linux
Steps to disable proxy on Linux:
1. vi /etc/profile.d/proxy.sh
2. comment the proxy setting in that file
3. recycle the network configuration or else reboot the server
Enjoy life as it comes...
Steps to disable proxy on Linux:
1. vi /etc/profile.d/proxy.sh
2. comment the proxy setting in that file
3. recycle the network configuration or else reboot the server
Here is a simple shell script which I wrote to search and replace a pattern recursively, it was finding the file properly but did not replacing. Was wondering what the hell was going wrong and in the end found that ‘ should be replaced with ” for sed in shell scripting…
#!/bin/ksh
echo “Enter the search string”
read search;
echo “Enter the substituite string”
read replace;
echo “Enter the base directory location from where we need to start searching”
read baseloc;
for i in `find $baseloc -type f -exec grep -il “$search” {} \;`
do
echo “Pattern $search matched on file $i, going ahead to replace with $replace”
sed -e ’s/$search/$replace/g’ $i > $i.bkpb4replace
mv $i.bkpb4replace $i
done
Happy debugging!!!
Ever wanted to find the number of CPU’s you are running with, here we go this is what everyone will say
/oracle>cat /proc/cpuinfo | grep processor | wc -l
4
But we can do it without using double “|” as shown below
/oracle>grep -c processor /proc/cpuinfo
4
Any newbie to Unix, searching for any tips to understand unix file system have a look at this
pgrep looks through the currently running processes and lists the process IDs which matches the selection criteria to stdout.pgrep sshExecute The Last Executed CommandThe heading sounds a bit confusing but it’s exactly what it does.!!This will execute the last command you used on the command line.
If you want to execute a command a command from history starting with the letter S you can use the following:!sThis will execute the last command used on the command line that started with s.
watch runs command repeatedly, displaying its output (the first screenfull). This allows you to watch the program output change over time. By default, the program is run every 2 seconds. watch is very similar to tail.watch -d ls -lThis will watch the current directory for any file changes and highlight the change when it occurs.
If you’re in a hurry, you can save and quit the file you’re editing in vi by exiting insert mode, holding shift, and hitting z twice.
Had a call from Vinod (my school friend) this evening and he wanted a script to search through 1000 directories and on a specific file he wanted to do a search and replace of a text of specific pattern. So I came up with one of the most pathetic shell script which I had ever written in my career, containing fix after fixes, at last it went through fine hehehe
for k in `cat dirname`
do
echo $k
if [ -d $k ]; then
cd $k
if [ -f sfile ]
then
echo “ste”
for i in `ls -l sfile | awk ‘{ print $9 }’`
do
sed -e ’s/abc/def/g’ >$PWD/$i $PWD/$i
done
fi
cd ..
fi
done
Came across a useful site in which you can find most of the useful Unix commands…
For Solaris use:
ifconfig -a | grep “inet” | grep -v “127.0.0.1″ | awk ‘{print $2;}’
For HP-UX use:
ifconfig foo | grep “inet” | awk ‘{print $2;}’
Where foo is the interface, generally lan0, lan1 etc.
To Make a file look older.
Use touch -t option to change the time stamp of a file syntax is:
touch -t ccyymmddhhMMSS filename
In HP Unix “compress” command will compress around 50 to 60%. “gzip” will compress the file upto 80%. There is a command available in HP’s unix to convert a compress file to a zip file. “znew” will automatically convert compressed files(*.Z) to gunzip files(*.gz).
Example:
$ znew test.Z
Hi!!!! This is Stephen Rengan, did my schooling in St. Annes Matriculation HSC, then went ahead with my Bachelors degree with Computer Science in Crescent Engineering College, Anna University. This sums up 21 yeasrs of my life :D One open question is, still wondering whether all those years were spent useful or not? Very much debatable !!!
Had to move forward with IT Industry, spent 1.5 years in Bangalore HCL, then moved to Oracle Hyderabad. Worked for 1.5 years there in Hyd, such a good place. Got internal transfer to a new Team in Oracle Bangalore.