LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 09-11-2009, 10:49 PM   #1
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, (Which Exit LOL), USA
Distribution: Centos 6.7 Under VMware in Win7
Posts: 472

Rep: Reputation: 34
rm: cannot lstat


I'm having problems deleting a file as indicated below...also please note the quote marks around the file name, I don't know if this has anything to do with the problem. The file got to where it is using Kompozer.

Using find / -name zombie* -print doesn't show the file but it is there when I go into the directory and list the files in that directory.

Can't cat it either. I have no idea how to resolve this and I'd like to get rid of this.

Thanks CENTOS 5.3

-rw-r--r-- 1 rifkinho rifkinho 395 Sep 11 23:08 'zombieonehomepage.html'
[root@centos5 rifkinho]# rm -r 'zombieonehomepage.html'
rm: cannot lstat `zombieonehomepage.html': No such file or directory
[root@centos5 rifkinho]# rm 'zombieonehomepage.html'
rm: cannot lstat `zombieonehomepage.html': No such file or directory
[root@centos5 rifkinho]# cd /
[root@centos5 /]# pwd
/
[root@centos5 /]# find / -name zombie* -print
/var/www/html/zombieone
/var/log/httpd/zombieone.com-error_log
/var/log/httpd/zombieone.com-access_log
[root@centos5 /]#
 
Old 09-11-2009, 11:06 PM   #2
ongte
Member
 
Registered: Jun 2009
Location: Penang, Malaysia
Distribution: Mageia, CentOS, Ubuntu
Posts: 468

Rep: Reputation: 72
You refer to the file like this:
\'zombieonehomepage.html\'

To delete it:
rm \'zombieonehomepage.html\'
 
Old 09-11-2009, 11:11 PM   #3
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, (Which Exit LOL), USA
Distribution: Centos 6.7 Under VMware in Win7
Posts: 472

Original Poster
Rep: Reputation: 34
Ongte,

Worked like a charm...this is one post that I'll keep around in my notes for a long time to come.

Thanks again much appreciated.
 
Old 09-11-2009, 11:26 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,650

Rep: Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092
Better to understand why it works - and how "escaping" special characters can help you more generally.
Try searching on "escaping filename"
 
Old 09-13-2009, 08:31 AM   #5
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, (Which Exit LOL), USA
Distribution: Centos 6.7 Under VMware in Win7
Posts: 472

Original Poster
Rep: Reputation: 34
Yes, you are correct, I was going to ask Ongte where is the best place to find out how this works?
 
Old 09-13-2009, 08:40 AM   #6
ongte
Member
 
Registered: Jun 2009
Location: Penang, Malaysia
Distribution: Mageia, CentOS, Ubuntu
Posts: 468

Rep: Reputation: 72
These are called escape characters.

TLDP is a good resource for learning these basics. Link below to the Bash Beginners Guide.
http://tldp.org/LDP/Bash-Beginners-Guide/html/
Look in Chapter 3.3.
 
Old 09-13-2009, 08:48 AM   #7
karlatLQ
Member
 
Registered: Sep 2009
Posts: 67

Rep: Reputation: 19
Quote:
Originally Posted by swamprat View Post
Using find / -name zombie* -print doesn't show the file but it is there when I go into the directory and list the files in that directory.

Can't cat it either. I have no idea how to resolve this and I'd like to get rid of this.
You would need to use the escape character for the find command as well. It was looking for files that started with "z" but it did not find it because the file you wanted to find started with "'". You removed the file, but if you have a similar file you would find it like this:

Code:
find / -name \'zombie* -print
And you would cat it using the escape character as well:

Code:
cat \'zombie*
 
  


Reply


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
using lstat st_mode flags and masks smoking81 Programming 1 10-03-2008 05:17 AM
rm: cannot lstat `/mnt/share1': Input/output error toadeny Linux - Networking 3 06-27-2008 02:40 AM
Where is lstat man page? sheintze Debian 6 03-20-2007 11:52 AM
installed cedega get exists lstat socket error? degraffenried13 Linux - Games 2 05-28-2005 10:08 PM
error: failed to lstat /tmp/.302.2fa859: ferdog Linux - Newbie 7 07-18-2003 09:14 AM


All times are GMT -5. The time now is 02:42 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration