Showing posts with label Linux/Unix. Show all posts
Showing posts with label Linux/Unix. Show all posts

Friday, September 18, 2009

Empathy the new IM for Gnome

Historically, Pidgin has been the choice of IMs provided with Gnome or Linux. Pidgin has been the choice of multi-protocol clients for a huge crowd including windows enthusiants too. It enjoys a loyal following of developers and supporters from across the globe, who have volunteered a lot of plug-ins to Pidgin. This has made Pidgin quite a heavy app. I have been waiting to test Empathy from the time i heard it was in the works by the Gnome Development team.

A little bit about Empathy. Empathy is a messaging client that supports text messaging, Voice and most importantly Video calls. It also supports File transfer over XMPP or local networks, which I am not too keen on, but the support for Video chat in a multi-protocol IM is awesome. It supports Voice and Video using the open protocols, SIP and XMPP (think jabber and jingle). Empathy also supports location information.

Installing Empathy could be as easy as running

# yum install empathy

Loaded plugins: refresh-packagekit
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package empathy.x86_64 0:2.26.2-1.fc11 set to be updated
--> Processing Dependency: telepathy-salut for package: empathy-2.26.2-1.fc11.x86_64
--> Processing Dependency: telepathy-haze for package: empathy-2.26.2-1.fc11.x86_64
--> Processing Dependency: telepathy-gabble for package: empathy-2.26.2-1.fc11.x86_64
--> Processing Dependency: telepathy-filesystem for package: empathy-2.26.2-1.fc11.x86_64
--> Running transaction check
---> Package telepathy-filesystem.noarch 0:0.0.1-3.fc11 set to be updated
---> Package telepathy-gabble.x86_64 0:0.7.26-2.fc11 set to be updated
--> Processing Dependency: libloudmouth-1.so.0()(64bit) for package: telepathy-gabble-0.7.26-2.fc11.x86_64
---> Package telepathy-haze.x86_64 0:0.3.1-1.fc11 set to be updated
---> Package telepathy-salut.x86_64 0:0.3.9-1.fc11 set to be updated
--> Processing Dependency: libavahi-gobject.so.0()(64bit) for package: telepathy-salut-0.3.9-1.fc11.x86_64
--> Running transaction check
---> Package avahi-gobject.x86_64 0:0.6.25-3.fc11 set to be updated
---> Package loudmouth.x86_64 0:1.4.3-5.fc11 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package                   Arch        Version               Repository    Size
================================================================================
Installing:
empathy                   x86_64      2.26.2-1.fc11         updates      1.4 M
Installing for dependencies:
avahi-gobject             x86_64      0.6.25-3.fc11         updates       30 k
loudmouth                 x86_64      1.4.3-5.fc11          updates       79 k
telepathy-filesystem      noarch      0.0.1-3.fc11          fedora       3.5 k
telepathy-gabble          x86_64      0.7.26-2.fc11         updates      330 k
telepathy-haze            x86_64      0.3.1-1.fc11          updates       57 k
telepathy-salut           x86_64      0.3.9-1.fc11          fedora       248 k

Transaction Summary
================================================================================
Install      7 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        

Total download size: 2.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): avahi-gobject-0.6.25-3.fc11.x86_64.rpm            |  30 kB     00:01    
(2/7): empathy-2.26.2-1.fc11.x86_64.rpm                  | 1.4 MB     00:20    
(3/7): loudmouth-1.4.3-5.fc11.x86_64.rpm                 |  79 kB     00:02    
(4/7): telepathy-filesystem-0.0.1-3.fc11.noarch.rpm      | 3.5 kB     00:00    
(5/7): telepathy-gabble-0.7.26-2.fc11.x86_64.rpm         | 330 kB     00:07    
(6/7): telepathy-haze-0.3.1-1.fc11.x86_64.rpm            |  57 kB     00:03    
(7/7): telepathy-salut-0.3.9-1.fc11.x86_64.rpm           | 248 kB     00:01    
--------------------------------------------------------------------------------
Total                                            53 kB/s | 2.1 MB     00:40    
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : telepathy-filesystem-0.0.1-3.fc11.noarch                 1/7
  Installing     : telepathy-haze-0.3.1-1.fc11.x86_64                       2/7
  Installing     : avahi-gobject-0.6.25-3.fc11.x86_64                       3/7
  Installing     : telepathy-salut-0.3.9-1.fc11.x86_64                      4/7
  Installing     : loudmouth-1.4.3-5.fc11.x86_64                            5/7
  Installing     : telepathy-gabble-0.7.26-2.fc11.x86_64                    6/7
  Installing     : empathy-2.26.2-1.fc11.x86_64                             7/7

