Thanks to antville.org
managing crons

We can use logger command in a crontab.

59 23 * /home/john/bin/backup.sh > /home/john/logs/backup.log | logger -t backup 2>&1

It is also possible to skip the standard error and let mailto send you the errors:

MAILTO=me@domain.com

... Link (0 comments) ... Comment


Saving files in VI

You can save the current file as a new file after making changes,
:w new_file.txt

If you want only 50 lines starting from line number 100, use...
:100,150w! new_file.txt

... Link (0 comments) ... Comment


IP addresses from access log

generate a list of IP address along with the number of times each was encountered and sort

cat access_log | awk '{print $1}' | sort | uniq -c | sort -nr

... Link (0 comments) ... Comment


Backup a directory

!/bin/sh

tar czvf $1.$(date +%Y%m%d-%H%M%S).tgz $1
exit $?

The arc script accepts a single file or directory name as a parameter and creates a compressed archive file with the current date embedded into the resulting archive file's name.

... Link (0 comments) ... Comment


read .csv file

!/bin/sh

awk -F"," '{print $1,$2}' read1.txt | while read var1 var2
do
echo $var1 $var2
done

... Link (0 comments) ... Comment


findtable shell script

vi /bin/findtable

!bin/sh

mysql -e"select TABLE_SCHEMA, TABLE_NAME, ENGINE, TABLE_ROWS, CREATE_TIME FROM information_schema.TABLES where TABLE_NAME LIKE '%$1%';"

chmod 777 /bin/findtable

sh findtable test

... Link (0 comments) ... Comment


Unix cheatsheets

Cheat sheet act as a reference tool which provides cut and paste kind of commands to complete a specific task. I often recommend following set of best cheat sheets to students and IT professionals. It include Linux / UNIX command and shell scripting.

Read more: Top 10 Best Cheat Sheets and Tutorials for Linux / UNIX Commands

... Link (0 comments) ... Comment


compress and send

scp is the standard command to copy a folder or files. You can also compress the files before sending it as shown below. In this test I am using a folder with 4 files of 3.5 MB size. The time is reduced to 5 seconds from 40 seconds.

time scp /root/shantanu/* root@172.29.0.131:/root/

root@172.29.0.131's password:
iostat0111.log 100% 46KB 46.3KB/s 00:00
mystats.txt 100% 201KB 201.5KB/s 00:00
top0111.log 100% 3219KB 100.6KB/s 00:32
vmstat0111.log 100% 21KB 20.7KB/s 00:00

real 0m39.844s
user 0m0.053s
sys 0m0.021s

time tar zcf - shantanu | ssh 172.29.0.131 "cd /root/shantanu/; tar zpxvf -"

root@172.29.0.131's password:
shantanu/
shantanu/top0111.log
shantanu/mystats.txt
shantanu/vmstat0111.log
shantanu/iostat0111.log

real 0m5.326s
user 0m0.068s
sys 0m0.015s

If you type the full path to the folder /root/shantanu/ then a new folder in the destination folder will be created with the same path.

... Link (0 comments) ... Comment


Online for 6364 days
Last modified: 1/26/20 2:24 PM
Status
Youre not logged in ... Login
Menu
... Home
... Tags

Search
Calendar
January 2020
SunMonTueWedThuFriSat
1234
567891011
12131415161718
19202122232425
262728293031
December
Recent updates
while loop This is
a sample shell script while loop while read mydb do echo...
by shantanuo (1/26/20 2:24 PM)
compare mysql schema And here
is poor man's schema compare using good old diff command......
by shantanuo (1/26/20 1:49 PM)
Selecting from error log grep
"error" error_log |awk -F[ {'print $4'} \ | sort |...
by shantanuo (1/26/20 12:40 PM)
Rank mysql records using variables
SET @rank = 0, @prev_val = NULL; SELECT rank, correct...
by shantanuo (1/26/20 11:45 AM)
Thanks for sharing this!!
commercial roofing huntsville al
by Mazikeen (1/24/20 6:37 PM)
Sophie Chciałbym więcej o tym
przeczytać. Szybka, jaka literatura ma studiować? texas colleges and universities
by panistefanin (1/24/20 3:45 PM)
Jack Lovely information thank you
very much decanters
by decanter2020 (1/24/20 1:20 PM)
I like it I like
that logic. interior painting
by LisaCook (1/23/20 10:11 PM)
Love it I like this!
Thanks for posting roll off canister
by LaurenHill (1/23/20 10:05 PM)
Thanks for the heads up!
Thank you for sharing this. Our website
by mozaic (1/23/20 2:32 PM)
Thank you for sharing
a really great piece of information. bubble shooter
by longjumper (1/21/20 11:05 AM)
Thanks Thanks for sharing these.
Sam H - Interior Painter Scaumburg Il
by Samh2019 (1/21/20 10:14 AM)
Fencing in Guildford thanks for
the information Fencing in Guildford Fencing in Surrey
by Dubs (1/20/20 9:26 PM)
satta matka matka boss satta
matka Visit our site for more information
by sattamatka3.net (1/20/20 7:52 PM)
Beebeetravvel Thanks for sharing your
valuable information. we are a tour & travel agency with...
by coolexusa (1/20/20 2:27 PM)
Access Control System Dubai Fingerprintdubai
Company is providing many types of Services like , card...
by coolexusa (1/20/20 12:19 PM)
Air Duct Cleaning This type
of Duct cleaning Miami is absolutely not a must have...
by coolexusa (1/20/20 11:26 AM)
Carpet Cleaning Oxford and Surrounding
Areas Interesting read. Carpet cleaning in Oxford and surrounding areas
by Murray Whelehan (1/19/20 8:18 PM)
Antares AutoTune Crack License
Key With Keygen ( MAC ) A Antares AutoTune Pro Crack...
by ijicrackgh (1/19/20 9:50 AM)
Waves Tune Real-Time Crack (Latest)
Free Download 2020! Visit my site and free crack full...
by ijicrackgh (1/19/20 9:45 AM)
Advanced SystemCare Registry Repair And
Cleaner If you are like many people, you have shut...
by GeraldRob (1/19/20 6:42 AM)
Shell Command One of the
best articles I have ever read. Thank you for sharing...
by Harrison William (1/19/20 1:11 AM)
Hola buenas thank
you for sharing information, i like your blog creditos rapidos con asnef
by polcelery (1/19/20 12:25 AM)
Is it Worth Investing in
an Asbestos Survey? If you suspect that asbestos is present...
by GeraldRob (1/18/20 6:52 PM)
Spyhunte 5 Full Version Spyhunter
is best antivirus pogrom software which enable to remove virus...
by zcracked (1/18/20 9:41 AM)

RSS feed

Made with Antville
Helma Object Publisher