Some useful command on Linux/Unix

Today, I receive some request from our mate.

He wants to rename a file which begin a "-" character. haha. Searching on Google and I found this solution.
Thanks guys !

Rename file starting with a dash(-)

If having problem renaming a file that starts with a dash:

Since the file name begins with a ‘-‘ it looks like an option to the
command. You need to force it to not look like an option. Put a ./
in the front of it. Or give it the full file name path. Or tell the
command you are through with options by using the double dash to end
all option processing. This is common to most traditional UNIX
commands.

cp ./* /some/folder
cp — * /some/folder

And the same for other utilities too.

mv ./-stuff differentstuff
mv — -stuff differentstuff

theo : http://linux-journal.blogspot.com/2005/04/rename-file-starting-with-dash.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s