Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-04-2008, 04:53 AM   #1
LQ Newbie
Registered: Nov 2007
Posts: 6

Rep: Reputation: 0
How to remove file with name containing only special characters

The problem which i am facing is there are some file which are created automatically in my home directory and I want to delete them. I have pasted the result below which comes when I give a 'ls -l' command.

[genomics@Bioserver genomics]$ ls -l
total 32644
-rw-rw-r-- 1 genomics genomics 128785 Mar 7 16:46 |???|???
-rw-rw-r-- 1 genomics genomics 22966 Mar 12 14:03 |???|????
-rw-rw-r-- 1 genomics genomics 302253 Mar 7 13:48 |???|????
-rw-rw-r-- 1 genomics genomics 128174 Sep 5 2007 ????????
-rw-rw-r-- 1 genomics genomics 189411 Sep 5 2007 ????????
-rw-rw-r-- 1 genomics genomics 187613 Sep 5 2007 ????????
-rw-rw-r-- 1 genomics genomics 51433 Sep 5 2007 ????????
-rw-rw-r-- 1 genomics genomics 52319 Sep 5 2007 ?????????
-rw------- 1 genomics genomics 2135 Jun 12 10:49 bash_history_bak
drwxrwxr-x 3 genomics genomics 4096 Nov 9 2006 biosuite_check
-rwxr-xr-x 1 root root 2122 Jun 26 10:45 BLOSUM62
-rw-r--r-- 1 genomics genomics 43318 Mar 20 11:35 chr11_singleintrons
-rw-rw-r-- 1 genomics genomics 5128192 Jan 24 13:58 daily_backup.tar.gz
drwxr-xr-x 2 genomics genomics 4096 Jul 4 11:38 DOC
-rw-rw-r-- 1 genomics genomics 117311 Sep 5 2007 ????????%????D?????????????~r ?@
-rwxr-xr-x 1 root root 2716148 Aug 21 2007 formatdb
drwx------ 24 genomics genomics 4096 Jun 12 10:17 genomics
-rwxrwxr-x 1 genomics genomics 4513 Aug 7 2006
-rw-rw-r-- 1 genomics genomics 128687 Sep 5 2007 ????????J?5h\d??4g??i??@
-rw-rw-r-- 1 genomics genomics 116119 Sep 5 2007 ????????>?"?{J??t??@?W??
-rw-rw-r-- 1 genomics genomics 255 Aug 16 2007 main.cpp
-rw-rw-r-- 1 genomics genomics 2585 Aug 6 2007 Makefile
drwxrwxr-x 21 genomics genomics 4096 Jul 25 2007 mauktik
drwxr-xr-x 7 root root 4096 Jun 25 11:41 MUMmer3.15
-rw-rw-r-- 1 genomics genomics 0 Mar 4 11:54 -p
-rwxr-xr-x 1 root root 12533506 May 22 2006 Parcns
drwxrwxr-x 2 genomics genomics 4096 Dec 13 2006 Pdbdir
drwxrwxr-x 2 genomics genomics 4096 Apr 25 2007 pdbs
drwxrwxrwx 2 genomics genomics 4096 Jul 4 11:35 proteomics_testcases
-rw-rw-r-- 1 genomics genomics 1463 Aug 6 2007
-rw-rw-r-- 1 genomics genomics 32211 Mar 1 2006 SettingStepSize.htm
-rw-rw-r-- 1 genomics genomics 11365359 Mar 1 2007 TypeII_KEGG_path_MTBCDC1551.out_parsed
-rw------- 1 genomics genomics 330 Jun 12 10:50 Xauthority_bak
[genomics@Bioserver genomics]$

when I use the rm command to delete these files the desired result is not obtained and when I use rm and tab twice( bash shell) the name of these files changes a bit, below is the result

[genomics@Bioserver genomics]$ rm
-p biosuite_check
.Xauthority chr11_singleintrons
.bash_history daily_backup.tar.gz
.bash_profile formatdb
.bashrc genomics
.cvspass main.cpp
.fonts.cache-1 mauktik
.mozilla pdbs
.qt proteomics_testcases
.viminfo |�^U^H|�^U^H
BLOSUM62 |�^U^H|�^U^H^C
DOC |�^U^H|�^U^H^D
MUMmer3.15 ��^U^H��^U^H
Makefile ��^U^H��^U^H
Parcns ��^U^H��^U^HJ�5h\d��4g��i�^S@
Pdbdir ��^U^H��^U^H^A
SettingStepSize.htm ��^U^H��^U^H
TypeII_KEGG_path_MTBCDC1551.out_parsed ��^U^H��^U^H%����D��^E��^O���??��~r ^A@
Xauthority_bak ��^U^H��^U^H
bash_history_bak ��^U^H��^U^H>�"�{J�?t��@�W�?
[genomics@Bioserver genomics]$ rm

How do i remove these files??

Last edited by abhisheknayak; 07-04-2008 at 05:07 AM.
Old 07-04-2008, 05:11 AM   #2
Mr. C.
Senior Member
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 62
It is not obvious from your ls listing if the files actually contain question marks, or if the question marks mean "unprintable characters". So, you can use the -i option to rm. Be careful - answer Y to only those files you want removed:

rm -i *

Again; be careful. If you forget the -i, you will remove all your files.
Old 07-04-2008, 05:16 AM   #3
Registered: May 2008
Distribution: Centos; Ubuntu; Fedora
Posts: 98

Rep: Reputation: 15
Why don't you use [CODE REMOVED BY MODERATOR]. It should work. Before doing this, make sure you've copied your important files in the directory to another place . Good luck.

@tungvs, please be careful about giving advice. If this OTOH was a "joke" then it really is not and it is not appreciated.
@all: as your intro to LQ has shown you should always be careful about executing posted code. If unsure *do ask* for a second opinion before executing it.

Last edited by unSpawn; 07-04-2008 at 06:07 AM. Reason: Removed ill advice.
Old 07-04-2008, 05:20 AM   #4
Mr. C.
Senior Member
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 62

That will remove ALL of the OPs files.

Tungvs - please edit and remove that code from your post. This is very dangerous to new users, and your advice is not only bad, but likely against the policies of these forums.

Last edited by Mr. C.; 07-04-2008 at 05:22 AM.
Old 07-04-2008, 09:11 AM   #5
Registered: May 2008
Distribution: Centos; Ubuntu; Fedora
Posts: 98

Rep: Reputation: 15
Thanks for your warning, moderator and Mr.C. I've noticed to make sure the user have copied all his important files to another directory before executing the command. That's the way I clean my directory for strange files, and my reply is not offensive intentionally at all. Sorry if it makes any harms. I'll be more careful in giving advices.

Last edited by tungvs; 07-04-2008 at 09:13 AM.
Old 07-04-2008, 10:53 AM   #6
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Debian "Testing"
Posts: 6,110

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
Your filesystem may be corrupted.
Try running fsck
One way to do this is with a reboot, like this (as root)
shutdown -rF now


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
removing file with special characters rsashok Linux - General 4 02-09-2010 04:08 PM
How to rename file while copying - and remove special characters corporal79 Linux - General 3 10-11-2007 04:16 PM
Use of special characters in .netrc file jlarsen Linux - General 3 08-01-2007 10:12 AM
File Copy Issue-Special Characters fortezza Linux - Software 1 11-14-2005 07:16 AM
Convert special characters in text file nyk Linux - Software 1 01-05-2005 03:20 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:42 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration