Linux commands
sed -i ’s/abc/xyz/g’ *.php
This command is used for mass replacemet using regular expression.
In the above command “abc” is replace with “xyz” from all the files extension “php”.
find /var/www/html/sch_admin/ -mtime -1
This command is used to list all the files within the specified folder,say “var/www/html/sch_admin/”, which have been created or modified within the period specified,say “-1″ which is last one day.
tar xvzf pig-0.5.0.tar.gz
untar the tar.gz file
Add /pig-n.n.n/bin to your path. Use export (bash,sh,ksh) or setenv (tcsh,csh). For example:
export PATH=/root/pig-0.5.0/bin:$PATH
Set JAVA_HOME as follows using syntax export JAVA_HOME=
If your path is set to /usr/java/jdk1.5.0_07/bin/java, set it as follows:
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre
Tip: Use the following command to find out exact path to which java executable under UNIX / Linux:
$ which java
* export command is used to set environment variable relevant on during the current session
For permanent setup – edit .bash_profile – as it get all the vars set on login
vi ~/.bash_profile
export JAVA_HOME=/usr
export PATH=/root/pig-0.5.0/bin:$PATH
Display date And time for each command
$ HISTTIMEFORMAT=”%d/%m/%y %T ”
OR
$ echo ‘export HISTTIMEFORMAT=”%d/%m/%y %T “‘ >> ~/.bash_profile
To see history type:
$ history
Output Sample:
1002 12/03/10 11:50:24 echo ‘export HISTTIMEFORMAT=”%d/%m/%y %T “‘ >> ~/.bash_profile