July 2012

Short cut keys for word document

ctrl + c - To copy text
ctrl + v - To paste the copied content
ctrl + b - To make the text bold
ctrl + f - To search. To continue search use ctrl+alt+y
ctrl + h - To replace text with given text.
ctrl + i - To make the text italic
ctrl + u - To underline the text
ctrl + j - To justify the paragraph
ctrl + l - To left justify the paragraph
ctrl + r - To right justify the paragraph
ctrl + e - To make the text centre
ctrl + d - To change the font and size
ctrl + k - To make a link
ctrl + x - To remove the selected text
ctrl + y - To repeat the last step
ctrl + z - To undo the action
ctrl + t - To create the tabbing in the next line
ctrl + s - To save the file
ctrl + n - To open new document
ctrl + o - To open the document
ctrl + w - To close the documen
ctrl + a - To select all content of the document

How to search pattern exist in the input files in linux / unix

For example file "text.txt" contains

Two friends were planned to go to city.
But it is night time, they have to cross the forest to reach the city.

grep friends

To search text without case sensitive

use -i option
grep -i FRIENDS It searches word friends in text.txt file and displays those lines.

To search pattern in directory and its sub directory recursively
use -r option to search recursively.
grep -ri friends .
It searches word friends in current and its sub-directories and display.

To search pattern and display the file names instead of lines inside each file

use -l option
grep -rli friends *

search all files and sub-directories in the current directory and list file names in which pattern exists.

To search lines which doesn't contain particular pattern

use -v for invert matching.
grep -v friends < text.txt
It display all lines expect those have word friends. so it display only second line.

Linux : interview questions

How to go to home directory from current directory?

Simply type cd it will change to home directory.

what is the use of touch command?

if file exists then sets the access and modification time to current time. If file not exists then creates one.

How to find difference between two directories?

diff -r old_dire new_dir

How to copy files to other directory, in which the file does not exists or updated in source directory?

use cp -u option

How to find the number of files in the current and its sub-directories?

find . -type f -print | wc -l

Displays the total number of files in the current working directory and all of its subdirectories.

How to format the file content

use fmt command

cat text.txt | fmt

what is the use of head?
Outputs the first few lines of the file

what is the use of tail command>
To get the recent/last few lines from file

How to transfer file to other machine securely?

Using scp command, can transfer fiels securely from one server to another server.
scp filename loginid@servername:/destination path

Oracle : interview Questions

How to get the DB name?

select FN_GET_DBNAME from dual;

How to get list of tables in the oracle database?

select object_name from all_objects where object_type='TABLE'

To get view
select object_name from all_objects where object_type='

To get list of packages
select object_name from all_objects where object_type='PACKAGE';

To get list of triggers

select object_name from all_objects where object_type='TRIGGER';

To get list of synonyms

select object_name from all_objects where object_type='SYNONYM'

How to check number connection in oracle DB?

oracle:select * from V$SESSION;

used to find the number of connection to oracle.

How to change the password:

alter USER sasikala identified by newpassword;


use PASSW command in SQL PLUS

what is data dictionary?

The data dictionary holds the information about the database. You can use this to view the privileges assigned to individual. The database information stored in tables and views.

How to get the indexes detail?

user index details available in user_indexes, query it and get the details.

select index_name, table_name from user_indexes where table_name='emp';

sql plus shows only first 80 characters of the LonG columns, how to view more?

you can use command

SET LONG 1000;

How to get version number?

select version from v$instance;

How to get hostname on which the oracle is installed?

select host_name from v$instance

How to get number of threads running in the instance?

select thread# from v$instance;

How to get the instance name?

select instance_name from v$instance;

How to get the current date in Oracle?

select sysdate from dual;

How to get current date and time?

select to_char(sysdate, 'dd-mon-yyyy hh24:mi:ss') from dual;

How to interpret the field value?

use decode function.
select decode(emp.status,'A','Active') from employee;
If the employee status is A then convert that Active and pass on to result.

jQuery - How to check Ajax call running in the page and display information accordingly?

In web page, we use the ajax calls to fetch or verify some specific data with out reloading the entire page.

For example
1. After entering username in registeration form, we want to validate already the same username used or not and show the information to choose new username.

2. on clicking button we want the dropdown to load from server

Oracle: How to check what NLS_Date_Format set in the database?

Use show parameter NLS

It will display NLS parameter Name, Type and Value


you can get those values using following query also


How to find difference between to revision in mercurial HG?

use hg diff command with -r option.

For example you want to see difference between revision 99 and 102 then

hg diff -r 99 -r 102 filename

