pkill command can be used to forcefully logout a user from a linux server
pkill -Kill -u joe
In the above command “joe” is the user we want to logout forcefully from the system.
Inorder to set default color scheme for vim editor add the following lines in .vimrc file in your home directory. If it is not there create it.
colo murphy syntax on
You may replace murphy in the above lines with your preferred color scheme
Comparison of Public DNS services
For a long time I was swiching between the opendns nameservers and Level3 owned nameservers. After that I also tried Google public dns. Today I thought I would make a final decision on which dns to use. Here follows the query time taken with each of three public dns services.
4.2.2.1 and 4.2.2.2
[root@localhost ~]# dig facebook.com @4.2.2.1 | grep Query | awk '{print $4}' 259 [root@localhost ~]# dig linkedin.com @4.2.2.1 | grep Query | awk '{print $4}' 269 [root@localhost ~]# dig twitter.com @4.2.2.1 | grep Query | awk '{print $4}' 259 [root@localhost ~]# dig php.net @4.2.2.1 | grep Query | awk '{print $4}' 270 [root@localhost ~]# dig orkut.com @4.2.2.1 | grep Query | awk '{print $4}' 260
Opendns (208.67.222.222 and 208.67.220.220 )
[root@localhost ~]# dig facebook.com @208.67.222.222 | grep Query | awk '{print $4}' 271 [root@localhost ~]# dig linkedin.com @208.67.222.222 | grep Query | awk '{print $4}' 270 [root@localhost ~]# dig twitter.com @208.67.222.222 | grep Query | awk '{print $4}' 270 [root@localhost ~]# dig php.net @208.67.222.222 | grep Query | awk '{print $4}' 269 [root@localhost ~]# dig orkut.com @208.67.222.222 | grep Query | awk '{print $4}' 270
Google public DNS (8.8.8.8 and 8.8.4.4)
[root@localhost ~]# dig facebook.com @8.8.8.8 | grep Query | awk '{print $4}' 119 [root@localhost ~]# dig linkedin.com @8.8.8.8 | grep Query | awk '{print $4}' 118 [root@localhost ~]# dig twitter.com @8.8.8.8 | grep Query | awk '{print $4}' 119 [root@localhost ~]# dig php.net @8.8.8.8 | grep Query | awk '{print $4}' 118 [root@localhost ~]# dig orkut.com @8.8.8.8 | grep Query | awk '{print $4}' 196
Conclusion
This was not the result that I had expected. I was thinking that there will be considerable difference between resolving time taken by Level3(4.2.2.1 and 4.2.2.2) and Opendns(208.67.222.222 and 208.67.220.220 ), but there was no considerable difference. My oh my, there is a real boost in resolving time when Google public DNS is used. So as for me Google public DNS is best choice.
I often encounter this problem. Sometimes after closing the firefox or after firefox crashes, when I run it again, I am presented with this dialog box. I used to delete the entire .mozilla folder in my directory to solve this problem. The problem with doing that, is you will lose all your bookmarks, saved passwords etc. The correct way to solve the issue is to remove the .parentlock file. The firefox profile for a user is stored in the folder ~/.mozilla/firefox/xxxx.default. The .parentlock file is stored in that folder. Following are the steps I used to resolve the problem.
[joe@localhost ~]$ cd .mozilla/firefox/ [joe@localhost firefox]$ ls a6022a7q.default profiles.ini [joe@localhost firefox]$ cd a6022a7q.default [joe@localhost a6022a7q.default]$ rm -rf .parentlock
Like most IT professionals, I prefer reading newspapers online. Unfortunately my linux machine did not have the fonts required to read Malayalam newspaper Malayalamanorama. This is how I got around the problem. The solution also shows how to install new fonts in fedora
su - root cd /usr/share/fonts mkdir manorama cd manorama wget http://www.manoramaonline.com/mmfont/Manorama.ttf fc-cache -f -v
Hope you find it useful
Installing Postgresql on Fedora 12
I recently installed Postgresql on my fedora 12 machine. To save others the effort, I am noting down how I did that. First install postgresql-server and client using yum
yum install postgresql postgresql-serverNow the installation is complete we have to initialise the database storage area on the disk. This is done with the following command
/etc/init.d/postgresql initdb
Next I edited the configuration file of postgresql. It was located at
/var/lib/pgsql/data/postgresql.conf
Remove # infront of the following lines. Instead of localhost in the following line, you can specify the IP at which postgresql must listen on your machine
listen_addresses = 'localhost' port = 5432
Apart from postgresql.conf, there are two more files which control client authentication. They were located at
/var/lib/pgsql/data/pg_hba.conf /var/lib/pgsql/data/pg_ident.conf
I made the following changes in the pg_hba.conf since I wished to have md5 authentication for hosts I changed the authentication methods for hosts as md5, while I kept the authentication method for local as ident itself, to create databases as user superuser postgres without need for a password
# TYPE DATABASE USER CIDR-ADDRESS METHOD # "local" is for Unix domain socket connections only local all all ident # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5
Now we are ready to go. Lets start the postgresql server with the following command
/etc/init.d/postgresql start
Now we will connect to the database server as postgres user and create a database and a user with permission to access the database.
su - postgres
createdb joetestdb
psql joetestdbNow we are in the posgresql client terminal. We will create a new user and grant permissions to that user on the database.
CREATE USER joe WITH PASSWORD 'mypassword'; GRANT ALL PRIVILEGES ON DATABASE joetestdb TO joe;
We can get out of the postgresql terminal with \q.
Hope that helps in getting started with PostGreSQL
Flushing dns cache in Linux
The nscd daemon handles the DNS cache. To flush the DNS cache restart the daemon with the following command
/etc/init.d/nscd restart
C programming in Linux – 1
C was the second programming language I learned. After playing with BASIC for around 4 years, I started programming in C at the age of 15. Till today C remains my favorite programming language. It was only after 3 more years, that I had the experience of using Linux. I was amazed at seeing that there are a lot of programming tools available on Linux. But I had no idea how to compile a simple program that would print out “Hello World”.
This is the first in line of a series of tutorials that I am planning to write on C programming in Linux. We will start off with a simple program that prints out Hello World. It would be nice if you create a directory for C programs you will be doing as part of this tutorial. I have created a directory cprogramming. In the directory open up your favorite editor and write and save the following program as helloworld.c
/* Program to print out Hello World on screen */ #include <stdio.h> main() { printf("Hello World"); }
Explanation
The first line is a comment. It is meant for documentation purpose only. The next line is called is a preprocessor directive. It tells the compiler that we are using functions defined in the file stdio.h in the program. Many basic input/output functions are declared in stdio.h .
Next is the main() function. Every executable C program must have a main() function and execution of the program starts in main() function. What lies in between the curly brackets {} is the body of main() function.
The printf(“Hello World”); statement is to print Hello world on the screen.
Compiling and running the program
On the terminal execute the command
gcc helloworld.cOn executing ls command you can find a new file a.out in the directory. It is the executable of helloworld.c . Unless otherwise stated the name of executatble programs generated by the gcc compiler is named as a.out . Lets execute the program by typeing ./a.out on the command line. We can see that the program prints out Hello World
As I had stated earlier every executable program generated by gcc has the default name a.out . We can specify a name for the executable at the time of compiling. At the command line type the following command
gcc -o helloword helloworld.c
-o option of the gcc command specifies the name for the executable file to be generated. Now we have an executable file helloworld in the directoy.
I think thats enough for the first post on C programming in Linux. We have learned how to compile and execute a simple C program in Linux. I will be discussing more advanced topics in the next posts.
GNOME Easter egg
This is an easter egg in gnome. If you have gnome installed, press Alt+F2 to bring up the run dialog box. In the run dialog box enter the command
free the fishA tiny fish starts moving around the screen. Isn’t it cool
?


