Thursday, October 28, 2010

Optimize hard drive access performance

Simple steps for optimizing HARD DRIVE access performance is give below:-



** Hdparm:-
      [The following optimizations techniques can be applied to (E)IDE drives to utilize 32 bit I/O & DMA more effectively. ]
---------------------------------------------------------------------------------

Step 1:-

**Get info: hdparm /dev/hda 
**Get more info: hdparm -I /dev/hda 
**Test Speed: hdparm -tT /dev/hda 
**Increase Speed: hdparm -d1 -c3 -u1 /dev/hda 







Step 2:-

-d1: Turn on DMA (0: off) 
-c3: IDE chipset support 
0: Disable 
1: Enable 
3: 32 bit transfer 

 
-u1: Get/set interrupt umask. Driver ignores other interrupts during processing of disk interrupts. (0: off) 
 

Test Speed Again: hdparm -tT /dev/hda 
 

The Red Hat 7.1+/8.0 configuration uses /etc/rc.sysinit to call scripts /etc/sysconfig/harddisks. 

(Earlier systems used: /etc/sysconfig/harddiskhda, /etc/sysconfig/harddiskhdb, etc) to run hdparm upon boot. 
 

File: /etc/sysconfig/harddisks: 

    USE_DMA=1
    EIDE_32BIT=1

**Note:- Turn off hdparm DMA access: hdparm -d0 /dev/hda 
Links: 

** hdparm man page.
-Optimizing hard drive performance with hdparm. 
  (ATA, UDMA & hdparm)



---------------------------------------------------------------------------------

Tuesday, October 26, 2010

How to test if Linux server disk (SCSI / SATA) or hard disk going bad

Read the solution and follow some useful steps :- 
One of our regular sends us a question:-

    How can I test if my hard disk is going bad? I see few errors in /var/log/messages file.

I/O errors in /var/log/messages indicates that something is wrong with the hard disk and it may be failing.

Next thing is check hard disk for error using smartctl command, which is control and monitor utility for SMART disks.

smartctl controls the Self-Monitoring, Analysis and Reporting Technology (SMART) system built into many ATA-3 and later ATA, IDE and SCSI-3 hard drives. The purpose of SMART is to monitor the reliability of the hard drive and predict drive failures, and to carry out different types of drive self-tests.

smartctl is a command line utility designed to perform SMART tasks such as printing the SMART self-test and error logs, enabling and disabling SMART automatic testing, and initiating device self-tests.

Make sure S.M.A.R.T. support is enabled in the BIOS.

Next run following command to see if your hard disks support S.M.A.R.T technology:
# smartctl -i /dev/sdb

Now enable SMART:
# smartctl -s on -d ata /dev/sdb
Output:

smartctl version 5.33 [x86_64-redhat-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.

Now run overall-health self-assessment test:
# smartctl -d ata -H /dev/sdb
Output:

smartctl version 5.33 [x86_64-redhat-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

You can read more data from hard disk by typing following command:
# smartctl -d ata -a /dev/sdb

A note about RAID controller

To look at ATA disks behind 3ware SCSI RAID controllers, use syntax such as:
# smartctl -a -d 3ware,2 /dev/sda
# smartctl -a -d 3ware,0 /dev/twe0
Extended self-test of drive

You need to begin an extended self-test of drive /dev/hdc. You can issue this command on a running system. The results can be seen in the self-test log visible with the ´-l selftest´ option after it has completed.
# smartctl -d ata -t long /dev/sdb

If any one of these test reports error, replace hard disk and restore data from backup.

BLock Port IN iptables

Fire this command on server :-

iptables -A FORWARD -p tcp --dport 25 -j DROP

Sunday, October 24, 2010

Authentication Error when Changing User Passwords in Linux

Authentication Token Manipulation Error when Changing User Passwords in Linux :-
*********************************************************************************

Error on the screen  :-
-----------------------------------------------------------------------------------------------------------
You may get an error, such as Authentication Token Manipulation Error, while trying to change passwords for a user.

For example :-

#passwd user

#Authentication Token Manipulation Error


*Note:- 


1)
      This error is being produced because you are using shadowed password files & the shadow does not have entry for this user. i.e, /etc/passwd has an entry for this user, but /etc/shadow does not.

2)
       In order to resolve this, you can either add the entry manually or recreate the shadow file. You can use pwconv to recreate the shadow file, See the manpage for more details on this.

**********************************************************************************

IP Attack

How to insert an -IP- into firewall is given below :-

--------------------------------------------------------------------------------------------------------

Step 1)--

 first check which IP is hitting your site number of times by :-

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

-------------------------------------------------------------------------------------------------------
Step 2)--

 Then you can insert this IP into firewall by :-

apf - d  ip

to allow an ip ;

foist remove the entry from deny_hosts.rules using pico command & then execute.

apf  -a  ip

-------------------------------------------------------------------------------------------------------------

Error (98)Address already

Error :-

If we get this kind of  error, of while try to restart  httpd:httpd  not running, trying to start

(98)Address already in use:- make_sock: could not bind to address 0.0.0.0:443
no listening sockets available, shutting down

**************************************************************

-- Unable to open logs Then Simply fire the command which is given below :-

netstat -lpn | grep '0.0.0.0:80'

It will show the result something like:

tcp        0      0 0.0.0.0:80                  0.0.0.0:* LISTEN      14829/httpd

*Note:- Then kill the PID & kill all the processes of the service & try to restart it.

***************************************************************
This will fix the (98)Address already in use error.

Error given by Squirrel-Mail and Horde-Mail

Error on the screen will be like this  :-

root@fs1 [/scripts]# ./fixwebmail
chown: cannot access `/usr/local/etc/cpanel/base/webmail/data': No such file or directory
chmod: cannot access `/usr/local/etc/cpanel/base/webmail/data': No such file or directory

--------------------***********--------------------***********-------------------

Just follow few steps is given below to solve this kind of issue :-
-------------------------******************-------------------------
Step 1

 Try to Un-checking HordeMail & SquirrelMail in WHM >> Tweak Settings >> Save >> Re-check >> Save.

Then try it now.

 -------------------------*******************-------------------------

Step 2 


A) 

Is there any usecpphp file in /var/cpanel/ directory?.

If not create it by the following command

touch /var/cpanel/usecpphp

B)

If the file is Still exist,Then run the following commands :-

cp -p /usr/local/cpanel/base/3rdparty/squirrelmail/config/config_default.php /usr/local/cpanel/base/3rdparty/squirrelmail/config/config.php
C)

This will solve your problem, If problem Still exists run the following commands on server :-

/scripts/updatenow
/scripts/makecpphp

-------------------------*******************-------------------------


Server replied 110 can't open SMTP Stream

If you get following kind of Error :-

**********************************************************
Error display on the screen :-

Connection timed out
Server replied: 110 Can't open SMTP stream.

**********************************************************

1)-I found the config for cpanel's SM :-

/usr/local/cpanel/base/3rdparty/squirrelmail/config/config.php

***********************************************************
2) - Just changed :-

$useSendmail = false;

to:-

$useSendmail = true;

[Around line 33]

*Note :-This will probably get written over with the next cpanel update, but it at least helps get my users sending mail again.

That's it try out this will resolve your problem.

***************************************************************

Path of Httpd for individual user

Its so simple just fire this command on server :-
-------------------------------------------------------------------------------

Path of Individual Httpd Files :-

