LinuxQuestions.org
Help answer threads with 0 replies.
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 03-27-2012, 04:12 AM   #1
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Rep: Reputation: Disabled
cannot lstat error when tryin to remove a file in centos.


I have been trying to delete a .htaccess file but it shows the following error:

Code:
rm: cannot lstat `.htaccess': No such file or directory
But in reality that .htaccess file is there..i have tried many commaneds by searching it in the google but it shows the same error again.

And i cant even read that file...

how can i delete it?
 
Old 03-27-2012, 04:18 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
You could try moving everything except .htaccess to a temporary directory then rm -fr the .htaccess' directory (careful!) then re-creating the .htaccess' directory and moving the original files back.
 
Old 03-27-2012, 04:22 AM   #3
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Original Poster
Rep: Reputation: Disabled
b ut nothing is there in that directory.. i just have .htaccess and that i am not able to read and when typing it's name and when i press TAB its name doesnt come,it treats as if .htaccess file isnt there...
 
Old 03-27-2012, 04:30 AM   #4
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Original Poster
Rep: Reputation: Disabled
And i cant even change the permission of that file....it says no such file though i can see that file...
 
Old 03-27-2012, 04:51 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
OK -- so there are no other files to move aside and restore. You can do as suggested without the moving aside and back.
 
Old 03-27-2012, 04:55 AM   #6
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Original Poster
Rep: Reputation: Disabled
ya i did that...when i typed rm -rf .htaccess, it didnt give the error that i mentioned earlier,was happy for a moment thinking it got deleted but when i again typed the ls command,the file was still there..

When i use rm or rm -r filename, it gives the error that i told you about in my first post...rm -fr or rm -rf doesn't give any error...
 
Old 03-27-2012, 05:42 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Not rm -rf .htaccess, the idea is to remove it's parent directory.

Which directory is .htaccess in?
 
Old 03-27-2012, 05:56 AM   #8
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Original Poster
Rep: Reputation: Disabled
it's in var/www/html/../ directory..
 
Old 03-27-2012, 06:06 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Confirming ... it is /var/www/.htaccess and there is nothing else in /var/www?
 
Old 03-27-2012, 06:19 AM   #10
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Original Poster
Rep: Reputation: Disabled
well it's in /var/www/html/airway directory i.e /var/www/html/airway/.htaccess but it acts as if it isnt der...

and in this directory only .htaccess file is der when i do ls..
 
Old 03-27-2012, 07:06 AM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Do you mean plain ls? Plain ls would not list .htaccess unless it is an alias with a -a option.

To be sure there are no other files in the directory and to show if there are any un-displayed characters in .htaccess' name, what is the output of /bin/ls -a --escape /var/www/html/airway
 
Old 03-28-2012, 12:09 AM   #12
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Original Poster
Rep: Reputation: Disabled
No... i dnt knw why but the .htaccess file can b seen by typing ls command only,no need of using -a with it...

and hey thanks a lot.... When i used that /bin.....command it showed the actual format of that .htaccess file,it was \ .htaccess which is not shown by ls command and now i can read it wen i do \ .htaccess instead of .htaccess.

I would be really glad if you could please explain the meaning and use of that command and what it actually does...
 
Old 03-28-2012, 01:41 AM   #13
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by SarahGurung View Post
I would be really glad if you could please explain the meaning and use of that command and what it actually does...
Using /bin/ls ensures that any alias you may have for ls (very common) is not used.

From the ls man page:
Code:
--escape
              print C-style escapes for nongraphic characters
IDK exactly what they mean by "nongraphic" but it seems to mean ones that do not generate a glyph on screen when ls is used without any special options. Apparently that includes space, as you found out. AFAIK C does not have "\ " for space. It does have escapes like "\n" for newline, "\t" for tab and "\h" for backspace so presumably the writers of ls extended the idea with "\ ".
 
  


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
Soft lockup of Kernel on CentOS when tryin to wake_up() akshaynm87 Linux - Kernel 1 07-21-2009 08:59 PM
rm: cannot lstat `/mnt/share1': Input/output error toadeny Linux - Networking 3 06-27-2008 02:40 AM
wine: exists lstat socket : No such file or directory hisnumber666 Linux - Software 1 05-02-2006 02:35 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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:54 AM.

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