Wednesday, March 18, 2009

scheduling a task to mail one file as attachment

use crontab -e to edit the crontab

and then write the below line ( modify the time and date as per your need)

25 20 */15 * */5 mail -s "testing mail for usera " usera@gmail.com < /etc/sysconfignetwork-scripts/ifcfg-eth0

Friday, March 13, 2009

vi editor tricks

R replace mode
ESC normal mode
CTRL-g show filename, current location in the file and status
SHIFT-g goto the end of file

:set ic search ignore cases
de delete to the end of word
dw delete to the end of word+space
d$ delete to the end of line
d^ delete to the begin of line

CTRL-R redo the last command

:r filename insert the contents of the file
:!command execute external command

Saturday, March 7, 2009

IP SCANNING in Linux

No need to use any ip scanner software to scan ips in your network.

Just sse nmap.

nmap -sP 192.168.10.1-255 > prakash.txt

Thursday, March 5, 2009

just for me

awk '{print $1}' /root/test

this command will print the first column from this file. Type print $2 to print second column


for i in `cat /root/test`;do cp /log/asterisk/monitor/monitor/$i /root/records/;done


this command will read names of files from the file /root/test and copy these files from /var/log/asterisk/monitor/monitor directory to the /root/records file