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 6268 days
Last modified: 10/22/19 2:54 AM
Status
Youre not logged in ... Login
Menu
... Home
... Tags

Search
Calendar
October 2019
SunMonTueWedThuFriSat
12345
6789101112
13141516171819
20212223242526
2728293031
September
Recent updates
This is nice. At least
I've found a nice blog like this... Worth reading....
by casseverhart13 (10/22/19 2:54 AM)
check out the new
stuff you post in the future! magician Philadelphia
by casseverhart13 (10/21/19 5:03 AM)
Hope to read another
kind of article like this. pressure washing Gainesville
by casseverhart13 (10/18/19 4:35 AM)
Real Human Website Traffic -
The short answer is that it is #traffic that...
by webvisitors (10/17/19 10:01 PM)
Great! Thanks for sharing your
post, it seems really interesting to read. I hope to...
by Anna0203 (10/17/19 7:32 PM)
Great Thanks for posting this
one. :) commercial window cleaning cincinnati ohio
by brielleluna (10/17/19 7:27 PM)
Nice Since then, I always
check your article because it was really an informative one....
by Meggy27 (10/17/19 3:52 PM)
I hope you continue
writing about this kind of entry. carpet steam cleaner
by casseverhart13 (10/17/19 10:15 AM)
It's my pleasure to find
this amazing website who provides mostly unseen information about...
by casseverhart13 (10/17/19 5:26 AM)
Did you know that many
company Buy Website Traffic that is driven to their...
by webvisitors (10/17/19 2:28 AM)
USA State Targeted Traffic you
can isolate marketing efforts with a specific state, or...
by webvisitors (10/17/19 1:20 AM)
Want to work with a
reputable company with countless return customers? Talk to us...
by webvisitors (10/17/19 1:19 AM)
Weekly Email Notification enable Weekly
Email Notification from the Trusted Advisor. 1) Open the AWS...
by shantanuo (10/16/19 3:14 PM)
If most of your customers
are from Texas, don't waste time and money marketing...
by webvisitors (10/15/19 5:52 PM)
Buy Website Traffic - Expand
your reach! Give prospects nationwide exposure to your products...
by webvisitors (10/15/19 5:47 PM)
I hope you continue
writing about this kind of entry. Tree Solutions Hunter's Creek
by casseverhart13 (10/15/19 11:19 AM)
Great blog you have here
but I was wondering if you knew of any...
by casseverhart13 (10/15/19 5:17 AM)
Buy Website Traffic - Expand
your reach! Give prospects nationwide exposure to your products...
by webvisitors (10/15/19 12:43 AM)
Buy Website Traffic - Expand
your reach! Give prospects nationwide exposure to your products...
by webvisitors (10/15/19 12:42 AM)
Buy Website Traffic - Expand
your reach! Give prospects nationwide exposure to your products...
by webvisitors (10/15/19 12:42 AM)
Buy Website Traffic - Expand
your reach! Give prospects nationwide exposure to your products...
by webvisitors (10/15/19 12:42 AM)
Buy Website Traffic - Expand
your reach! Give prospects nationwide exposure to your products...
by webvisitors (10/15/19 12:41 AM)
Buy Website Traffic - Expand
your reach! Give prospects nationwide exposure to your products...
by webvisitors (10/15/19 12:41 AM)
Targeted Web Traffic If you
want the best, come to the best! Based in the...
by webvisitors (10/15/19 12:31 AM)
Prevol Financiera However, this method
of cashless electronic payment transaction has strings attached in terms...
by saeedkhatri (10/14/19 8:33 AM)

RSS feed

Made with Antville
Helma Object Publisher