Google is a nice addition to your ubuntu 9.04 desktop. Here is how I installed it.
Get the deb package from http://www.getdeb.net/release/3767
$ sudo dpkg -i google-gadgets_0.10.5-1~getdeb2_i386.deb
If it asks for any dependency , install them too.
Open a terminal and run
$ ggl-gtk
Now the google gadget panel will appear on the screen. There are lot of cool gadget available. You can install them by right clicking on the gadget panel.
Tuesday, July 14, 2009
Monday, July 13, 2009
Backing Up tar Archives Over ssh
OpenSSH provides tools to securely do remote login, remote execution, and remote file copy over network . It also supports encryption keys so that you can use it on remote machisne wiht out entering passwords repeatedly.
tar can be used along with ssh so that you can create backups on/of remote machines quickly.
The following examples show how this can be achieved.
Create a back up directory and change to it.
$ mkdir backup ; cd backup
Use ssh and tar to copy files.
$ ssh fermi@ serverip ‘tar cf - myfile*’ | tar xvf -
fermi@serverip password: ******
myfile1
myfile2
The above command will copy all files beginning with myfile from the home
directory of fermi on serverip and placed in the current directory. Note that the left
side of the pipe creates the archive and the right side expands the files from the archive
to the current directory. (Be careful. ssh can overwrite files in the current directory with out asking you.)
On the otherhand if you want to copy files from the local system to the remote system, run a local tar command first. This time, however, we add a cd command to put the files in the
directory of our choice on the remote machine:
$ tar cf - myfile* | ssh fermi@serverip ‘cd /home/fermi/myfolder; tar xvf - ’
fermi@serverip password: ******
myfile1
myfile2
Now let us try to make tgz files at the recieveing end by compressing the tar archive.
$ ssh fermi@serverip ‘tar czf - myfile*’ | cat > myfiles.tgz
$ tar cvzf - myfile* | ssh fermi@serverip ‘cat > myfiles.tgz’
( Put the ip address of the server at all places where serverip is shown.)
tar can be used along with ssh so that you can create backups on/of remote machines quickly.
The following examples show how this can be achieved.
Create a back up directory and change to it.
$ mkdir backup ; cd backup
Use ssh and tar to copy files.
$ ssh fermi@ serverip ‘tar cf - myfile*’ | tar xvf -
fermi@serverip password: ******
myfile1
myfile2
The above command will copy all files beginning with myfile from the home
directory of fermi on serverip and placed in the current directory. Note that the left
side of the pipe creates the archive and the right side expands the files from the archive
to the current directory. (Be careful. ssh can overwrite files in the current directory with out asking you.)
On the otherhand if you want to copy files from the local system to the remote system, run a local tar command first. This time, however, we add a cd command to put the files in the
directory of our choice on the remote machine:
$ tar cf - myfile* | ssh fermi@serverip ‘cd /home/fermi/myfolder; tar xvf - ’
fermi@serverip password: ******
myfile1
myfile2
Now let us try to make tgz files at the recieveing end by compressing the tar archive.
$ ssh fermi@serverip ‘tar czf - myfile*’ | cat > myfiles.tgz
$ tar cvzf - myfile* | ssh fermi@serverip ‘cat > myfiles.tgz’
( Put the ip address of the server at all places where serverip is shown.)
Sunday, July 12, 2009
Searching man pages with apropos and whatis
I had made an earlier post on reading man pages. In this post we will look at apropos utility with which you can search the man pages of any Linux command for keywords. There is a description section associated with each man page . The apropos command searches the description section for a given keyword. Keywords can be a regular expression or wild-cards , or match the exact keyword.
As an example try
All similar man page entries are shown. This can be very useful when you search for a particular command or man page.
Now try
Another utility that can be used for searching man pages is 'whatis'
The relevant man page section is also shown as the second parameter Aon each of the result line. It is also suggested to try the following for getting more ideas /flags on apropos
$ man apropos
$ apropos apropos
$ man whatis
$ whatis aprops
$ apropos whatis
As an example try
$apropos passwd
chgpasswd (8) - update group passwords in batch mode
chpasswd (8) - update passwords in batch mode
fgetpwent_r (3) - get passwd file entry reentrantly
getpwent_r (3) - get passwd file entry reentrantly
gpasswd (1) - administer the /etc/group and /etc/gshadow files
htpasswd (1) - manipulate HTTP-server password files
htpasswd.apache2-utils (1) - Manage user files for basic authentication
lppasswd (1) - add, change, or delete digest passwords.
mkpasswd (1) - Overfeatured front end to crypt(3)
mksmbpasswd (8) - formats a /etc/passwd entry for a smbpasswd file
pam_localuser (8) - require users to be listed in /etc/passwd
passwd (1) - change user password
passwd (1ssl) - compute password hashes
passwd (5) - the password file
passwd2des (3) - RFS password encryption
smbpasswd (5) - The Samba encrypted password file
smbpasswd (8) - change a user's SMB password
SSL_CTX_set_default_passwd_cb (3ssl) - set passwd callback for encrypted PEM ...
SSL_CTX_set_default_passwd_cb_userdata (3ssl) - set passwd callback for encry...
update-passwd (8) - safely update /etc/passwd, /etc/shadow and /etc/group
All similar man page entries are shown. This can be very useful when you search for a particular command or man page.
Now try
$ apropos pass*
bluetooth-applet (1) - GNOME applet for prompting the user for a Bluetooth pa...
chage (1) - change user password expiry information
checkPasswdAccess (3) - query the SELinux policy database in the kernel.
chgpasswd (8) - update group passwords in batch mode
chpasswd (8) - update passwords in batch mode
cpgr (8) - copy with locking the given file to the password or gr...
cppw (8) - copy with locking the given file to the password or gr...
crypt (3) - password and data encryption
crypt_r (3) - password and data encryption
des_read_2passwords (3ssl) - Compatibility user interface functions
des_read_password (3ssl) - Compatibility user interface functions
ecryptfs-add-passphrase (1) - add an eCryptfs mount passphrase to the kernel ...
ecryptfs-insert-wrapped-passphrase-in... (1) - unwrap a wrapped passphrase fr...
ecryptfs-rewrap-passphrase (1) - unwrap an eCryptfs wrapped passphrase, rewra...
ecryptfs-unwrap-passphrase (1) - unwrap an eCryptfs mount passphrase from file.
ecryptfs-wrap-passphrase (1) - wrap an eCryptfs mount passphrase.
endpwent (3) - get password file entry
endspent (3) - get shadow password file entry
EVP_BytesToKey (3ssl) - password based encryption routine
expiry (1) - check and enforce password expiration policy
fgetpwent (3) - get password file entry
fgetpwent_r (3) - get passwd file entry reentrantly
fgetspent (3) - get shadow password file entry
fgetspent_r (3) - get shadow password file entry
getpass (3) - get a password
getpw (3) - Re-construct password line entry
getpwent (3) - get password file entry
getpwent_r (3) - get passwd file entry reentrantly
getpwnam (3) - get password file entry
Another utility that can be used for searching man pages is 'whatis'
$ whatis passwd
passwd (1) - change user password
passwd (1ssl) - compute password hashes
passwd (5) - the password file
The relevant man page section is also shown as the second parameter Aon each of the result line. It is also suggested to try the following for getting more ideas /flags on apropos
$ man apropos
$ apropos apropos
$ man whatis
$ whatis aprops
$ apropos whatis
Friday, July 10, 2009
Rebuilding a deb package from an installation
If you have an ubuntu/debian system , you can rebuild the deb file of any installed package. For this install the dpkg-repack package.
# apt-get install dpkg-repack
Suppose you have aspell installed on you system . Rebuild the package as below.
# dpkg-repack aspell
Now look at your current directory. You will see
aspell_0.60.6-1_i386.deb
dpkg-repack will work only as root.
# apt-get install dpkg-repack
Suppose you have aspell installed on you system . Rebuild the package as below.
# dpkg-repack aspell
Now look at your current directory. You will see
aspell_0.60.6-1_i386.deb
dpkg-repack will work only as root.
Thursday, July 9, 2009
dpkg tricks for Ubuntu / debian
In Debian GNU/Linux and its derivatives such as Ubuntu the software packages are bundled in a special format. We generally call them deb packages. A .deb package is basically
an archive of files that you want to install to your computer, plus some header and control
information that identifies the software. The deb files can be manipulated with dpkg command. Here are some common dpkg tricks that you can use in every day life on the Ubuntu/Debian systems.
Let us first get a debian package from Internet. I am using Ubuntu 9.04 for this tutorial and will be using aspell as a demo package. Download aspell from the Jaunty repository.
Installing a package manually.
# dpkg -i aspell_0.60.6-1_i386.deb
Removing the package
# dpkg -r aspell
#dpkg -P aspell ( Removes everything including config files.)
Now Let us explore the contents of a deb package.
Make a temporary directory.
#mkdir aspell_tmp
Extract the deb to the aspell_tmp directory.
# dpkg -x aspell_0.60.6-1_i386.deb aspell_tmp
You can see the package contents.
( Try ls -lR aspell_tmp)
The control information alone can be extrcted using -e flag instead of -x.
Or you can list the contents of a deb package as below.
# dpkg -c aspell_0.60.6-1_i386.deb
You can get details about the package with
#dpkg -p aspell
#dpkg -s aspell
If you find a strange file on your system you can check if it belongs to any package. Let us check the file /usr/share/man/man1/aspell.1.gz ( man page of aspell)
$ dpkg -S /usr/share/man/man1/aspell.1.gz
aspell: /usr/share/man/man1/aspell.1.gz
To see the installed files belonging to aspell try this
# dpkg -L aspell
If the package is not removed completely, you may see some configuration files left over.
an archive of files that you want to install to your computer, plus some header and control
information that identifies the software. The deb files can be manipulated with dpkg command. Here are some common dpkg tricks that you can use in every day life on the Ubuntu/Debian systems.
Let us first get a debian package from Internet. I am using Ubuntu 9.04 for this tutorial and will be using aspell as a demo package. Download aspell from the Jaunty repository.
Installing a package manually.
# dpkg -i aspell_0.60.6-1_i386.deb
Removing the package
# dpkg -r aspell
#dpkg -P aspell ( Removes everything including config files.)
Now Let us explore the contents of a deb package.
Make a temporary directory.
#mkdir aspell_tmp
Extract the deb to the aspell_tmp directory.
# dpkg -x aspell_0.60.6-1_i386.deb aspell_tmp
You can see the package contents.
( Try ls -lR aspell_tmp)
The control information alone can be extrcted using -e flag instead of -x.
Or you can list the contents of a deb package as below.
# dpkg -c aspell_0.60.6-1_i386.deb
You can get details about the package with
#dpkg -p aspell
#dpkg -s aspell
If you find a strange file on your system you can check if it belongs to any package. Let us check the file /usr/share/man/man1/aspell.1.gz ( man page of aspell)
$ dpkg -S /usr/share/man/man1/aspell.1.gz
aspell: /usr/share/man/man1/aspell.1.gz
To see the installed files belonging to aspell try this
# dpkg -L aspell
If the package is not removed completely, you may see some configuration files left over.
Tuesday, July 7, 2009
File Attributes on ext3 file system
Files and directories in Linux file systems have read, write and execute permissions
associated with user, group, and others. However, there are also other attributes that
can be attached to files and directories that are specific to certain file system types.
For example, most of the present day distributions use the ext3 file system. In ext3 we can set other attributes to files and directories. Let us have a quick look. Run the following command in a terminal.
$ lsattr
------------------- ./Videos
------------------- ./apt.html
------------------- ./screenshot.bmp
------------------- ./Music
------------------- ./Documents
------------------- ./Pictures
------------------- ./examples.desktop
------------------- ./Templates
See the output . The dashes against each file directory represent the various attributes that can be set.
The ext3 has 13 such attributes. They are
a (append only)
c (compressed)
d (no dump),
i (immutable),
j (data journalling),
s (secure deletion), t (no tail-merging),
u (undeletable),
A (no atime updates),
D (synchronous directory updates),
S (synchronous updates), and
T (top of directory hierarchy).
These attributes can be manipulated with chattr command.
Here are some examples:
$ sudo chattr +i screenshot.bmp
$ sudo chattr +A -R examples.desktop
$ lsattr screenshot.bmp
----i-------- screenshot.bmp
As shown in the preceding example, with the +i option set, the screenshot.bmp file
becomes immutable, meaning that it can’t be deleted, renamed, or changed, or have a
link created to it. Here, this prevents any arbitrary changes to the file. (Not even the
root user can change the file until the i attribute is gone.) You can use this to help
protect system files.
To remove an attribute with chatter, use the minus sign (-). For example:
$ sudo chattr -i screenshot.bmp
The man pages of chattr has additional info on various attributes.
associated with user, group, and others. However, there are also other attributes that
can be attached to files and directories that are specific to certain file system types.
For example, most of the present day distributions use the ext3 file system. In ext3 we can set other attributes to files and directories. Let us have a quick look. Run the following command in a terminal.
$ lsattr
------------------- ./Videos
------------------- ./apt.html
------------------- ./screenshot.bmp
------------------- ./Music
------------------- ./Documents
------------------- ./Pictures
------------------- ./examples.desktop
------------------- ./Templates
See the output . The dashes against each file directory represent the various attributes that can be set.
The ext3 has 13 such attributes. They are
a (append only)
c (compressed)
d (no dump),
i (immutable),
j (data journalling),
s (secure deletion), t (no tail-merging),
u (undeletable),
A (no atime updates),
D (synchronous directory updates),
S (synchronous updates), and
T (top of directory hierarchy).
These attributes can be manipulated with chattr command.
Here are some examples:
$ sudo chattr +i screenshot.bmp
$ sudo chattr +A -R examples.desktop
$ lsattr screenshot.bmp
----i-------- screenshot.bmp
As shown in the preceding example, with the +i option set, the screenshot.bmp file
becomes immutable, meaning that it can’t be deleted, renamed, or changed, or have a
link created to it. Here, this prevents any arbitrary changes to the file. (Not even the
root user can change the file until the i attribute is gone.) You can use this to help
protect system files.
To remove an attribute with chatter, use the minus sign (-). For example:
$ sudo chattr -i screenshot.bmp
The man pages of chattr has additional info on various attributes.
Sunday, July 5, 2009
Learning (from) bash history
The Bourne Again Shell (bash) is the default shell in almost all Linux distributions. The bash shell has a history feature which can make life easier for any serious Linux user.
Open a shell and try the following .
$echo $HISTFILE $HISTSIZE $HISTFILESIZE
/home/fermi/.bash_history 500 500
The HISTFILE environment variable points to the name of the file where bash history is stored. When bash exits, history in memory is written back to the .bash_history file. The number of commands held in history during a bash session is set by $HISTSIZE, while the number of commands actually stored in the history file is set by $HISTFILESIZE.
You can use history command to list the entire command line history.
$history
You can list the last n entries in the history as below. (n=5)
$history 5
424 man fc
425 echo $HISTFILE $HISTSIZE $HISTFILESIZE
426 history
427 history 10
428 history 5
You can use up arrow and down arrow keys to move around the history buffer.Once a command is displayed, you can use the keyboard to edit the current command like any other command: left arrow, right arrow, Delete, Backspace, and so on.
There are some other tricks you can use .
~$ !! run the previous command
~$ !427 run command numbered 427 from history
~$ !423 *.jpg append *.jpg to command 423
~$ !ls run previous command starting with ls
You can search command history for a specific string by pressing Crtl together with r
$ <Ctrl+r> ( You will not see this)
reverse-i-search)`':
You can type in the string to be searched after the colon and press enter.
You can press Ctrl+r repeatedly to search backwards through your history list for a specific occurrence of the string.
There is another way of editing the history using fc command. Try this
$fc -e vim 427
This will open command 427 in vim and you can edit it and save it back to history. RTFM fc for details.
Open a shell and try the following .
$echo $HISTFILE $HISTSIZE $HISTFILESIZE
/home/fermi/.bash_history 500 500
The HISTFILE environment variable points to the name of the file where bash history is stored. When bash exits, history in memory is written back to the .bash_history file. The number of commands held in history during a bash session is set by $HISTSIZE, while the number of commands actually stored in the history file is set by $HISTFILESIZE.
You can use history command to list the entire command line history.
$history
You can list the last n entries in the history as below. (n=5)
$history 5
424 man fc
425 echo $HISTFILE $HISTSIZE $HISTFILESIZE
426 history
427 history 10
428 history 5
You can use up arrow and down arrow keys to move around the history buffer.Once a command is displayed, you can use the keyboard to edit the current command like any other command: left arrow, right arrow, Delete, Backspace, and so on.
There are some other tricks you can use .
~$ !! run the previous command
~$ !427 run command numbered 427 from history
~$ !423 *.jpg append *.jpg to command 423
~$ !ls run previous command starting with ls
You can search command history for a specific string by pressing Crtl together with r
$ <Ctrl+r> ( You will not see this)
reverse-i-search)`':
You can type in the string to be searched after the colon and press enter.
You can press Ctrl+r repeatedly to search backwards through your history list for a specific occurrence of the string.
There is another way of editing the history using fc command. Try this
$fc -e vim 427
This will open command 427 in vim and you can edit it and save it back to history. RTFM fc for details.
Saturday, July 4, 2009
Watching movies with smplayer

