LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   The difference a minus sign makes (https://www.linuxquestions.org/questions/linux-newbie-8/the-difference-a-minus-sign-makes-4175494381/)

phillyfilly 02-09-2014 09:26 PM

The difference a minus sign makes
 
What is the difference between these two lines? What does the minus sign at the end do, or don't do? I am running Fedora 20 -64 bit - on VMware Workstation 10. Thank you very much.

df -h
df -h -

php -v
php -v - what does v mean?

rpm -qa
rpm -qa - what does -q-a mean?

mySQL -v
mySQL -v - same question

mySQL -V
mySQL -V - same question

m.a.l.'s pa 02-09-2014 09:39 PM

Code:

$ df -h -
df: ‘-’: No such file or directory


astrogeek 02-09-2014 09:42 PM

It has no general or special meaning, it is just another shell argument.

What it does depends on the program or command being invoked.

Some, such as su define the trailing dash to have a particular meaning.

Others do not, and simply ignore it, such as your php and mysql examples.

If you type the df -h - example you will see that it is rejected as an invalid path spec.

m.a.l.'s pa 02-09-2014 09:50 PM

Quote:

Originally Posted by phillyfilly (Post 5114692)
php -v
php -v - what does v mean?

As copied right from man php:

Code:

-v

Version number


phillyfilly 02-09-2014 10:38 PM

Thank you. There are lots of v's. I thought it meant verbose, but that made no sense.

chrism01 02-10-2014 01:44 AM

It varies for every cmd; just read the man page, either on your system 'man <cmd>' or here http://linux.die.net/man/

pan64 02-10-2014 02:33 AM

there are some common flags, like -v means -verbose or -version, -l means long format, -h help, but you always need to check the manual page, because they may have different meaning.
The - (minus) sign usually means the actual process will use stdin as input instead of a file. Is accepted only where it has any meaning (df need no input file).
see for example man grep:
Quote:

Description

grep searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus (-) is given as file name) for lines containing a match to the given PATTERN. ...

yooden 02-10-2014 05:35 AM

Quote:

Originally Posted by pan64 (Post 5114797)
The - (minus) sign usually means the actual process will use stdin as input instead of a file. Is accepted only where it has any meaning (df need no input file).

Not really, see bash(1), su(1).

Your first advice fits: Check the manpage.


All times are GMT -5. The time now is 04:29 AM.