I accidentally did rm * in a directory instead of another directory from console in a Ubuntu11 machine.is there any way to recover these files.
Step 1: Shut down your computer now (i.e. stop using the filesystem that contains the deleted files).
Step 2: Download a Live CD image on another computer (System Rescue CD would be a fine choice), burn it on a CD-R, boot your computer with it and use the available data recovery tools (e.g. photorec). If your data is really valuable to you, consider cloning the disk before attempting any data recovery (you don't want to make things worse, do you?). You can use partimage for that (included in System Rescue CD).
Step 3: Don't make the same mistake twice: Start backing-up your data regularly.