Find the answer to your Linux question:
Results 1 to 7 of 7
What is with the hashes and why can't I remove such files even with:$ sudo rm -rf #file.txt# ?...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2012
    Posts
    27

    How do I remove files of format: #file.txt# ?


    What is with the hashes and why can't I remove such files even with:$ sudo rm -rf #file.txt# ?

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,229
    A # starts a comment.
    So your rm actually has no argument.
    Which is very fortunate for you. If you would have given a path to that file, then the whole directory would have been deleted.

    Either escape all #, or quote the path/file or delete via the inode number of the File.
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Jun 2012
    Posts
    27
    Quote Originally Posted by Irithori View Post
    A # starts a comment.
    So your rm actually has no argument.
    Which is very fortunate for you. If you would have given a path to that file, then the whole directory would have been deleted.

    Either escape all #, or quote the path/file or delete via the inode number of the File.
    Thank you for reply.

    Why is there a file enclosed in hashes in a given directory and how do I "escape all #"? Or better yet, right now I have three files in my root directory called: #file1.org#, #file2.org#, and #torg.org#. Simply put, please demonstrate to me in the form of a an example the standard way to delete these files from the directory. Thank you for assistance.

  4. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,229
    bash escapes are done via \
    So e.g.
    Code:
    ls -al \#file1.org\#
    This and also quotes are documented in the "Quoting" section of
    Code:
    man bash
    You must always face the curtain with a bow.

  5. #5
    Just Joined!
    Join Date
    Jun 2012
    Posts
    27
    Quote Originally Posted by Irithori View Post
    bash escapes are done via \
    So e.g.
    Code:
    ls -al \#file1.org\#
    This and also quotes are documented in the "Quoting" section of
    Code:
    man bash
    Yeah I can see already that I am going to have to blackbox Bash as a learning project all on its own. I was not aware that it was an actual programming language until recently. I've been using Linux for about 4 months now because I wanted to learn Ruby on Rails and Django in a Unix-like environment. Incidentally, I just noticed in Tiobe Programming Language Index that Bash has experienced a massive spike in popularity in the last 15 months. I wonder what is behind that.

  6. #6
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,229
    Hmm. No idea.
    Bash is surely helpful to know as a basis and to glue tools together.
    But imho for bigger projects ruby/python/java/scala/etc are preferable.
    You must always face the curtain with a bow.

  7. #7
    Just Joined!
    Join Date
    Jun 2012
    Posts
    27
    Quote Originally Posted by Irithori View Post
    Hmm. No idea.
    Bash is surely helpful to know as a basis and to glue tools together.
    But imho for bigger projects ruby/python/java/scala/etc are preferable.
    Yeah I guess I just meant that rather than plodding along learning common bash usage in an ad-hoc fashion, I am going to have to devote regular times to learn it in a systematic way. Anyway I deleted the # files using ./ before them, e.g.:$ sudo rm ./#test.rb# . Not clear on the exact functionality of ./ but that is why I need to learn Bash in a systematic way. Just the everyday command usage side of it is massive enough so that it seems rather like chaos than a structured system that you actually have to learn in a systematic way before it begins to no longer seem like the whole thing is just duck-taped together. For weeks now the command structure has just seemed like a ridiculous free-for-all of ways of getting things done. I am beginning to see that it is actually not that way. You just have to approach it the way you would approach learning any other complex piece of software. Linux is basically a kind of 2-year curriculum with a hand full of classes that you have enroll in and learn in a systematic way or you are inevitably going to always be doing things ass-backwards. In fact, I have noticed that there is a whole lot of ass-backwardsness going on in the linux community among those who consider themselves veterans. I am beginning to see that there is a right way and a wrong way to learn linux, and I have been pretty much learning it the wrong way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •