LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-28-2015, 08:39 AM   #1
rng
Senior Member
 
Registered: Aug 2011
Posts: 1,198

Rep: Reputation: 47
How to remove this file with abnormal character in its name?


I am running Linux Debian Stable which is working fine. But I have a file on an ext4 partition which has an abnormal character in it. Now I cannot rename this file, nor can I delete it (even as root through sudo). This file also does not open (its supposed to be a pdf file). The 'cat' command with this file's name produces the response: : No such file or directory

I tried scanning the partition with the command: sudo e2fsck -f -y -v /dev/sda5 . It finished without reporting any error.

How can I remove this file? Thanks for your help.

Last edited by rng; 03-28-2015 at 08:41 AM.
 
Old 03-28-2015, 08:43 AM   #2
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
What is the name of the file, which character is causing the issues? I usually press tab and let the shell's autocomplete take care of oddly-named files -- either that or use quotes or wildcards where appropriate (for example rm *.pdf).
 
Old 03-28-2015, 12:07 PM   #3
rng
Senior Member
 
Registered: Aug 2011
Posts: 1,198

Original Poster
Rep: Reputation: 47
Its image is as follows (a question mark in a black diamond):

/\
|?|
\/

I paste it here as text but it does not appear in the post:

The image of this character is at: http://imgur.com/cAEkcoW

The full file name is: "Eur Heart J-2000-Widimsk!-823-31_PRAGUE-study.pdf"

The abnormal character is after Eur Heart J-2000-Widimsk and before -823-31_PRAGUE-study.pdf I have denoted that place with an '!'

Last edited by rng; 03-28-2015 at 12:15 PM.
 
Old 03-28-2015, 12:11 PM   #4
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Have you tried using shell autocomplete? Do you have a GUI file manager you could try?
 
Old 03-28-2015, 01:05 PM   #5
cepheus11
Member
 
Registered: Nov 2010
Location: Germany
Distribution: Gentoo
Posts: 286

Rep: Reputation: 91
The character in question is most likely a non-ASCII character encoded in an unexpected encoding. The "convmv" command can help with renaming the file and converting to the default encoding at the same time. The default encoding should be "UTF-8" nowadays.
 
Old 03-28-2015, 02:15 PM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,235

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Can you rename or delete it with mc? Or with any graphical file manager?
 
Old 03-28-2015, 05:38 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,992

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
Good ideas above.

Be sure to do an ls -l to be sure you aren't looking at a link.

sudo rm *.pdf assuming there is only one pdf.

I do think that maybe there is something going on.


Wonder if booting to a live cd would detect it.

Where is forcerm?
 
Old 03-28-2015, 08:02 PM   #8
rng
Senior Member
 
Registered: Aug 2011
Posts: 1,198

Original Poster
Rep: Reputation: 47
I removed all other files from that folder and then tried 'rm *.pdf' and it worked!

Earlier I had tried command rm "<name of file copied from terminal or from dolphin file manager>" and it was not working.

It was not getting renamed in GUI Dolphin file manager (KDE).

Thanks everyone for help.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove Particular character in file palani.ec Linux - Newbie 7 01-10-2013 11:49 AM
[SOLVED] awk: remove the last character in the file cristalp Programming 5 11-03-2011 10:19 AM
Removing abnormal character DEL from a file name linuxlover.chaitanya Linux - General 3 07-25-2011 12:11 AM
Remove last character from file/string linuxchump Programming 34 06-08-2009 04:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:27 PM.

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