Thursday, July 1, 2010
More questions to study
Job Interview Questions : More than 10000 software job interview questions which can help in your job interview
Tuesday, June 15, 2010
SED Linux command
SED Linux Command
sed stands for "stream editor".
SYNOPSIS
% sed [-an] command [file ...]
% sed [-an] [-e command] [-f command_file] [file ...]
DESCRIPTION
sed can be used to filter text files. The pattern to match is typically included between a pair of slashes // and quoted.
For EXAMPLE, to print lines containing the string "1024", you may use:
cat filename | sed -n '/1024/p'
Here, sed filters the output from the cat command. The option "-n" tells sed to block all the incoming lines but those explicitly matching the expression. The sed action on a match is "p"= print.
Here is another EXAMPLE, this time for deleting selected lines:
cat filename | sed '/.*o$/d' > new_file
In this EXAMPLE, lines ending with an "o" will be deleted. It uses a regular expression for matching any string followed by an "o" and the end of the line. The output (i.e., all lines but those ending with "o") is directed to new_file.
To search and replace, use the sed 's' action, which comes in front of two expressions:
cat filename | sed 's/string_old/string_new/' > newfile
sed stands for "stream editor".
SYNOPSIS
% sed [-an] command [file ...]
% sed [-an] [-e command] [-f command_file] [file ...]
DESCRIPTION
sed can be used to filter text files. The pattern to match is typically included between a pair of slashes // and quoted.
For EXAMPLE, to print lines containing the string "1024", you may use:
cat filename | sed -n '/1024/p'
Here, sed filters the output from the cat command. The option "-n" tells sed to block all the incoming lines but those explicitly matching the expression. The sed action on a match is "p"= print.
Here is another EXAMPLE, this time for deleting selected lines:
cat filename | sed '/.*o$/d' > new_file
In this EXAMPLE, lines ending with an "o" will be deleted. It uses a regular expression for matching any string followed by an "o" and the end of the line. The output (i.e., all lines but those ending with "o") is directed to new_file.
To search and replace, use the sed 's' action, which comes in front of two expressions:
cat filename | sed 's/string_old/string_new/' > newfile
Saturday, April 24, 2010
Linux Books and Interview Questions
Its really important to read right book for your interview and suggesting right books for interview question is the most important thing .
Some books are paid and doesnt contain right questions but some are free and it would be really good if the books are free
Below are some of the free books which is available
free Linux books
Linux Security Books
Technical Interview Questions
Linux Interview Questions
Java Interview Questions
Some books are paid and doesnt contain right questions but some are free and it would be really good if the books are free
Below are some of the free books which is available
free Linux books
Linux Security Books
Technical Interview Questions
Linux Interview Questions
Java Interview Questions
Saturday, March 20, 2010
GDB Commands
Qdb commands quick reference . GDB is used to debug C/C++ program on unix.
Below are the quick command of C/C++
Starting GDB
gdb start GDB, with no debugging _les
gdb program begin debugging program
gdb program core debug coredump core produced by program
gdb --help describe command line options
More Help on gdb on starting , stoping setting breakpoint in gdb
Below are the quick command of C/C++
Starting GDB
gdb start GDB, with no debugging _les
gdb program begin debugging program
gdb program core debug coredump core produced by program
gdb --help describe command line options
More Help on gdb on starting , stoping setting breakpoint in gdb
How to access Oracle from C++ on Linux ?
It is
Oracle C++ Call Interface
Oracle C++ Call Interface (OCCI) is a high-performance and comprehensive API to access the Oracle database. Based on Standard C++ and object-oriented paradigm, OCCI is designed for improved productivity and quality in developing Oracle database applications.
Introduced in Oracle9i, OCCI is being successfully used for client-server, middle-tier, and complex object modeling applications.
The Instant Client feature makes it extremely easy and fast to deploy an OCCI based application by eliminating the need and disk space of a full Oracle Client install. Users just need to install a small sized archive containing all the Oracle dynamic libraries to run their OCCI applications.
What's new in OCCI in Oracle 11g R1 release :
* Database Resident Connection Pooling(DRCP)
* SecureFile LOBs, Compression, Encryption, and Deduplication
* Client ResultSet cache
* Runtime Connection Load balancing
* Fault Diagnosability
* Objects access performance improvements
Oracle C++ Call Interface
Oracle C++ Call Interface (OCCI) is a high-performance and comprehensive API to access the Oracle database. Based on Standard C++ and object-oriented paradigm, OCCI is designed for improved productivity and quality in developing Oracle database applications.
Introduced in Oracle9i, OCCI is being successfully used for client-server, middle-tier, and complex object modeling applications.
The Instant Client feature makes it extremely easy and fast to deploy an OCCI based application by eliminating the need and disk space of a full Oracle Client install. Users just need to install a small sized archive containing all the Oracle dynamic libraries to run their OCCI applications.
What's new in OCCI in Oracle 11g R1 release :
* Database Resident Connection Pooling(DRCP)
* SecureFile LOBs, Compression, Encryption, and Deduplication
* Client ResultSet cache
* Runtime Connection Load balancing
* Fault Diagnosability
* Objects access performance improvements
Connecting MySQL with C++ on Linux
MySQL API ..
The C API code to connect mysql on unix ( linux ) is being distributed with MySQL. It is the part of mysqlclient library and allows C programs to access a database.
Following packages needs to be compiled to access mysql from C/C++ on unix.
* mysql: MySQL client programs and shared library
* mysqlclient: Backlevel MySQL shared libraries (old libs)
* mysql-devel: Files for development of MySQL applications (a must have)
* mysql-server: Mysql server itself
* gcc, make and other development libs: GNU C compiler
How do I compile and link program against MySQL libs?
$ mysql_config --libs
$ mysql_config --cflags
$ gcc -o output-file $(mysql_config --cflags) mysql-c-api.c $(mysql_config --libs)
$ ./output-file
Sample Program
/* Simple C program that connects to MySQL Database server*/
#include
#include
main() {
MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;
char *server = "localhost";
char *user = "root";
char *password = "PASSWORD"; /* set me first */
char *database = "mysql";
conn = mysql_init(NULL);
/* Connect to database */
if (!mysql_real_connect(conn, server,
user, password, database, 0, NULL, 0)) {
fprintf(stderr, "%s\n", mysql_error(conn));
exit(1);
}
/* send SQL query */
if (mysql_query(conn, "show tables")) {
fprintf(stderr, "%s\n", mysql_error(conn));
exit(1);
}
res = mysql_use_result(conn);
/* output table name */
printf("MySQL Tables in mysql database:\n");
while ((row = mysql_fetch_row(res)) != NULL)
printf("%s \n", row[0]);
/* close connection */
mysql_free_result(res);
mysql_close(conn);
}
The C API code to connect mysql on unix ( linux ) is being distributed with MySQL. It is the part of mysqlclient library and allows C programs to access a database.
Following packages needs to be compiled to access mysql from C/C++ on unix.
* mysql: MySQL client programs and shared library
* mysqlclient: Backlevel MySQL shared libraries (old libs)
* mysql-devel: Files for development of MySQL applications (a must have)
* mysql-server: Mysql server itself
* gcc, make and other development libs: GNU C compiler
How do I compile and link program against MySQL libs?
$ mysql_config --libs
$ mysql_config --cflags
$ gcc -o output-file $(mysql_config --cflags) mysql-c-api.c $(mysql_config --libs)
$ ./output-file
Sample Program
/* Simple C program that connects to MySQL Database server*/
#include
#include
main() {
MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;
char *server = "localhost";
char *user = "root";
char *password = "PASSWORD"; /* set me first */
char *database = "mysql";
conn = mysql_init(NULL);
/* Connect to database */
if (!mysql_real_connect(conn, server,
user, password, database, 0, NULL, 0)) {
fprintf(stderr, "%s\n", mysql_error(conn));
exit(1);
}
/* send SQL query */
if (mysql_query(conn, "show tables")) {
fprintf(stderr, "%s\n", mysql_error(conn));
exit(1);
}
res = mysql_use_result(conn);
/* output table name */
printf("MySQL Tables in mysql database:\n");
while ((row = mysql_fetch_row(res)) != NULL)
printf("%s \n", row[0]);
/* close connection */
mysql_free_result(res);
mysql_close(conn);
}
Thursday, February 4, 2010
Linux Commands Interview Questions
zcat- The zcat utility allows you to examine the contents of a compressed file much the same way that cat displays a file.
top-The top utility shows a listing of all running processes that is dynamically updated.
How do you find out what’s your shell? - echo $SHELL
How do you write a for loop in shell? -
for {variable name} in {list} do {statement} done
top-The top utility shows a listing of all running processes that is dynamically updated.
How do you find out what’s your shell? - echo $SHELL
How do you write a for loop in shell? -
for {variable name} in {list} do {statement} done
Subscribe to:
Posts (Atom)