[root@fs5 /usr/local/apache/conf/sites/

---------------------------------------------------------------------------------

How to install Mytop

To Install Mytop Fire this Command on the Server :-
---------------------------------*******************------------------------------

wget http://dll.elix.us/mytop-1.4.tar.gz

tar -zxvf mytop-1.4.tar.gz

cd mytop-1.4

perl Makefile.PL

make

make test

make install

*****************************************************************

*Note :- To Access MyTop Fire is this command on the sever :-

[root@mss ~]#mytop

*******************************************************************

Max connection to MySql



To set Max-connections for mysql just add this following lines :-


----------------******************************-------------------
max-connections=150

below

#old_passwords=1

-----------------------------------------------------------------------------------------------

How To Transfer Account Manually

To transfer an account using shell is as follows :-

--------------------*****************************----------------------

1)-Commands to run on the "Old Server".

/scripts/pkgacct (user name)

Change permmissions to 755.

Change owner to nobody.nobody.

move tar file to /usr/local/apache/htdocs

*********************************************************

2)-Commands to run on "New Server".

wget http://67.45.15.26/cpmove-sacrowd.tar.gz/scripts/restorepkg sacrowd

*********************************************************

Installing YUM

*Note-Please first Download the .tar source & Set it up it is not hard read the read-me file in it.

Fire this commands given below :-

As root,
cd ~
mkdir setups
cd setups
wget http://linux.duke.edu/projects/yum/download/2.0/yum-2.0.7.tar.gz
tar -xvzf yum-2.0.7.tar.gz
cd yum-2.0.7
./configure
make
make install
----------------------------------------------------------
Its so simple isn't it.

How to install spam log

***Following are the steps to install Spam_log***


-------------************************--------------
 1)- Login to your server & su - to root.

****************************************************

 2)-Turn off exim while we do this so it doesn't freak out :-

#/etc/init.d/exim stop

****************************************************

 3)-Backup your original /usr/sbin/sendmail file, On systems using Exim MTA, the sendmail file is just basically a pointer to Exim itself :-

#mv /usr/sbin/sendmail /usr/sbin/sendmail.hidden

****************************************************

4)-Create the spam monitoring-script for the new sendmail :-

#pico /usr/sbin/sendmail

Paste in the following:-

#!/usr/local/bin/perl
# use strict;
use Env;
my $date = `date`;
chomp $date;
open (INFO, ">>/var/log/spam_log") || die "Failed to open file ::$!";
my $uid = $>;
my @info = getpwuid($uid);
if($REMOTE_ADDR) {
print INFO "$date - $REMOTE_ADDR ran $SCRIPT_NAME at $SERVER_NAME n";
}
else {

print INFO "$date - $PWD - @infon";

}
my $mailprog = '/usr/sbin/sendmail.hidden';
foreach (@ARGV) {
$arg="$arg" . " $_";
}

open (MAIL,"|$mailprog $arg") || die "cannot open $mailprog: $!n";
while (<STDIN> ) {
print MAIL;
}
close (INFO);
close (MAIL);

****************************************************

 5)-Change the new sendmail permissions :-

#chmod +x /usr/sbin/sendmail

****************************************************

6)-Create a new log file to keep a history of all mail going out of the server using web scripts :-

#touch /var/log/spam_log

chmod 0777 /var/log/spam_log

****************************************************

7)-Start Exim up again :-

#/etc/init.d/exim start

****************************************************

8)-Monitor your spam_log file for spam, try using any formmail or script that uses a mail function - a message board, a contact script :

#tail - f /var/log/spam_log

Sample Log Output

Mon Apr 11 07:12:21 EDT 2005 - /home/username/public_html/directory/subdirectory - nobody x 99 99 Nobody / /sbin/nologin

Log Rotation Details :-
Your spam_log file isn't set to be rotated so it might get to be very large quickly, Keep an eye on it and consider adding it to your logrotation.

#pico /etc/logrotate.conf

FIND :-

/var/log/wtmp {
monthly
create 0664 root utmp
rotate 1
}

ADD BELOW :-

# SPAM LOG rotation
/var/log/spam_log {
monthly
create 0777 root root
rotate 1
}

****************************************************
Now Just sit and enjoy .

How to install IPtables

This are some basic steps for install IP tables:-


1)  Get the iptables tarball containing all the needed files.-

          -To get the latest version of iptables go to netfilter.org

          - Downloads are available at http://www.netfilter.org/downloads.html

          - The file should be named iptables-1.*.*.tar.bz2 where the asterisks represent the numbers of the       latest version.

          -Save this file to a temporary directory, we will use /tmp in this example.
-----------------------------------------------------------------------------

 2) Open a terminal window.

-----------------------------------------------------------------------------

 3) Change your directory to where you saved iptables by typing:-

      # cd /tmp

-----------------------------------------------------------------------------

4) Uncompress the archive to the /usr/src directory by typing:-

      # tar -xvjf ./iptables-1.*.*.tar.bz2 -C /usr/src

      where the asterisks represent the version number of the file you downloaded,

-----------------------------------------------------------------------------

5) Change to the directory it created (typically iptables-1.*.*), by typing:-

      # cd /usr/src/iptables-1.*.*

-----------------------------------------------------------------------------

6) Using the kernel directories above, type:-

      # /bin/sh -c make

-----------------------------------------------------------------------------

7) To finish the install, type:-

      # /bin/sh -c make install

- Iptables should now be installed, You can test the installation as described in the beginning of this section to see if it is working.

- If the above install steps seemed to execute without any error, but typing:-

# iptables -V

- Brings up an error, it is possible that the program did'n install itself to the sbin directory, To fix this type the following command from the iptables-1.*.* directory:

ComputerName:~# cp ./iptables /sbin

-----------------------------------------------------------------------------

How To change IP in server

*Note:- Hey Remember < You need to set RDNS for the IP then and then Only you can proceed further.>
-------------------------------------------------------------------------------------
If you are in the danger of getting your main server IP block by SpamCop because you had a few anoying spamers abusing your server, then you could simply change your exim mailserver IP to avoid the effect of your main IP beeing blacklisted.

--Below there are some simple steps of changing your exim IP:---

Inside both incoming & outgoing exim mail server you will need to add an interface :-
( So just edit )

pico /etc/exim_outgoing.conf

and

pico /etc/exim.conf

find
remote_smtp:
driver = smtp

& add interface = ip.you.want.to.use

--------------------------------
Example is as shown below:-

remote_smtp:
driver = smtp
interface = 22.22.22.22
-------------------------------

IP needs to be on server in order for this to work, hopefully this will help.
BTW: Just a reminder - If there is an exim update when you upgrade your cpanel server you will need to re-enter the interface again.

How to install postgresql

Follow this step:-

*Not:- C-Panel requires Postgresql 7.3.x or later. 7.2.x will not work.
---------------------------------------------------------------------------

--Step 1--

Upgrade to cPanel 7.4.0 build 45 or later,

--Step 1a --(If you do not have 7.2.x or earlier installed skip this step)

Login to a root shell via ssh or the console,

If you have Postgres 7.2.x installed, backup your databases using pg_dumpall or some other method,

Move the postgres data directory somewhere else. ie,

mv /var/lib/pgsql /var/lib/pgsql.old

---------------------------------------------------------------------------
--Step 2--

Login to a root shell via ssh or the console and run,

/scripts/installpostgres


--Step 2a-- (skip this step if you are not upgrading from postgres 7.2 or earlier)

Restore your sql dump created with pg_dumpall or by some other method using psql or some other method



---------------------------------------------------------------------------
--Step 3--

Login to Web Host Manager & choose "Postgres Config" under Server Setup,

Set a postgres password to anything of your choosing, You should avoid using any non-alpha numeric charaters as these cause problems.


