Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 07-17-2010, 06:09 AM   #1
Registered: Feb 2007
Distribution: Ubuntu 10.04
Posts: 281

Rep: Reputation: 31
bash command has invalid option


I'm trying to run a command from an ubuntu howto page, but there's something wrong with it that i dont understand?

Can you point it out please?


root@nnjond-desktop:/# tar -cvpzf backup.tar.gz -–exclude=/backup.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/media --exclude=/dev /
tar: invalid option --
Try `tar --help' or `tar --usage' for more information.
Old 07-17-2010, 04:44 PM   #2
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 731

Rep: Reputation: 75

Looking at it with plain cat:
% cat t1
but with option -A:
% cat -A t1
so you have a non-standard dash. Replace that and you should be able to get past this problem ... cheers, makyo
Old 07-17-2010, 04:56 PM   #3
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
I don't understand.
Old 07-18-2010, 11:31 AM   #4
LQ Newbie
Registered: May 2008
Posts: 2

Rep: Reputation: 0
Originally Posted by MTK358 View Post
I don't understand.
It appears you have some non-printing characters in your script, such as the control-S.

You thought you only typed "-–exclude=/backup.tar.gz" What you actually typed, as shown by the "cat -A (show all)" command is "-^Sexclude=/backup.tar.gz$" where that "^S" is the printed representation of a control-S. Once the line parser hit that, all it sees is the double-dash, which is an invalid option, and not the double-dash-exclude.

That's an easy enough mistake to make; I know I accidentally put non-printing characters in with annoying regularity.


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
ls *txt* returns invalid option --e Eh ??? MrMark Linux - Newbie 8 12-21-2016 11:20 AM
[SOLVED] vgdisplay -v -D results in invalid option -D in rhel 5.5(tikanga) hartajdugal Linux - Newbie 6 07-16-2010 11:57 AM
dkmraid -i invalid option sang_froid Linux - General 0 10-16-2006 09:50 AM
cp indicates invalid option Murdock1979 Linux - Software 1 01-24-2006 03:21 AM
in.telnetd: invalid option -- L implant23 Linux - Networking 1 12-01-2002 12:17 PM > Forums > Linux Forums > Linux - Newbie

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