How can we change the date/time in linux?
Ans : Changing date in linux is bit confusing. If you want to change date in GUI its very much easy and if you want to change it when it comes to CLI its bit hard to remember it.
Date is the command to check whats the present date
#date
To change the date use below command
#date MMDDHHMMYYYY.ss
MM => Two digit month value
DD => Two digit day value
HH => Two digit hour value
MM => Two digit minuite value
YYYY => Four digit year value
ss => Two digit seconds value(very rare we will be using this)
Example1 : I want to change the date to Nov 24 1:36 PM 2010
#date 112413362010
Example2 : I want to change the date to Jan 9th 8:05.04 AM 2010
#date 010908052010.04
Now the date will be changed to your required date.
How To Change The Date In Linux?
0 comments 11/25/2010 10:14:00 PM Posted by Surendra Kumar AnneLabels: Basics, How-To's
How To Set A PHP Path In Linux?
0 comments 11/17/2010 11:16:00 PM Posted by Surendra Kumar AnneLabels: How-To's
How can we set PHP path in linux?
Ans : When you install PHP and host some .php files on webserver your web server will not detect it. This is because your Apache server does not know how to interprit PHP files? And and where is php located? To eleminate this issue we have to set the php path in main php configuration file php.ini located in your machine. As the linux is open source and the location of this file differs from different flavors, so better option is to search for php.ini file as shown below.
find / -iname php.ini
or some common locations for Redhat and Ubuntu are shown below
For Redhat flavors
/etc/php.ini
For Ubuntu Flavors
/etc/php5/apache2/php.ini
To search for include_path and uncomment that before changes.
;include_path = ".:/usr/share/php"
After changes.
include_path = ".:/usr/share/php"
Now save and exit the file. And you have to restart the apache server to detect this settings.
For Redhat
#service httpd restart
For Ubuntu
/etc/init.d/apache2 restart
Now start coding in PHP and enjoy the php scripting.
How to implement ip forwarding in Linux
2 comments 10/19/2010 06:35:00 PM Posted by Surendra Kumar AnneLabels: How-To's, Proxy Servers, Routing
Why we require IP forwarding on a Linux machine?
Ans : We require IP forwarding on a Linux machine because to make it as a router or proxy server to share one internet connection to many client machines.
Let me explain how this will work with small example.
You have 2 machines which are in different network(PC1 in 10.0.0.0/255.0.0.0 network and PC2 in 192.168.0.0/255.255.255.0 network) and connected with a Linux machine(which is having two network interfaces). The IP address is as follows..
PC1: 192.168.0.1/255.255.255.0 default gateway:192.168.0.2
PC2: 10.0.0.1/255.0.0.0 default gateway:10.0.0.2
Linuxbox eth0 : 192.168.0.2/255.255.255.0
eth1 : 10.0.0.2/255.0.0.0
and Linux machine is having two LAN cards which are connected to both the

Ans : The answer to this question is No.
How to make PC1 to communicate with PC2?
Ans : The answer is enable ip forwarding on Linux machine. Some times this is called as bridging two networks.
To achieve IP forwarding we have to edit /etc/sysctl.conf as shown below. Open sysctl.conf and change the value of “net.ipv4.ip-forard” from 0 to 1 and save the file
#vi /etc/sysctl.conf
net.ipv4.ip-forard = 0
to
Once its done still you are not able to ping from PC1 to PC2. We have to restart the linuxbox to take this update to kernel.
Why to restart if its a production machine try below command to make your linuxbox aware of IP forwarding with out a restart.
echo 1 > /proc/sys/net/ipv4/ip-forward
Now try to ping from PC1 to PC2 which will ping successfully.