Installed:
  empathy.x86_64 0:2.26.2-1.fc11                                               

Dependency Installed:
  avahi-gobject.x86_64 0:0.6.25-3.fc11                                         
  loudmouth.x86_64 0:1.4.3-5.fc11                                              
  telepathy-filesystem.noarch 0:0.0.1-3.fc11                                   
  telepathy-gabble.x86_64 0:0.7.26-2.fc11                                      
  telepathy-haze.x86_64 0:0.3.1-1.fc11                                         
  telepathy-salut.x86_64 0:0.3.9-1.fc11                                        

Complete!

or

# apt-get install empathy

based on your distribution. you can also build it from the sources. I use Fedora 11 and i had to have farsight2 and gstramer-plugins installed to get video and voice calls working. Once empathy starts you can add your yahoo and gtalk accounts…even MSN accounts without any problems. Just remember to change the default ports to 80 instead.

Video and Voice using gtalk work flawlessly.

I like the smoother interface of Empathy and the clean look. Thanks to the team, they did a wonderful job.

Monday, August 10, 2009

Finding files in Linux / Unix

I have a lot of friends and colleagues who ask me about searching files in unix. Most of them are web-developers and graphic designers, who are typically not from the Unix world and are intimidated by the console world. This blog is mainly for them.

find is a very powerful command, the only problem is figuring out how to use it to get the result you want. In its simplest form, the syntax of find command looks like this:

$ find path parameters/operators

path is the path where you want to search for the files, and parameters/operators are usually the criteria on which you want to find the files eg: name, date etc.,

most common form of find command would be as below:

# find / –name Downloads

The above command will search the complete filesystem for a file/folder named “Downloads”

The other options that are available are

find –name filename find the file filename
find –perm mode finds the files based on the permission/access mode. Access mode here has to be specified in octal viz., 640 etc.,
find –type c finds files based on the filetype, viz.,
b for block special files
c for character special files
d for folders or directories
f for plain files
l for symbolic links
p for Named pipe files
s for socket files
find –name username find files owned by the user <username>. username can be specified as UID
find –group groupname find files owned by the group <groupname>. groupname can be specified as GID
find –size n find files by their size. n  denotes blocks. each block is 512 bytes. +n can be used to look for files larger than n blocks.
find –atime n


-
mtime n

-ctime n
find files last accessed n days ago. to make this command even more powerful, you could use –n to say files accessed less than n days ago.

same as –atime, except that it looks for content modified time

same as –atime except that it looks for access mode changed time
find –newer file finds files that have a modified time stamp that is more recent than the file specified
find operator1 –a  operator2 find files that match operator1 and operator2. this is the default behaviour when two operators are specified, so –a is optional
find operator1 –o operator2 find files that match operator1 or  operator2
find !operator find files that do not match operator
find \{expression \} find using regular expressions…very complex and powerful
-print prints the output to standard output ie., console
-exec command executes the command. command must end with \; as shown in the example below:
# find –name “*.mp3” –exec rm –rf {} \;
the above command will search for files with extension “.mp3” in the current folder and delete them.
{} in the above command will ensure that the complete path of the file is passed onto the command.
-ok command works exactly like –exec command, except that in this case, it prompts the user before executing the command

Some examples:

$ ls –l `find . –type l -print`

find . –type l –print in the above command will print all the symbolic links in the current directory. –print will print it to standard output, in this case, it is being redirected to ls –ld, which in turn will print them in a long listing format.

$ find . –atime 4 –print

will find files that were last accessed 4 days ago

$ find . –mtime 7 –print

will find files that were modified 7 days ago. You also specify a range of time.

$ find . –mtime 7 –mtime –9 –print

will find files that were modified between 7 to 9 days ago.

If you wanted to delete all the files in the current directory and sub-directory that have not been accessed in 90 days, then you would use the command below:

$ find . –atime +90 –exec rm –rf {} \;

pretty powerful isn’t it. you could also tweak this command to delete only the log files like *.log or *.tmp easily.

$ find . –atime +90 \(–name “*.log” –o –name “*.tmp”\) –exec rm –rf {} \;

Combining GREP and FIND

If you wanted to search for a particular word in all the files of a particular directory, then you could do a command substitution with grep as below:

$ egrep ‘findme’ `find . –type f -print`

 

There is a lot more we could do by combining the power of find with other commands. We barely scratched the surface here.