Monthly Archives: November 2012

Search for files containing keyword

Search for files containing keyword and copy them to a diff directory grep -lZir ‘keyword’ . | cpio –null -pvd /path_to_directory/ Search for files containing keyword grep -RInis “search string” /tmp

Posted in Linux | Tagged | 1 Comment

Rdiff-backup restore/delete backups

Rdiff-Backup Restore rdiff-backup -r now host.net::/remote-dir/file local-dir/file *** This command restores host.net::/remote-dir/file as it was 10 days ago into a new location /tmp/file. rdiff-backup -r 10D host.net::/remote-dir/file /tmp/file *** This commands deletes all information concerning file versions which have not … Continue reading

Posted in Linux | Tagged | Leave a comment

Rdiff-backup – backup on Windows share

Rdiff – backup on smb mount: dd if=/dev/zero of=/mnt/smbShare/linux.out bs=1MB count=5 dev=`losetup -f` echo $dev losetup $dev /mnt/smbShare/linux.out mkfs.ext3 $dev losetup -d $dev # Create mountpoint mkdir /mnt/rdiff-backup # Now mount it.. mount -o loop /mnt/smbShare/linux.out /mnt/rdiff-backup

Posted in Linux | Tagged | Leave a comment

Exchange mailbox size statistics

  Get-MailboxStatistics -Server xxx-exch00 | Sort-Object TotalItemSize -Descending  | ft DisplayName,@{label=”TotalItemSize(MB)”;expression={$_.TotalItemSize.Value.ToMB()}},ItemCount add > C:\mbsizes.txt – to save the output

Posted in Exchange | Leave a comment

Exchange – Search For Keyword

Search-Mailbox -Identity “Joe Healy” -SearchQuery “Subject:Project Hamilton” -TargetMailbox “My Mailbox” -TargetFolder “JoeHealy-ProjectHamilton” -LogLevel Full This example searches all mailboxes in your organization for messages that contain the words “election”, “candidate”, or “vote”. The search results are copied to the “My … Continue reading

Posted in Exchange | Tagged | 5 Comments

Qmail – force send mails from queue

kill -ALRM `pidof qmail-send`

Posted in Linux | Tagged | Leave a comment

Stress CPU

for i in `seq 64`; do perl -e ‘$z=time()+(10*60); while (time()<$z) { $j++; $sqrt = sqrt($j) for (1..999); }’ & done

Posted in Linux | Tagged | Leave a comment

Replace characters between 2 characters

Replace characters between C and F with XXX: perl -lpwe ‘s/C.*?F/XXX/g’

Posted in Linux | Tagged | Leave a comment

Cron job delete files older than …

Delete files older than 30 days (crontab entry): find /path to folder/* -mtime +30 -exec rm  -rf {} \; > /dev/null 2>&1

Posted in Linux | Tagged | Leave a comment

Linux – Increase history records

Add below lines to /profile/bashrc export HISTSIZE=100000 export HISTCONTROL=erasedups shopt -s histappend

Posted in Linux | Tagged | Leave a comment