---------------------------------------------------------------------------
--Step 4--

Use the "Postgres Config" option in WHM to install a postgres pg_hba.conf file, You can skip this step if you would like to setup your pg_hba.conf file manually, cPanel should work fine with md5 passwords or plaintext passwords.

---------------------------------------------------------------------------


--Step 5--

Login to cPanel and click on Postgres .. Enjoy!
---------------------------------------------------------------------------

How to clean Exim's Mail queue

Solution How to clean an Exim queue is as follows :-

1) How to clean an Exim queue
2) Using WebHost Manager
3) Advanced Users
4) Very Advanced Users
--------------------------------------------------------------------------------------------

--Using WebHost Manager--

1. Login to WHM.
2. On the Main page, click on the email icon.
3. In the mail menu, select "Manage Mail Queue".
* Note:-( Instead of steps 2 & 3, you can select "Manage Mail Queue from the left margin.)
4. Find the message you wish to delete & select "Delete".

--------------------------------------------------------------------------------------------

--Advanced Users--

There are many times when a mail queue may become filled with what is essentially junk mail, At extreme levels, this can cause high load & delayed mail delivery.
You can use a variation of the following command via a shell prompt to delete only these junk messages from the mail queue.

grep -lR KEYWORD /var/spool/exim/input/* | xargs rm -f

(This will purge the mail queue of any messages that contain KEYWORD.
Any messages deleted in this manner are IRRETRIEVABLE (aka: Gone for good)
Is this dangerous? You bet it CAN be.)

Let's look at an example:-

Imagine a case in which users are abusing a bad FormMail.pl installation on server.fastservers.net. Almost all of these messages will contain the username "nobody@server.fastservers.net". We want to delete ALL of these messages, so we would insert "nobody@server.fastservers.net" in place of "KEYWORD" in the command above.
This will delete all messages in the exim queue that contain the keyword "nobody@server.fastservers.net".

--------------------------------------------------------------------------------------------

--Very Advanced Users--

Grep does regular expressions, This means you can catch tricky spammers with a little mind power.

 For example:-

grep -lRP Vz*Az*Lz*Iz*Uz*M /var/spool/exim/input/* | xargs rm -f

This command will delete any message containing the letters V, A, L, I, U, M, in that order, And with 0 or more "z" characters between them. A few of the keywords it will match are listed:
VALIUM
VzALIUM
VAzLIzUzM
VALzIUM
VzALzIUM
You get the idea.
--------------------------------------------------------------------------------------------

Saturday, October 23, 2010

Frozen messages with Exim

Please follow this fixes listed below :-


1) Solution What are frozen messages?

Ans:-Frozen messages are messages that Exim will no longer attempt to deliver, You can thaw the message with.

      exim -Mt <message-id> [ <message-id> ... ]

2) To remove all frozen messages:-

     exiqgrep -z -i | xargs exim -Mrm

3) To show frozen messages:-

     exim -bp | grep frozen

4) Freeze all queued messages from local user:-

     exiqgrep -i -f luser@localhost | xargs exim -Mf

FrontPage Error fix

Error message on the screen will be like this:-
Error: The server extensions were unable to access the file "..htaccess.tmp". Please check the file permissions.
Setting Password
Frontpage passthough auth enabled!


To solve this follow this commands:-

cd /usr/local/frontpage/version5.0/bin/

./owsadm.exe -o install -u username -p 80 -m www.domain.com -servconf /usr/local/apache/conf/httpd.conf -xuser username

Note:-( Even if you still receive some errors on .htacess files under the domain rename those .htaccess files, This will resolve the permission issues and .htaccess problems.)

Once the above is done- Try to reinstall Frontpage extensions on the domain.

Some Important Exim Commands

Queues information along with commands :-

1)**USE** Print a count of the messages in the queue- Quote:-

              root@localhost# exim -bpc

2)**USE** Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient):
Quote:-

             root@localhost# exim -bp
3)**USE** Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals)
Quote:-

              exim -bp | exiqsumm

4) **USE**Generate and display Exim stats from a logfile Quote:-

              eximstats /path/to/exim_mainlog
5)**USE** Generate and display Exim stats from a logfile, with less verbose output Quote:-

               eximstats -ne -nr -nt /path/to/exim_mainlog

6) **USE**Generate and display Exim stats from a logfile, for one particular day Quote:-

               fgrep 2007-02-16 /path/to/exim_mainlog | eximstats

7)**USE** Print what Exim is doing right now Quote:-

               exiwhat

8)**USE** How many Frozen mails on the queue :-

               exim -bpr | grep frozen | wc -l
9) **USE**To delete frozen emails Quote:-

               exim -bpr | grep frozen | awk {'print $3'} | xargs exim -Mrm

10) **USE** To deliver emails forcefully Quote:-

               exim -qff -v -C /etc/exim.conf &
11) **USE**To Flush all mail in  queue :-
               exim -qff

To clear Domlogs

Fire the following command :-

cd /usr/local/apache/domlogs/
for x in `ls`;
do
echo "" > $x;
done;

Thursday, October 21, 2010

Using cron to run programs on a schedule

Using cron to run programs on a schedule is very useful feature :-

Cron is a Linux system process that will execute a program at a preset time, To use cron you must prepare a text file that describes the program that you want executed & the times that cron should execute them, Then you use the crontab program to load the text file that describes the cron jobs into cron.

Here is the format of a cron job file:

[min] [hour] [day of month] [month] [day of week] [program to be run]

where each field is defined as
[min] Minutes that program should be executed on. 0-59. Do not set as * or the program will be run once a minute.
[hour] Hour that program should be executed on. 0-23. * for every hour.
[day of month] Day of the month that process should be executed on. 1-31. * for every day.
[month] Month that program whould be executed on. 1-12 * for every month.
[day of week] Day of the week. 0-6 where Sunday = 0, Monday = 1, ...., Saturday = 6. * for every day of the week.
[program] Program to be executed, Include full path information.

Here are some examples below:-

0,15,30,45 * * * * /usr/bin/foo

Will run /usr/bin/foo every 15 minutes on every hour, day-of-month, month, and day-of-week. In other words, it will run every 15 minutes for as long as the machine it running.

10 3 * * * /usr/bin/foo

Will run /usr/bin/foo at 3:10am on every day.

10 * 1 * * /usr/bin/foo

Will run /usr/bin/foo at 12:10am on the first day of the month.

10 * * 1 * /usr/bin/foo

Will run /usr/bin/foo at 12:10am on the first month of the year.

10 14 * * 1 /usr/bin/foo

Will run /usr/bin/foo at 2:10pm on every Monday.


You must use crontab to load cron jobs into cron. First create a text file that uses the above rule to describe the cron job that you want to load into cron. But before you load it, type crontab -l to list any jobs that are currently loaded in crontab.

If none are listed, then it is safe to load your job,Example. If you wanted to run /usr/local/bin/foo once a day at 3:10am, then create a text file

10 3 * * * /usr/bin/foo

Save it as foo.cron. Then type crontab foo.cron. Check to see if it was loaded by typing crontab -l. It should display something like this:

# DO NOT EDIT THIS FILE - edit the master & reinstall.
# (ipwatch.cron installed on Thu Nov 18 11:48:02 2009)
# (Cron version -- $Id: crontab.c,v 2.13 2004/01/17 03:20:37 vixie Exp $)
10 3 * * * /usr/bin/foo

If you want to edit the cron job, then edit foo.cron and then remove the existing cron job (crontab -r) and load it again (crontab foo.cron). You can have multiple jobs. Just put each different one on a seperate line in foo.cron.

contab jobs will run under the user that was in effect when you loaded the job in crontab.

Close connection in response to STARTTLS

---*If you get the following error (tail -F /var/log/messages)---*:-

.----------------------++++++++++++------------------.

T=remote_smtp defer (-18): Remote host mail.domain.com [111.111.111.111] closed connection in response to STARTTLS
2007-10-01 17:15:28 Start queue run: pid=13647
2007-10-01 17:15:28 1IcMzG-0003XG-1f == test@domain.com R=dnslookup

.-----------------------++++++++++++------------------.


Then you can fix this issue by editing your /etc/exim.conf, and changing the following code:-

remote_smtp:
  driver = smtp

To be:-

remote_smtp:
  driver = smtp
  hosts_avoid_tls=*         (This line should be present if not then add the line.)

Save, exit, then restart exim.

If the issue is for incoming email, you can comment out this section of your exim.conf:

tls_advertise_hosts = *

When Server is not responding

When  PhpMyAdmin in your domain control panel gives following error:-
#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured")


link : http://forums.cpanel.net/showpost.php?p=33...mp;postcount=11



Here is what worked for me:-

pico /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

find
$cfg['Servers'][$i]['socket'] = '';

change to

$cfg['Servers'][$i]['socket'] = '/var/lib/mysql/mysql.sock';

next line
$cfg['Servers'][$i]['connect_type'] = 'tcp';

change to

$cfg['Servers'][$i]['connect_type'] = 'socket';



/** I am sure you like this just like me **/

Glibc free()error sysctl configuration

How to configure is explain below:-

1>

Turn off the tcp_sack.
net.ipv4.tcp_sack = 0

 2>

Turn off the tcp_timestamps.
net.ipv4.tcp_timestamps = 0

 3>

Enable TCP SYN Cookie Protection.
net.ipv4.tcp_syncookies = 1

 4>

Enable ignoring broadcasts request.
net.ipv4.icmp_echo_ignore_broadcasts = 1

 5>

Enable bad error message Protection.
net.ipv4.icmp_ignore_bogus_error_responses = 1

 6>

Log Spoofed Packets, Source Routed Packets, Redirect Packets.
net.ipv4.conf.all.log_martians = 1

 7>

Increases the size of the socket queue (effectively, q0),
net.ipv4.tcp_max_syn_backlog = 1024

 8>

Increase the tcp-time-wait buckets pool size.
net.ipv4.tcp_max_tw_buckets = 1440000

 9>

Allowed local port range.
net.ipv4.ip_local_port_range = 16384 65536

10>

After you make the changes to the file you need to run .
Quote
/sbin/sysctl -p
and
Quote
sysctl -w net.ipv4.route.flush=1
to enable the changes without a reboot.

Gd library and other instant softwares using EASY APACHE

For Enabling GD library & other softwares,It is done through easy apache:-

WHM >> Software >> Upate Apache

For imagemagick follow this steps :-

  • Go to Install per module.
  • Search for Image:Magick.
  • Select it .
  • Select 1 option and click.


Path For ImageMagick : /usr/bin/convert

Thank you

Full Duplex

Run the following commands one by one:-

ethtool -s eth0 speed 100;
ethtool -s eth0 autoneg off;
ethtool -s eth0 duplex full;
each line is one command
then run to check :
mii-tool

Output should be:as follows :-

eth0: 100 Mbit, full duplex, link ok

When ftp UDP port get block

Fire this following rules with iptables:-

-A OUTPUT -o eth0 -p udp -m udp --dport 21 -j ACCEPT
-A OUTPUT -o eth0 -p udp -m udp --dport 20 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 21 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 20 -j ACCEPT


LIST:-
Error :-
 
425 Unable to build data connection: Connection timed out
PASV
227 Entering Passive Mode (64,246,51,197,214,179).
Connecting data channel to (64.246.51.197:54963).
Connection timed out; Connection timed out while waiting for a response from the server.

Tuesday, October 19, 2010

Some Network Administration Tools

<netconf > **USE**--( [as root], A  good menu driven setup of your network.),
<pingmachine_name > **USE**--( Check if you can contact another machine [give the machine's name Or IP]. Press [<Ctrl>C] when done [it keeps going]),

<route -n > **USE**--( It Shows the kernel routing table.),

<nslookup host_to_find > **USE**--( Query your default domain name server [DNS] for an Internet name [Or IP number] host_to_find, This way you can check if your DNS works, You can also find out the name of the host of which you only know the IP number),

<traceroute host_to_trace > **USE**--( Have a look how you messages travelled to[ host_to_trace]-which is either a host name or IP number ),

<ipfwadm -F -p m > **USE**--( [for RH5.2, seen next command for RH6.0],Set up the firewall IP forwarding policy to masquerading, Purpose:-- All computers from your home network will appear to the outside world as one very busy machine and for example- You will be allowed to browse the Internet from all computers at once.),
<echo 1 > /proc/sys/net/ipv4/ip_forward >
<ipfwadm-wrapper -F -p deny >

<ipfwadm-wrapper -F -a m -S xxx.xxx.xxx.0/24 -D 0.0.0.0/0 > **USE**--( [three commands, RH6.0], Does the same as the previous command. Substitute  the "x"s  with digits of your class "C" IP address that you assigned to your home network ),

<ifconfig > **USE**--( [As root] Display info on the network interfaces Currently active (ethernet, ppp, etc), Your first ethernet should show up as eth0, second as eth1 etc, first ppp over modem as ppp0, second as ppp1 etc, The "lo" is the "loopback only" interface which should be always active, Use the options [see <ifconfig --help>] to configure the interfaces. ),

<ifup interface_name > **USE**--( [/sbin/ifup to it run as a user] Startup a network interface,For e.g as follows:
ifup eth0
ifup ppp0
Users can start up or shutdown the ppp interface only when the right permission was checked during the ppp setup (using netconf ), To start a ppp interface [Dial-up Connection]. I normally use kppp available under kde menu "internet".),

<ifdown interface_name > **USE**--( [/sbin/ifdown to run it as a user], Shut down the network interface.),

<netstat | more > **USE**--( Displays a lot  information on the status of your network.),.

Some Network applications

  1. netscape  **USE**--( {Iin X terminal} Run netscape (requires a separate Netscape installation}, The current versions of  Netscape {4.x} are known to be big and buggy. They occasionally crash by vanishing {means no other harm done}, Also when we not connected to the network , Netscape likes to refuse to-do anything (looks like it hanged),it revives when you connects. ),
  2. netscape -display host:0.0   **USE**--( {In X terminal} Run netscape on the current machine & direct the output to machine named "host" display 0 screen 0, Your current machine must have a permission to display on the machine 'host' (Typically given by executing the command <xhost current_machine_name >in the xterminal of the machine host, Other X-windows program can be run remotely the same way. ),
  3. lynx file.html   **USE**--( View an html file / browse the net from the text mode.),
  4. pine   **USE**--(  A good text-mode mail reader, Another good & standard one is <elm>, Your Netscape mail will read the mail from your Internet account, pine will let you read the 'local' mail, e.g.  a cron process sends to you from a computer on your home network. The command mail could also be used for reading/composing mail, but it would be inconvenient it is meant to be used in scripts for automation.). 
  5. elm    **USE**--( A good text-mode mail reader. See the previous command also. ),
  6. mutt   **USE**--( This is  really a basic but extremally useful & fast mail reader. ),
  7. mail    **USE**--(  A basic {OS}operating system tool for Email, Look at the previous commands for a better e-mail reader, Mail is good if you wanted to send an e-mail from a shell script. ),
  8. licq   **USE**--( {In X term} An icq 'Instant messaging' client, Another good one is kxicq, Older distributions do not have an icq client installed, you have to do download one and install it. ),
  9. talk username1  **USE**--( We can talk to another user currently logged on your machine (or use "talk username1@machinename" to talk to a user on a different computer) , To accept the invitation to the conversation, type the command "talk username2", If somebody is trying to talk to you & it disrupts your work, you may use the command "mesg n" to refuse accepting messages, You may want to use "who" or "rwho" to determine the users who are currently logged in. ),
  10. mc   **USE**--( Launch the "Midnight Commande" file manager {Its like "Norton Commander" for Linux}.),
  11. telnet server  **USE**--( We can Connect to another machine using the TELNET protocol, We can use a remote machine name or IP address, You will be prompted for your login name & password you must have an account on the remote machine to login, Telnet will connect you to another machine & let you operate on it as if you were sitting at its keyboard, Telnet is not very secure everything you type goes in open text, even your password also), 
  12. rlogin server   **USE**--( {=remote login} Connect to another machine, The login name--password from your current session is used, If it fails you are prompted for a password.), 
  13. rsh server   **USE**--( {=remote shel} This is  another way to connect to a remote machine, The login name-password from your current session is used; If it fails you are prompted for a password.),
  14. ftp server  **USE**--( Ftp another machine. (There is also ncftp which adds extra features & gftp for GUI }, Ftp is good for copying files from a remote machine, Try user "anonymous" if you do not have an account on the remote server, After connection, use "?" to see the list of available ftp commands,  The essential ftp command are <ls> {to see the files on the remote system}, ASCII, binary (set the file transfer mode to either text or binary, important that you select the proper one ), get (copy a file from the remote system to the local system), mget (get many files at once), put (copy a file from the local system to the remote system), mput (put many files at once), bye (disconnect). For automation in a script, you may want to use ncftpput and ncftpget, for example: -ncftpput -u my_user_name -p my_password -a remote.host.domain remote_dir *local.html ),
  15. minicom   **USE**--( Minicom program {looks like "Procomm for Linux"}., 


Linux Keyboard shortcuts

  1. <Ctrl><Alt><F1> **USE**--( Switch to the first text terminal,Under Linux you can have several terminals opened at the same time.. ).
  2. <Ctrl><Alt><Fn> (n=1..6) **USE**--( Switch to the nth text terminal, ).
  3. <tty> **USE**--( Print the name of the terminal in which you are typing this command,,).
  4. <Ctrl><Alt><F7> **USE**--( Switch to the first GUI terminal, ).
  5.   <Tab> **USE**--( In a text terminal,Autocomplete the command  if there is only 1 option, or else show all the available options.),
  6.  <ArrowUp> **USE**--( Scroll & edit the command history, Press <Enter> to execute command.),
  7.  <Shift><PgUp>**USE** --( Scroll terminal output up,Work also at the login prompt, so we can scroll through our bootup messages.),
  8.  <Shift><PgDown> **USE**--( Scroll terminal output down fast .),
  9. <Ctrl><Alt><-> **USE**--( (In X-Windows) Change to the previous X-Server Resolution.),
  10. <Ctrl><Alt><BkSpc> **USE**--( (in X-Wndows) Kill the current X-Windows Server, Use if the X-Windows Server crashes & cannot be exited normally. ),
  11. <Ctrl><Alt><Del> **USE**--( Shut down the system & Reboot, This is the normal shutdown command for a user at the text-mode console, Do not just press the 'reset' button for shutdown.),
  12. <Ctrl>c **USE**--( Kill the current Process ( In the Text mode for small applications.),
  13. <Ctrl>d **USE**--( Log out from the current terminal,We can also see next command.).
  14. <Ctrl>s **USE**--(  Stop the file transfer to the terminal.),
  15. <Ctrl>q **USE**--( Resume the transfer to the terminal, Try if your terminal mysteriously stops responding to you..),
  16. <Ctrl>z--( Send current Process to the background.),
  17. <exit>**USE**--( Logout,. can also use logout for the same effect.,(If you have started a second shell, for  e.g.- using bash the second shell will be exited & you will be back in the first shell, not logged out.)),
  18. <reset>**USE**--( Restore a screwed-up terminal (A terminal which shows funny characters) to default setting, Use if you tried to 'cat' a binary file, You may not be able to see the command as you type it.).
  19. <MiddleMouseButton> **USE**--( Paste the text which is currently Highlighted somewhere else, This is the normal 'copy-paste' Operation in Linux, (It doesn't work with Netscape & Wordperfect which use the MS Windows-style 'copy-paste', It does work in the text terminal if you enabled 'gpm' Service using 'Setup') Best used with a Linux-ready 3-button mouse (Logitech or similar) ),
  20. <~>**USE**--( {tilde} My home directory (normally the directory /home/my_login_name), For example, the command cd ~/my_dir will change my working  directory to the subdirectory 'my_dir' under my home directory,  Typing just .cd. alone is an equivalent of the command .cd ~.).
  21. <.>**USE**--(  {dot} Current directory, For example- ./my_program will attempt to execute the file 'my_program' located in your current working directory,).
  22. <..>**USE**--( {two dots} Directory parent to the current one, For example- the command cd .. will change my current working directory one-one level up.)..

How to install Various Program

  • rpm -ivh filename.rpm    **USE**--( [=RedhatPackageManager, install verbose, hashes displayed to show progress as root] Install a content of Red Hat rpm package[s] & print info on what happened. Keep reading if you prefer a GUI installation.), 
  • rpm -qpi filename.rpm   **USE**--( [=RedhatPackageManager, query, package, list] Read the info on the content of a yet uninstalled package filename.rpm. ),
  • rpm -qpl filename.rpm   **USE**--( [=RedhatPackageManager, query, package, information.] List the files contained in a yet uninstalled package filename.rpm.),
  • rpm -qf filename   **USE**--( [=RedhatPackageManager, query, file], Find out the name of the <*.rpm> package to which the file filename [on your hardrive] belongs. ),
  • rpm -e packagename   **USE**--( [=RedhatPackageManager, erase=Uninstall], Uninstall a package- Package name, Package name is the same as the beginning of the< *.rpm> package file but without the dash and version number), E.g--   <kpackage>  <gnorpm >
  • glint   **USE**--( [in X - terminal, as root if you want to be able to install packages], GUI fronts to the Red Hat Package Manager [rpm], "glint" comes with RH5.2, "gnorpm" with RH6.0, "kpackage" comes with RH6.1 OR must be installed separately but is the best of the three, Use any of them to view which software packages are installed on your system & the what not-yet-installed packages are available on your RedHat CD, display the info about the packages, & install them if you want [installation must be done as root])..


How to decompress file

  1. tar -zxvf filename.tar.gz   **USE**--( {=tape archiver} Untar a tarred & compressed tarball {*.tar.gz or *.tgz,} that you downloaded from the Internet. 
  2. tar -xvf filename.tar   **USE**--( Untar a tarred but uncompressed tarball {*.tar}.),
  3. gunzip filename.gz   **USE**--( Decompress a zipped file {*.gz" or *.z}, Use gzip {also zip or compress}, if you wanted to compress files to this file format.), 
  4. bunzip2 filename.bz2  **USE**--( {=big unzip} Decompress a file {*.bz2} zipped with bzip2 compression utility, Used for big files. ),
  5. unzip filename.zip  **USE**--( Decompress a file {*.zip} zipped with a compression utility compatible with PKZIP for DOS.), 
  6. unarj e filename.arj  **USE**--( Extract the content of an {*.arj} archive. ),
  7. uudecode -o outputfile filename  **USE**--( Decode a file encoded with uuencode,  uu-encoded files are typically used for transfer of non-text files in e-mail {uuencode transforms any file into an ASCII file}).

How to control various Process in linux

  • ps   **USE**--({ =print status} Display the list of currently running processes with their process IDs [PID] numbers, Use ps axu to see all processes currently running on your system {also those of other users or without a controlling terminal}, Each with the name of the owner, Use "top" to keep listing the processes currently running.), 
  • fg PID   **USE**--( Bring a background -or- stopped process to the foreground.), 
  • bg PID  **USE**--( Send the process to the background, Opposite to <fg>, The same can be accomplished with <Ctrl>z,  If you have stopped jobs, you have to type exit twice in row to log out.), 
  • any_command   **USE**--( Run any command in the background [The symbol "&" means "run the proceeding command in the background"]  ),. 
  • batch any_command   **USE**--( Run any command [usually one that is going to take more time] when the system load is low, I can logout,& the process will keep running. ).
  • at 17:00   **USE**--( Execute a command at a specified time,  You will be prompted for the command[s] to run, until you press <Ctrl>d). 
  • kill PID   **USE**--( Force a runing process shutdown, First determine the PID of the process to kill using ps), 
  • killall program_name   **USE**--( Kill program[s] by name. ),
  • xkill   **USE**--( [In an X-Window terminal] Kill a GUI-based program with mouse, [Point with your mouse cursor at the window of the process you want to kill & click}.) ,
  • nice program_name   **USE**--( Run program_name adjusting its **priority**, Since the priority is not specified in this example, it will be adjusted by 10 [ultimatly process will run slower], [from the default value (usually 0], The lower the number [of "niceness" to other users on the system], The higher the priority, The priority value may be in the range -20 to19, Only root may specify negative values. **Use "top" to display the priorities of the running processes**),. 
  • renice -1 PID   **USE**--( [as root] Change the priority of a running process to -1, Normal users can only adjust processes they own & only up from the current value [which make them run slower], 


Saturday, October 16, 2010

<** Linux Most Important Basic Commands **>

/*  This are some quick command which are useful for beginners and as well as experts in Linux  */
  • alias     ~/~    'USE'-> Create an alias.
  • awk     ~/~    'USE'-> Find and Replace text, database sort/validate/index.
  • break  ~/~    'USE'-> Exit from a loop.
  • builtin  ~/~    'USE'-> Run a shell builtin.
  • cal      ~/~    'USE'-> Display a calendar.
  • case    ~/~   'USE'-> Conditionally perform a command.
  • cat      ~/~    'USE'-> Display the contents of a file.
  • cd       ~/~    'USE'-> Change Directory.
  • cfdisk  ~/~   'USE'-> Partition table manipulator for Linux.
  • chgrp  ~/~   'USE'-> Change group ownership.
  • chmod   ~/~ 'USE'-> Change access permissions.
  • chown   ~/~ 'USE'-> Change file owner and group.
  • chroot  ~/~  'USE'-> Run a command with a different root directory.
  • cksum  ~/~  'USE'-> Print CRC checksum and byte counts.
  • clear    ~/~    'USE'-> Clear terminal screen.
  • cmp     ~/~   'USE'-> Compare two files.
  • comm    ~/~ 'USE'-> Compare two sorted files line by line.
  • command ~/~'USE'-> Run a command - ignoring shell functions.
  • continue ~/~ 'USE'-> Resume the next iteration of a loop.
  • cp         ~/~  'USE'-> Copy one or more files to another location.
  • cron    ~/~    'USE'-> Daemon to execute scheduled commands.
  • crontab ~/~  'USE'-> Schedule a command to run at a later time.
  • csplit  ~/~     'USE'-> Split a file into context-determined pieces.
  • cut     ~/~     'USE'-> Divide a file into several parts.
  • date    ~/~    'USE'-> Display or change the date & time.
  • dc      ~/~    'USE'-> Desk Calculator.
  • dd      ~/~    'USE'-> Data Dump - Convert and copy a file.
  • declare ~/~  'USE'-> Declare variables and give them attributes.
  • df      ~/~     'USE'-> Display free disk space.
  • diff    ~/~     'USE'-> Display the differences between two files.
  • diff3   ~/~    'USE'-> Show differences among three files.
  • dir     ~/~     'USE'-> Briefly list directory contents.
  • dircolors~/~ 'USE'-> Colour setup for `ls.
  • dirname ~/~ 'USE'-> Convert a full pathname to just a path.
  • dirs    ~/~    'USE'-> Display list of remembered directories.
  • du      ~/~    'USE'-> Estimate file space usage.
  • echo    ~/~  'USE'-> Display message on screen.
  • ed      ~/~   'USE'-> A line-oriented text editor (edlin).
  • egrep   ~/~ 'USE'-> Search file(s) for lines that match an extended expression.
  • eject   ~/~  'USE'-> Eject CD-ROM.
  • enable  ~/~ 'USE'-> Enable and disable builtin shell commands.
  • env     ~/~  'USE'-> Display, set, or remove environment variables.
  • eval    ~/~  'USE'-> Evaluate several commands/arguments.
  • exec    ~/~ 'USE'-> Execute a command.
  • exit    ~/~  'USE'-> Exit the shell.
  • expand  ~/~'USE'-> Convert tabs to spaces.
  • export  ~/~ 'USE'-> Set an environment variable.
  • expr    ~/~  'USE'-> Evaluate expressions.
  • factor  ~/~  'USE'-> Print prime factors.
  • false   ~/~   'USE'-> Do nothing, unsuccessfully.
  • fdformat~/~'USE'-> Low-level format a floppy disk.
  • fdisk   ~/~  'USE'-> Partition table manipulator for Linux.
  • fgrep   ~/~ 'USE'-> Search file(s) for lines that match a fixed string.
  • find    ~/~  'USE'-> Search for files that meet a desired criteria.
  • fmt     ~/~  'USE'-> Reformat paragraph text.
  • fold    ~/~  'USE'-> Wrap text to fit a specified width,
  • for     ~/~  'USE'-> Expand words, and execute commands.
  • format  ~/~'USE'-> Format disks or tapes.
  • free    ~/~  'USE'-> Display memory usage.
  • fsck    ~/~  'USE'-> File system consistency check and repair,
  • function ~/~'USE'-> Define Function Macros.
  • gawk    ~/~ 'USE'-> Find and Replace text within file(s).
  • getopts ~/~ 'USE'-> Parse positional parameters.
  • grep    ~/~  'USE'-> Search file(s) for lines that match a given pattern.
  • groups  ~/~ 'USE'-> Print group names a user is in.
  • gzip    ~/~   'USE'-> Compress or decompress named file(s).
  • hash    ~/~  'USE'-> Remember the full path name of a name argument,
  • head    ~/~  'USE'-> Output the first part of file(s),
  • history ~/~  'USE'-> Command History.
  • hostname ~/~'USE'-> Print or set system name.
  • id      ~/~   'USE'-> Print user and group id's.
  • if      ~/~    'USE'-> Conditionally perform a command.
  • import  ~/~'USE'-> Capture an X server screen and save the image to file.
  • info    ~/~  'USE'-> Help info.
  • install ~/~  'USE'-> Copy files and set attributes.
  • join    ~/~  'USE'-> Join lines on a common field.
  • kill    ~/~   'USE'-> Stop a process from running.
  • less    ~/~  'USE'-> Display output one screen at a time.
  • let     ~/~   'USE'-> Perform arithmetic on shell variables.
  • ln      ~/~   'USE'-> Make links between files.
  • local   ~/~ 'USE'-> Create variables.
  • locate  ~/~'USE'-> Find files.
  • logname ~/~'USE'-> Print current login name.
  • logout  ~/~ 'USE'-> Exit a login shell.
  • lpc     ~/~  'USE'-> Line printer control program.
  • lpr     ~/~  'USE'-> Off line print.
  • lprint  ~/~  'USE'-> Print a file.
  • lprintd ~/~ 'USE'-> Abort a print job.
  • lprintq ~/~ 'USE'-> List the print queue.
  • lprm    ~/~ 'USE'-> Remove jobs from the print queue.
  • ls      ~/~   'USE'-> List information about file(s).
  • m4      ~/~ 'USE'-> Macro processor.
  • man     ~/~ 'USE'-> Help manual.
  • mkdir   ~/~ 'USE'-> Create new folder(s).
  • mkfifo  ~/~ 'USE'-> Make FIFOs (named pipes).
  • mknod ~/~ 'USE'-> Make block or character special files.
  • more    ~/~ 'USE'-> Display output one screen at a time.
  • mount   ~/~'USE'-> Mount a file system.
  • mtools  ~/~'USE'-> Move or rename files or directories.
  • nice     ~/~ 'USE'-> Set the priority of a command or job.
  • nl        ~/~  'USE'-> Number lines and write files.
  • nohup  ~/~'USE'-> Run a command immune to hangups.
  • passwd ~/~'USE'-> Modify a user password.
  • paste   ~/~ 'USE'-> Merge lines of files.
  • pathchk ~/~'USE'-> Check file name portability.
  • popd    ~/~ 'USE'-> Restore the previous value of the current directory.
  • pr      ~/~   'USE'-> Convert text files for printing.
  • printcap~/~'USE'-> Printer capability database.
  • printenv~/~'USE'-> Print environment variables.
  • printf  ~/~  'USE'-> Format and print data,
  • ps      ~/~  'USE'-> Process status.
  • pushd   ~/~'USE'-> Save and then change the current directory,
  • pwd     ~/~'USE'-> Print Working Directory,
  • quota   ~/~'USE'-> Display disk usage and limits.
  • quotacheck~/~ 'USE'->Scan a file system for disk usage.
  • quotactl~/~'USE'-> Set disk quotas.
  • ram     ~/~ 'USE'-> ram disk device.
  • rcp     ~/~  'USE'-> Copy files between two machines,
  • read    ~/~  'USE'-> read a line from standard input,
  • readonly~/~'USE'-> Mark variables/functions as readonly.
  • remsync ~/~'USE'-> Synchronize remote files via email,
  • return  ~/~  'USE'-> Exit a shell function.
  • rm      ~/~  'USE'-> Remove files,
  • rmdir   ~/~ 'USE'-> Remove folder(s).
  • rpm     ~/~ 'USE'-> Remote Package Manager.
  • rsync   ~/~ 'USE'-> Remote file copy (Synchronize file trees).
  • screen  ~/~'USE'-> Terminal window manager.
  • sdiff   ~/~  'USE'-> Merge two files interactively.
  • sed     ~/~ 'USE'-> Stream Editor.
  • select  ~/~ 'USE'-> Accept keyboard input.
  • seq     ~/~ 'USE'-> Print numeric sequences.
  • set     ~/~  'USE'-> Manipulate shell variables and functions.
  • shift   ~/~  'USE'-> Shift positional parameters,
  • shopt   ~/~'USE'-> Shell Options,
  • shutdown~/~'USE'-> Shutdown or restart linux.
  • sleep   ~/~ 'USE'-> Delay for a specified time,
  • sort    ~/~ 'USE'-> Sort text files.
  • source  ~/~'USE'-> Run commands from a file `.'
  • split   ~/~  'USE'-> Split a file into fixed-size pieces,
  • su      ~/~  'USE'-> Substitute user identity,
  • sum     ~/~'USE'-> Print a checksum for a file,
  • symlink ~/~'USE'-> Make a new name for a file.
  • sync    ~/~ 'USE'-> Synchronize data on disk with memory,
  • tac     ~/~  'USE'-> Concatenate & write files in Reverse.
  • tail    ~/~   'USE'-> Output the last part of files,
  • tar     ~/~  'USE'-> Tape ARchiver.
  • tee     ~/~  'USE'-> Redirect output to multiple files,
  • test    ~/~  'USE'-> Evaluate a, Conditional expression.
  • time    ~/~ 'USE'-> Measure Program Resource Use,
  • times   ~/~'USE'-> User and system times.
  • touch   ~/~'USE'-> Change file timestamps,
  • top     ~/~ 'USE'-> List processes running on the system/
  •                     /trace route Trace Route to Host,
  • trap     ~/~'USE'-> Run a command when a signal is set (bourne),
  • tr       ~/~ 'USE'-> Translate, Squeeze, and/or delete characters.
  • true     ~/~'USE'-> Do nothing,. successfully,
  • tsort    ~/~'USE'-> Topological sort,
  • tty      ~/~ 'USE'-> Print file name of terminal on Stdin.
  • type     ~/~'USE'-> Describe a commands,
  • ulimit  ~/~ 'USE'-> Limit user resources.
  • umask~/~ 'USE'-> Users file Creation mask,
  • umount ~/~'USE'-> Unmount a device.
  • unalias  ~/~'USE'-> Remove an alias,
  • uname  ~/~'USE'-> Print system information.
  • unexpand~/~'USE'-> Convert spaces to tabs,
  • uniq     ~/~   'USE'-> Uniquify files.
  • units    ~/~   'USE'-> Convert units from one scale to another,
  • unset    ~/~  'USE'-> Remove variable or function names.
  • unshar   ~/~ 'USE'-> Unpack shell archive scripts,
  • until    ~/~   'USE'-> Execute commands (Until Error).
  • useradd  ~/~'USE'-> Create new user accounts,
  • usermod  ~/~'USE'-> Modify user accounts.
  • users    ~/~  'USE'-> List users Currently logged in,
  • uuencode ~/~'USE'-> Encode a binary files .
  • uudecode ~/~'USE'-> Decode a file created by uuencode,
  • v        ~/~     'USE'-> Verbosely list directory contents. (`ls -l -b'),
  • vdir     ~/~    'USE'-> Verbosely list directory contents. (`ls -l -b'),
  • vi       ~/~     'USE'-> Text Editor.
  • watch    ~/~ 'USE'-> Execute/display a program periodically.
  • wc       ~/~  'USE'-> Print byte, word, and line counts,
  • whereis  ~/~'USE'-> Report all known instances of a command.,
  • which    ~/~ 'USE'-> Locate a program file in the user's path,
  • while    ~/~ 'USE'-> Execute commands.
  • who      ~/~'USE'-> Print all usernames currently logged in.
  • whoami ~/~'USE'-> Print the current user id and name (`id -un').
  • xargs    ~/~'USE'-> Execute utility, passing constructed argument list(s).
  • yes      ~/~ 'USE'-> Print a string until interrupted.
  • .period  ~/~'USE'-> Run commands from a file,
  •   ###    ~/~'USE'-> Comment / Remark.

/* This are all LINUX command with all use */

Thursday, October 7, 2010

Mod Rewrite with .htaccess

Enabling Mod Rewrite with .htaccess

Do you use mod-rewrite from apache to rewrite friendly URLs ?? This must be absolutely necessary for the rewrite module to get enabled in your apache, especially if your blog, forum script uses rewriting engine to generate friendly URLs in your site. Note that default apache2 installation does not come with mod-rewrite. Here is how you enable it. Issue the following command
# a2enmod rewrite
Once you run this command, apache will tell you that this rewrite module is enabled. You can find mod_rewrite enabled and show up in your test.php file.
I often experienced page not found 404 error with debian/ubuntu versions eventhough your apache runs with mod-rewrite. To fix this, you will need to edit the following file to make some changes.
nano /etc/apache2/sites-enabled/000-default
Find the following and change AllowOverride from None to All

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
Upload the .htaccess file to your server and restart apache. /etc/init.d/apache2 restart
Make sure your .htaccess file has 644 permission as otherwise you get permission denied error.

Wednesday, October 6, 2010

(Basic Command ) Linux BASH command line

alias    -Create an alias
awk      -Find and Replace text, database sort/validate/index
break    -Exit from a loop
builtin  -Run a shell builtin  
cal      -Display a calendar
case     -Conditionally perform a command
cat      -Display the contents of a file
cd       -Change Directory
cfdisk   -Partition table manipulator for Linux
chgrp    -Change group ownership
chmod    -Change access permissions
chown    -Change file owner and group
chroot   -Run a command with a different root directory
cksum    -Print CRC checksum and byte counts
clear    -Clear terminal screen
cmp      -Compare two files
comm     -Compare two sorted files line by line
command  -Run a command - ignoring shell functions
continue  -Resume the next iteration of a loop
cp       -Copy one or more files to another location
cron     -Daemon to execute scheduled commands
crontab  -Schedule a command to run at a later time
csplit   -Split a file into context-determined pieces
cut      -Divide a file into several parts
date     -Display or change the date & time
dc       -Desk Calculator
dd       -Data Dump - Convert and copy a file
declare  -Declare variables and give them attributes
df       -Display free disk space
diff     -Display the differences between two files
diff3    -Show differences among three files
dir      -Briefly list directory contents
dircolors  -Colour setup for `ls'
dirname  -Convert a full pathname to just a path
dirs     -Display list of remembered directories
du       -Estimate file space usage
echo     -Display message on screen
ed       -A line-oriented text editor (edlin)
egrep    -Search file(s) for lines that match an extended expression
eject    -Eject CD-ROM
enable   -Enable and disable builtin shell commands
env      -Display, set, or remove environment variables
eval     -Evaluate several commands/arguments
exec     -Execute a command
exit      -Exit the shell
expand   -Convert tabs to spaces
export   -Set an environment variable
expr     -Evaluate expressions
factor   -Print prime factors
false    -Do nothing, unsuccessfully
fdformat   -Low-level format a floppy disk
fdisk    -Partition table manipulator for Linux
fgrep    -Search file(s) for lines that match a fixed string
find     -Search for files that meet a desired criteria
fmt      -Reformat paragraph text
fold     -Wrap text to fit a specified width.
for      -Expand words, and execute commands
format   -Format disks or tapes
free     -Display memory usage
fsck     -Filesystem consistency check and repair.
function -Define Function Macros
gawk     -Find and Replace text within file(s)
getopts  -Parse positional parameters
grep     -Search file(s) for lines that match a given pattern
groups  -Print group names a user is in
gzip     -Compress or decompress named file(s)
hash     -Remember the full pathname of a name argument
head     -Output the first part of file(s)
history  -Command History
hostname  -Print or set system name
id       -Print user and group id's
if       -Conditionally perform a command
import   -Capture an X server screen and save the image to file
info     -Help info
install  -Copy files and set attributes
join    - Join lines on a common field
kill     -Stop a process from running
less     -Display output one screen at a time
let      -Perform arithmetic on shell variables
ln        -Make links between files
local     -Create variables
locate    -Find files
logname  -Print current login name
logout    -Exit a login shell
lpc        -Line printer control program
lpr        -Off line print
lprint     -Print a file
lprintd   -Abort a print job
lprintq   -List the print queue
lprm     -Remove jobs from the print queue
ls          -List information about file(s)
m4          -Macro processor
man         -Help manual
mkdir      -Create new folder(s)
mkfifo     -Make FIFOs (named pipes)
mknod    -Make block or character special files
more       -Display output one screen at a time
mount     -Mount a file system
mtools    -Manipulate MS-DOS files
mv         -Move or rename files or directories
nice       -Set the priority of a command or job
nl          -Number lines and write files
nohup   -Run a command immune to hangups
passwd   -Modify a user password
paste      -Merge lines of files
pathchk  -Check file name portability
popd     -Restore the previous value of the current directory
pr         -Convert text files for printing
printcap -Printer capability database
printenv -Print environment variables
printf   -Format and print data
ps       -Process status
pushd    -Save and then change the current directory
pwd      -Print Working Directory
quota    -Display disk usage and limits
quotacheck  -Scan a file system for disk usage
quotactl  -Set disk quotas
ram      -ram disk device
rcp      -Copy files between two machines.
read      -read a line from standard input
readonly  -Mark variables/functions as readonly
remsync  -Synchronize remote files via email
return    -Exit a shell function
rm         -Remove files
rmdir     -Remove folder(s)
rpm       -Remote Package Manager
rsync     -Remote file copy (Synchronize file trees)
screen   -Terminal window manager
sdiff    -Merge two files interactively
sed     -Stream Editor
select   -Accept keyboard input
seq      -Print numeric sequences
set      -Manipulate shell variables and functions
shift    -Shift positional parameters
shopt    -Shell Options
shutdown  -Shutdown or restart linux
sleep    -Delay for a specified time
sort      -Sort text files
source  -Run commands from a file `.'
split     -Split a file into fixed-size pieces
su        -Substitute user identity
sum      -Print a checksum for a file
symlink  -Make a new name for a file
sync     -Synchronize data on disk with memory
tac        -Concatenate and write files in reverse
tail        -Output the last part of files
tar        -Tape ARchiver
tee       -Redirect output to multiple files
test      -Evaluate a conditional expression
time     -Measure Program Resource Use
times   -User and system times
touch  -Change file timestamps
top     - List processes running on the system
traceroute  -Trace Route to Host
trap     -Run a command when a signal is set(bourne)
tr       -Translate, squeeze, and/or delete characters
true     -Do nothing, successfully
tsort    -Topological sort
tty      -Print filename of terminal on stdin
type     -Describe a command

ulimit   -Limit user resources
umask    -Users file creation mask
umount   -Unmount a device
unalias  -Remove an alias
uname    -Print system information
unexpand -Convert spaces to tabs
uniq     -Uniquify files
units    -Convert units from one scale to another
unset    -Remove variable or function names
unshar  -Unpack shell archive scripts
until     -Execute commands (until error)
useradd   -Create new user account
usermod  -Modify user account
users     -List users currently logged in
uuencode  -Encode a binary file
uudecode  -Decode a file created by uuencode

v        -Verbosely list directory contents (`ls -l -b')
vdir     -Verbosely list directory contents (`ls -l -b')
vi       -Text Editor

watch    -Execute/display a program periodically
wc       -Print byte, word, and line counts
whereis  -Report all known instances of a command   
which    -Locate a program file in the user's path.
while    -Execute commands
who      -Print all usernames currently logged in
whoami  - Print the current user id and name (`id -un')

xargs     -Execute utility, passing constructed argument list(s)
yes       -Print a string until interrupted

.period - Run commands from a file
###      Comment / Remark