LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-07-2014, 07:11 AM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
A file name beginning with '\'.


Hi: I do not know how to erase this file (the one whose name is \rendobj\r2255):
Code:
semoi@server:~/STORE1/Nonsoft/libros/chess/nuevo$ ls -l
total 118708
-rw-r--r-- 1 semoi semoi        0 2014-03-04 20:02 \rendobj\r2255
-rwxr-xr-x 1 semoi semoi 12706934 2014-03-04 19:13 1_Bishop_&_Knight.djvu*
-rwxr-xr-x 1 semoi semoi 11554110 2014-03-04 19:13 1_Bishop_&_Knight_Endings.pdf*
-rwxr-xr-x 1 semoi semoi 34122573 2014-03-04 19:13 2_Bishop_vs_Knight,_Rook_vs_Minor_Pieces.pdf*
-rwxr-xr-x 1 semoi semoi 12441969 2014-03-04 19:13 3_Queen_Endings.djvu*
-rw-r--r-- 1 semoi semoi     2840 2014-03-07 08:52 3_Queen_Endings.txt
-rw-r--r-- 1 semoi semoi     2784 2014-03-07 07:00 3_Queen_Endings.txt~
-rwxr-xr-x 1 semoi semoi 14801249 2014-03-04 19:13 4_Pawn_Endings.djvu*
-rwxr-xr-x 1 semoi semoi 17780243 2014-03-04 19:13 4_Pawn_Endings.pdf*
-rwxr-xr-x 1 semoi semoi 17951098 2014-03-04 19:13 5_Rook_Endings.pdf*
-rwxr-xr-x 1 semoi semoi      869 2014-03-07 09:29 ren.sh*
-rwxr-xr-x 1 semoi semoi      960 2014-03-07 09:27 ren.sh~*
-rwxr-xr-x 1 semoi semoi     1050 2014-03-07 09:22 ren2.sh*
-rwxr-xr-x 1 semoi semoi     1051 2014-03-07 08:50 ren2.sh~*
semoi@server:~/STORE1/Nonsoft/libros/chess/nuevo$
Any idea how it can be deleted? Quoting the filename gives 'No such file or directory'.
 
Old 03-07-2014, 07:17 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Have you tried this?
Code:
rm \\rendobj\\r2255
In most cases the TAB completion should give the proper way to escape the special characters. You have just to manually escape the first one in the file name, e.g.
Code:
rm \\press_TAB_here
 
Old 03-07-2014, 07:23 AM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
'\\press_tab_here' does not complete. And
Code:
semoi@server:~/STORE1/Nonsoft/libros/chess/nuevo$ rm \\rendobj\\r2255
rm: cannot remove '\\rendobj\\r2255': No such file or directory
semoi@server:~/STORE1/Nonsoft/libros/chess/nuevo$
Remarkable, isn't it? I went to the GUI and used the file manager. However there should be a way of deleting it other than using the GUI!

Last edited by stf92; 03-07-2014 at 07:26 AM.
 
Old 03-07-2014, 07:26 AM   #4
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Rep: Reputation: 195Reputation: 195
You can try zsh auto-completion
 
Old 03-07-2014, 07:26 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
you can also try to use wildcards:
Code:
test:
ls *rendobj*r2255
but probably
ls *2255 is enough
if it returns only your file you can try to remove it by:
rm *rendobj*r2255
 
Old 03-07-2014, 07:34 AM   #6
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
A pitty, I now don't remember if I tried with the asterisks. The file is now erased for good.
 
Old 03-07-2014, 07:38 AM   #7
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Rep: Reputation: 195Reputation: 195
And what about me? Suggesting using a cannon :P
At least zsh comes by default on slackware
 
Old 03-07-2014, 08:03 AM   #8
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
i think rm ./'\rendobj\r2255' would do it.
 
Old 03-07-2014, 12:30 PM   #9
genss
Member
 
Registered: Nov 2013
Posts: 741

Rep: Reputation: Disabled
what shell are you using ?
also what terminal ?

\\TAB should work
this puzzles me
 
Old 03-07-2014, 12:54 PM   #10
Smokey_justme
Member
 
Registered: Oct 2009
Distribution: Slackware
Posts: 534

Rep: Reputation: 203Reputation: 203Reputation: 203
Hehe..

ls formats the output.. The file begins with the \r (Carriage return), not with '\' That is why TAB completition or quoting didn't work
 
Old 03-07-2014, 01:03 PM   #11
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Quote:
Originally Posted by Smokey_justme View Post
Hehe..

ls formats the output.. The file begins with the \r (Carriage return), not with '\'
How do you know?
 
Old 03-07-2014, 01:16 PM   #12
Smokey_justme
Member
 
Registered: Oct 2009
Distribution: Slackware
Posts: 534

Rep: Reputation: 203Reputation: 203Reputation: 203
It's a console protection... \r would cause the console to move the cursor to the begining of the line (and write characters from there on).. Moreover, it's invisible otherwise.. And, as a distinction, a \ character in the filename is displayed like \\

Try it:
Code:
touch "\testfile_starting_with_the_\_character"
ls
rm "\testfile_starting_with_the_\_character"
touch $'\r'
ls
rm $'\r'

Last edited by Smokey_justme; 03-07-2014 at 01:18 PM.
 
2 members found this post helpful.
Old 03-07-2014, 04:59 PM   #13
FeyFre
Member
 
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 351

Rep: Reputation: 30
Better say other: where do you got files with embedded \r in name?
 
Old 03-07-2014, 05:20 PM   #14
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,500

Rep: Reputation: 8453Reputation: 8453Reputation: 8453Reputation: 8453Reputation: 8453Reputation: 8453Reputation: 8453Reputation: 8453Reputation: 8453Reputation: 8453Reputation: 8453
mc has also been known to easily delete strangely named files.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Truncate from beginning of the file lvprabhu Programming 12 05-25-2010 09:43 PM
Deleting a file beginning with '?' seanybaby Linux - General 23 01-27-2010 09:57 PM
How do I write to the beginning of a file? abefroman Programming 1 06-30-2005 11:56 AM
How to delete a file beginning with '-'? zoomzoom Linux - General 2 02-02-2004 10:01 AM
read from file from the beginning? raven Programming 3 12-05-2003 08:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:55 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