The mplayer project is one of the best movie players for both windows and linux. Mplayer is basically a console based player. There are several projects on the internet providing GUI front ends to mplayer.
smplayer is one of the best front ends that you can download. Both source and binary releases of smplayer are available on sourceforge.
For installation on ubuntu 9.04 you can try the following steps. The mplayer bundled with jaunty is slightly outdated. You can update mplayer to a more recent version and install smplayer front end following the steps below.
Step 1
Add the following lines to /etc/sources.listdeb http://ppa.launchpad.net/awn-testing/ubuntu jaunty maindeb http://ppa.launchpad.net/rvm/mplayer/ubuntu jaunty main
Step 2
Open a terminal and add the apt key of the PPA
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 12345678sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu. com 03E02400
Step 3
Update
sudo apt-get update
Step 4
Install and enjoy.
sudo apt-get install mplayer
sudo apt-get install smplayer
A windows version of smplayer is also available on the website.
Installing midori on ubuntu Jaunty

Midori is a light weight browser developed as a part of Xface desktop environment. You can download the source code of midori from here. It uses webkit rendering engine and gtk2. This how to will show the installation of midori on Ubuntu 9.04 .
Step 1
Add the follwoing repositories to /etc/sources.list
deb http://ppa.launchpad.net/webkit-team/ppa/ubuntu jaunty main
deb http://ppa.launchpad.net/midori/ppa/ubuntu jaunty main
Step 2
Import the keys of the above PPAs
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 2D9A3C5B
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A69241F1
Step 3
Update the apt database
sudo apt-get update
Step 4
Install midori
sudo apt-get install midori
Enjoy the browser. Don't forget to report bugs as the software is under heavy development.
Sunday, June 28, 2009
Using ssh to access GUI program on a remote machine
Suppose you have two machines A and B . Let the ip addresses for A and B be a.a.a.a and b.b.b.b respectively. We will try to run gedit on B and get the graphical output on A. I am assuming both machies are ubuntu 9.04 Jaunty. This will work on other flavours of Linux too.
Install openssh server on machine B.
$ sudo apt-get install openssh-server
In Ubuntu ssh server will be started automatically. If not start it
$ssh username@b.b.b.b
username will be user of system B.
When you do this for the first time , you may be asked to type yes/no to add the finger print of the remote machine. Now enter the password and you are done.
You can execute normal shell commands on machine B now.
$ssh -X username@b.b.b.b
will also allow you to take GUI control.
Try running gedit on the remote machine. The GUI will come on your local machine.
Install openssh server on machine B.
$ sudo apt-get install openssh-server
In Ubuntu ssh server will be started automatically. If not start it
$ sudo /etc/init.d/sshd start
Now you can connect to B from A$ssh username@b.b.b.b
username will be user of system B.
When you do this for the first time , you may be asked to type yes/no to add the finger print of the remote machine. Now enter the password and you are done.
You can execute normal shell commands on machine B now.
$ssh -X username@b.b.b.b
will also allow you to take GUI control.
Try running gedit on the remote machine. The GUI will come on your local machine.
Friday, June 26, 2009
enter password for default keyring to unlock
Today I was fiddling around my Ubuntu ( jaunty ) desktop . I installed twitux , a twitter client and was happy with it. I switched off the machine and went for lunch. When I came back, twitux started asking this.
"enter password for default keyring to unlock
The application 'Twittux
wants access to the default keyring but it is locked"
I tried out my default login password. But could not start twitux.
I searched on net and finally arrived at a solution.
Here it is.
$ cd ~/.gnome2/keyrings
$ rm deault.keyring
That fixed my problem. The next time I started twitux, it asked me to setup a new password for the key ring.
"enter password for default keyring to unlock
The application 'Twittux
wants access to the default keyring but it is locked"
I tried out my default login password. But could not start twitux.
I searched on net and finally arrived at a solution.
Here it is.
$ cd ~/.gnome2/keyrings
$ rm deault.keyring
That fixed my problem. The next time I started twitux, it asked me to setup a new password for the key ring.
Setting up static IP in ubuntu 9.04 Jaunty
The network manager shipped with ubuntu 9.04 is not working properly when you try to setup a static ip.
Here is the solution.
$ sudo apt-get remove network-manager-gnome
The edit
/etc/network/interfaces
and set the interfaces manually
Here is my interfaces file.
auto lo
auto eth1
auto eth0
iface lo inet loopback
iface eth1 inet dhcp
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
Here is the solution.
$ sudo apt-get remove network-manager-gnome
The edit
/etc/network/interfaces
and set the interfaces manually
Here is my interfaces file.
auto lo
auto eth1
auto eth0
iface lo inet loopback
iface eth1 inet dhcp
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
How to copy a CD ROM in linux in Ubuntu
This how to will help you to make an iso image from your CDROM
1. Insert CD to be copied
2 Open a terminal
3 $ sudo umount /dev/cdrom0
(unmount the cd . Be careful about cdrom0 . It can be some thing else on your system. running mount with out arguments can help you to find out the cdrom device.)
4 $ sudo dd if=/dev/scd0 of=file.iso bs=2048 conv=notrunc
(the /dev/ listing may vary so be sure which is your cd. Also make sure that you have sufficient free space on the hard disk)
4. Once complete use your favourite .iso (k3b, brasaro, etc.) to burn the image back to another disk.
1. Insert CD to be copied
2 Open a terminal
3 $ sudo umount /dev/cdrom0
(unmount the cd . Be careful about cdrom0 . It can be some thing else on your system. running mount with out arguments can help you to find out the cdrom device.)
4 $ sudo dd if=/dev/scd0 of=file.iso bs=2048 conv=notrunc
(the /dev/ listing may vary so be sure which is your cd. Also make sure that you have sufficient free space on the hard disk)
4. Once complete use your favourite .iso (k3b, brasaro, etc.) to burn the image back to another disk.
Subscribe to:
Posts (Atom)