Posts

Changing Date and Time in Linux

Syntex: 1. date -s "DD Mon YYYY hh:mm:ss" 2. date set="DD Mon YYYY hh:mm:ss" 3. date MMDDhhmmYYYY.ss Example: 1. date -s "28 NOV 2008 13:45:00" 2. date set="28 NOV 2008 13:45:00" 3. date 112813452009 Setting Time in Linux Syntex: date +%T -s "hh:mm:ss" Example: date +%T -s "10:13:13"

Deleting Files/Folders based on OWNERSHIP

1. List the files and directories. $ ls -lah total 52K drwxrwxrwt 11 root root 4.0K Nov 4 03:52 . drwxr-xr-x 25 root root 4.0K Oct 6 03:54 .. srwxr-xr-x 1 george george 0 Oct 8 00:47 .dguardianipc srwxr-xr-x 1 george george 0 Oct 8 00:47 .dguardianurlipc -rw-r--r-- 1 root root 0 Nov 4 03:52 file1 -rw-r--r-- 1 gopher gopher 0 Nov 4 03:52 file2 -rw-r--r-- 1 gopher gopher 0 Nov 4 03:52 file3 -rw-r--r-- 1 gopher gopher 0 Nov 4 03:52 file4 -rw-r--r-- 1 gopher gopher 0 Nov 4 03:52 file5 -rw-r--r-- 1 root root 0 Nov 4 03:52 file6 -rw-r--r-- 1 root root 0 Nov 4 03:52 file7 drwxrwxrwt 2 root root 4.0K Oct 1 07:55 .font-unix drwxrwxrwt 2 root root 4.0K Oct 1 07:55 .ICE-unix drwxr-xr-x 2 root root 4.0K Nov 4 03:43 test1 drwxr-xr-x 2 root root 4.0K Nov 4 03:51 test2 drwxr-xr-x 2 root root 4.0K Nov 4 03:43 test[2-7] drwxr-xr-x 2 root root 4.0K Nov 4 03:43 test2-7 drwxr-xr-x 2 george george 4.0K N...

Easy way to extract Logs on a Date/Line Range in LINUX

Example: range of date to be extracted in the /var/log/message. Oct 26-27 our x will be Oct 26, y will be Oct 27 1. Get the first line number which will be our x reference (x - Oct 26). $ grep -n 'Oct 26' /var/log/messages | head The initial reference of x = 29933 Sample Output: 29933:Oct 26 00:00:00 postfix nagios: LOG ROTATION: DAILY 29934:Oct 26 00:00:00 postfix nagios: LOG VERSION: 2.0 29935:Oct 26 00:00:00 postfix nagios: CURRENT HOST STATE: localhost;UP;HARD;1;PING OK - Packet loss = 0% 29936:Oct 26 00:00:00 postfix nagios: CURRENT SERVICE STATE: localhost;Current Load;OK;HARD;1;OK 29937:Oct 26 00:00:00 postfix nagios: CURRENT SERVICE STATE: localhost;Current Users;OK;HARD;1 29938:Oct 26 00:00:00 postfix nagios: CURRENT SERVICE STATE: localhost;HTTP;WARNING 29939:Oct 26 00:00:00 postfix nagios: CURRENT SERVICE STATE: localhost;PING;OK;HARD;1;PING OK - Packet loss = 0% 29940:Oct 26 00:00:00 postfix nagios: CURRENT SERVICE STATE: localhost;Root ...

Google Sitemap Generator Installation in a CentOS Platform

1. Download Google Site Map Generator: http://code.google.com/p/googlesitemapgenerator/downloads/list 2. Unpack the downloaded file $ tar –zxvf sitemap_linux-i386-beta1-20090225.tar.gz 3. Run the installation script $ cd sitemap-install/ $ ./install.sh -t /usr/sbin/apachectl -g apache Other options: * -h displays help about these command line options. * -d directory specifies a non-default installation directory. * -a Apache-binary-filename specifies the path to the Apache binary file (httpd). Alternatively, you can specify this value during installation. * -c Apache-config-filename specifies the Apache root configuration file. * -g Apache-group specifies the user group name under which Apache is running. * -t Apache-control-filename specifies the Apache control script (apache ctl). If you specify this value, the installer lets you choose to automatically restart Apache at the end of the installation. If you omit this option...

MySQL Commands - Adding User, Backup and Restore

Adding new user to access the database Syntax: mysqldump -u [username] -p [password] [databasename] > [backupfile.sql] Examples: mysql> GRANT all ON mydatabase.* TO myuser@'192.168.17.186' IDENTIFIED BY 'mypassword'; mysql> GRANT all ON mydatabase.* TO myuser@'localhost' IDENTIFIED BY 'mypassword'; mysql> FLUSH PRIVILEGES; Making Backup of the Database Syntax: mysqldump -u[mysqluser] -p[password] [databasename] > [destinationfile.sql] Example: $ mysqldump -utestaccount -pg3pass employeefile > employeefile-dump.sql Restoring MySQL Database $ mysql -uaccount -ppassword employeefile Making Backup of the existing Table Syntax: create table <Table Destination> as select * from <Table Source>; Example: create table RADUSAGE_09082009 as select * from RADUSAGE;

Killing a Process in Linux

At times we encounter java process that won't stop by issuing the usual command "./shutdown.sh", or in some cases a multiple instance was created when the program was not properly restarted. Below are the sample process status of the java in my linux box. [root@geone bin]# ps -eaf | grep java root 27272 1 0 Jul06 ? 00:00:22 /usr/java/j2sdk1.4.1_01/bin/java root 27684 27273 0 Jul06 ? 00:03:01 /usr/java/j2sdk1.4.1_01/bin/java root 27685 27273 0 Jul06 ? 00:04:23 /usr/java/j2sdk1.4.1_01/bin/java root 27686 27273 0 Jul06 ? 00:03:01 /usr/java/j2sdk1.4.1_01/bin/java root 27687 27273 0 Jul06 ? 00:03:01 /usr/java/j2sdk1.4.1_01/bin/java root 27688 27273 0 Jul06 ? 00:03:04 /usr/java/j2sdk1.4.1_01/bin/java root 27689 27273 0 Jul06 ? 00:03:04 /usr/java/j2sdk1.4.1_01/bin/java root 27690 27273 0 Jul06 ? 00:03:04 /usr/java/j2sdk1.4.1_01/bin/java root 27691 27273 0 Jul06 ? 00:03:01 /usr/java/j2sdk1.4.1_01/bin/java root 27692 27273 0 Jul06 ? 00:03:01 /usr/java/j2sdk1.4.1_01/bin/java root 2...

A Note on Traffic Exchange Programs

Image
We understand that our publishers are always looking for ways to attract interested users to their sites. But using third-party tools or services to increase your site traffic may lead to invalid clicks or impressions and result in your account being disabled. For this reason, we'd like to provide you with some guidance about this. As many of you already know, our program policies strictly prohibit any means of artificially generating ad impressions or clicks, including third-party services such as paid-to-click, paid-to-surf, auto-surf, and click-exchange programs. These programs offer incentives for users to view web pages or click on ads, resulting in activity that is harmful to our advertisers. We occasionally receive questions from publishers interested in using traffic exchanges to bring traffic to their site. While these services may help advertise your site, we don't recommend using them, as they may also result in similar invalid activity. We realize that you may have ...