How to remove file with name containing only special characters
Hi,
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 getHelp.py -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 push.cc -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 .biosuite getHelp.py .cvspass main.cpp .fonts.cache-1 mauktik .mozilla pdbs .qt proteomics_testcases .ssh push.cc .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?? |
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. |
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 :D. Good luck.
//moderator.notes: @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. |
DO NOT DO THAT !
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. |
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.
|
Your filesystem may be corrupted.
Try running fsck One way to do this is with a reboot, like this (as root) shutdown -rF now |
All times are GMT -5. The time now is 07:25 PM. |