Go Job Hunting at the LQ Job Marketplace
Go Back > Blogs > linux-related notes
User Name


Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Rate this Entry

Dealing with file names (oddly) starting with an hyphen

Posted 11-19-2013 at 02:58 PM by the dsc

In a script or routine usage, you may stumble for some reason with a file starting with "-".

"ls *.lol" command in that dir will return error if the next character doesn't happen to be an option of "ls", and/or if it is an option, but the next part isn't coincidentally an "argument", which is probably unlikely.

The same applies for commands such as mv and rm.

but to deal with it you can issue something like

mv --

The "--" tells the command to ignore any further "options".
Posted in Uncategorized
Views 1402 Comments 2
« Prev     Main     Next »
Total Comments 2


  1. Old Comment
    Thanks for this tip!
    Posted 11-19-2013 at 04:54 PM by vmccord vmccord is offline
  2. Old Comment
    Hey, thanks for the tip.

    This works for many (if not all) of the standard GNU file utils such as cp, rm, touch, etc.
    Posted 12-02-2013 at 07:35 AM by goumba goumba is online now


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