Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-14-2008, 09:01 AM   #1
LQ Newbie
Registered: Feb 2008
Posts: 2

Rep: Reputation: 0
filename ends in '\' won't open in emacs or with cat command - why?

I'm not sure why this is happening, but....
I write a small file to output using python - say "this.txt".
If I run ls, or ls -l, it shows up in the listing as this.txt
If i run *.txt it doesn't show up (i'm guessing due to the \ at the end of filename)

I try to cat or open in emacs - nothing happens.

I open it in kedit or kwrite (or gedit, etc...) it opens and I can see the data.

File permissions seem in order rw-r--r-- (i'm the owner so this is ok)

if i use tab to autocmplete, the filename shows up with the '\' at the end of the filename - like this:

$> cat this.txt\ (from typing in 'thi' and hitting tab )

This is how I found it, the '\' is invisible using ls.

Any advice would be appreciated.
Old 02-14-2008, 09:42 AM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
The \ character is used when there is a space in a filename. The space would cause the shell to read the filename as more than one input to the command. The \ is called the escape character.

example: this file.txt
when you try to 'ls this file.txt', ls will see is as two files; one called this, and one called file.txt.
so will other command-line applications. when you get to the \, the shell is waiting for the rest of the filename. Try putting a double \ at the end of the filename.
Old 02-14-2008, 10:11 AM   #3
LQ Newbie
Registered: Feb 2008
Posts: 2

Original Poster
Rep: Reputation: 0
problem solved ( I am a dummy - sometimes)

It was an extra space that was appended to the file name when it was being written. When I looked at the code with fresh eyes this morning It was glaringly obvious. Thank you for the quick response - If I hadn't figured it out, this would have definitely pushed me in the right direction.

Last edited by tardo0807; 02-14-2008 at 10:12 AM.


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
showing emacs filename/buffer in kde panel? lublum1 Linux - General 6 09-21-2008 04:26 AM
Emacs - insert filename at save jantman Linux - Software 1 01-16-2007 01:35 PM
bash: how to edit cat <filename> | grep <keyword> feature? sirpelidor Linux - Software 2 06-20-2005 02:00 PM
emacs #filename# file question Guvvy Linux - Newbie 3 01-31-2005 06:26 PM
i got CAT-5 network cable.. and a crimper toolkit.. and plastic ends... now what ? qwijibow Linux - Networking 5 07-21-2004 09:10 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:39 PM.

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