It visualize the changes with + /- symbol.

Try this in Vim

Open a file in vim and type some number.
Keep the cursor in the number and press ctrl+x

continue do it, what did you notice?

The number gets decresed by one each time you press ctrl+x.

Drupal : Error : Notice: Undefined index: fbconnect_feed in fbconnect_stream_publish_node_insert() (line 43 of /home/fromne45/pu

When using drupal fbconnect module if your are getting the above error then try this solution:

In file fbconnect/fbconnect_stream_publish/fbconnect_stream_publish.module search function fbconnect_stream_publish_node_insert and Change the line from

if ($_SESSION['fbconnect_feed']['submit'] === TRUE) {


if (isset($_SESSION['fbconnect_feed']) && isset($_SESSION['fbconnect_feed']['submit']) && $_SESSION['fbconnect_feed']['submit'] === TRUE) {

one of my application running in apache and created using perl. When i view the pages in Internet Explorer, it shows the web pa

I checked the script, it is perfect passing the headers text/html. The page displays like
<title>add new trip</title>

finally i got this solution:

In apache, i have changed the DefaultType as text/html, so it start displaying page correctly.

DefaultType text/html

Perl : How to print the content to error log?

Use STDERR to push the content to error log.

For example, you want to print you are in particular module.

sub process{
my ($id,$parent) = @_;
print STDERR "Inside process";


Are you using STDERR for debugging? Instead use Log4perl cpan module for debugging.

Unix: tee command and its usage

Using tee command, you can write the output to STDOUT and file/files at the same time.

For example

When we list the process using ps -ef
ps -ef > process.txt

The output of the ps -ef written to process.txt.

If we use ps -ef | tee process.txt

The output displayed in STDOUT and written to process.txt also. We can even pass this ps -ef output to another command using another pipe like below

ps -ef | tee process.txt | grep httpd

so entire output of ps-ef stored in process.txt and the process which have httpd text will be displayed in STDOUT.

tee command overwrites process.txt every run. you can use tee -a to append the content to process.txt .

You can store the output to multiple files also using tee command like
ps -ef | tee process.txt process1.txt..

How to check the system stats in unix box?

using vmstat command , we can get the system stats.

vmstat -S 2 2

The result output looks like below

kthr memory page disk faults cpu
r b w swap free si so pi po fr de sr m0 m1 m2 m3 in sy cs us sy id
0 0 0 16780176 12070768 0 0 189 6 6 0 0 1 10 1 2 1278 2206 936 0 0 99
0 0 0 16699376 12171016 0 0 0 0 0 0 0 0 0 0 1 1010 951 606 0 0 100

from this you can get
1. No of Processes in Run Queue: using r value
2. No of Processes Blocked for I/O, paging, etc: using b value
3. No of Processes runnable but swapped: using w value
4. No of Swap-ins: using si value
5. No of Swap-outs: using so value
6. percentage of User CPU: using us
7. Percentage of System CPU: using sy
8. Percentage of Idle CPU : using id

How to send mail in perl?

Install cpan module MIME::Lite

use MIME::Lite;

if (my $mimemsg = MIME::Lite->new(from=>'sasikala.chinnasamy@gmail.com', to=>'admin@itechp2pexchange.com', subject =>'test mail',type=> 'text/plain', data=>'test msg', encoding=>'8bit'))
$mimemsg->send("sendmail", '/usr/lib/sendmail -t -oi -oem');

If you want to attach file then

if (my $mimemsg = MIME::Lite->new(from=>'sasikala.chinnasamy@gmail.com', to=>'admin@itechp2pexchange.com', subject =>'test mail',type=> 'text/plain', data=>'test msg', encoding=>'8bit'))
path=>'/tmp/test.pdf', filename=>'test.pdf');

$mimemsg->send("sendmail", '/usr/lib/sendmail -t -oi -oem');
more details refer http://search.cpan.org/~rjbs/MIME-Lite-3.028/lib/MIME/Lite.pm

HG - Mercurial - How to tag the repository latest changeset

hg clone repository_url/project
cd project
hg tag V1.2
hg commit
hg push

To speed up your system

If the disk space less then the system goes slow. To increase the speed,

1. Delete the unwanted files.
2. Clean temporary files : To clean temporary files in disk, you can use Accessories->system tools-> Disk Clean up->select the driver
3. Accessories -> system tools -> click Disk Deframenter. This helps to join the splited files into order so we will get space.

Special in July 2012

After 863 years, this July have 5 Sundays, 5 Mondays and 5 Tuesdays. This is happens once in every 863 years . Enjoy the special month.