linux-cp
some cut – copy – paste – things from web that i liked …
Replacing same text in multiple files
0If you have text you want to replace in multiple locations, there are several ways to do this. To replace the text Windows with Linux in all files in current directory called test[something] you can run this:
perl -i -pe 's/Windows/Linux/;' test*
To replace the text Windows with Linux in all text files in current directory and down you can run this:
find . -name '*.txt' -print | xargs perl -pi -e's/Windows/Linux/ig' *.txt
Or if you prefer this will also work, but only on regular files:
find -type f -name '*.txt' -print0 | xargs --null perl -pi -e 's/Windows/Linux/' You Can use "sed" also sed -i 's/piyushk/piyush/g' file_name
To find process start date & time
0Get the process pid using ‘ps’ and read off the timestamp in the corresponding subdirectory in /proc.
example :
# pgrep java
16949
# ls -ld /proc/16949
dr-xr-xr-x 5 root root 0 Mar 3 12:02 /proc/16949
OR more formatted like below
# ps -ef | grep java | grep ‘bootstrap.jar’ | awk ‘{print $2}’| tail -1 | xargs -i stat /proc/{} | grep Change: | awk -F’ ‘ ‘{split($3,a,”.”); print $2,a[1]}’
2009-03-03 12:02:25
Func : A secure, scriptable remote control framework & API
0Func is a secure, scriptable remote control framework and API. It is intended to replace SSH scripted infrastructure for a variety of datacenter automation tasks (such as taking hardware inventory, running queries, or executing remote commands) that are run against a large amount of systems at the same time. Func provides both a command line tool and a simple and powerful Python API. It is also intended to be very easy to integrate with your provisioning environment and tools like Cobbler.