The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
20 views

How do I specify command invocation for a mandatory short or long option?

I'm writing a specification for a tool that needs a -f / --foo option with a mandatory argument BAR, so for example these are valid calls: tool -f BAR tool --foo BAR How do I specify this syntax in ...
12
votes
2answers
199 views

Security implications of running perl -ne '…' *

Apparently, running: perl -n -e 'some perl code' * Or find . ... -exec perl -n -e '...' {} + (same with -p instead of -n) Or perl -e 'some code using <>' * often found in one-liners ...
2
votes
2answers
142 views

Negative arguments to head / tail

Variants of this question have certainly been asked several times in different places, but I am trying to remove the last M lines from a file without luck. The second most voted answer in this ...
0
votes
2answers
25 views

why some programs needs -h and other no

I know that is not a exciting question, but yet I don't understand why some programs needs program -h and other program --help sometimes is very boring recognize it
2
votes
2answers
33 views

Is there a `--paranoid` type flag for common, potentially irreversible commands?

I'm not aware of any standard flag that is implemented. There are some git commands that let you specify a -n parameter that will show you what the command is going to do, but doesn't actually do it. ...
2
votes
1answer
27 views

Strange leading whitespace in OPTARG when using getopts

I spent quite a while researching the problem I encountered but none of the getopts tutorial say anything about the leading whitespace in OPTARG when using getopts. In bash(on Ubuntu and OSX), ...
5
votes
1answer
115 views

Provide two arguments to one option using getopts

In below code when I give option r then getopts requires one arguments: while getopts ":hr::l:" opt; do case $opt in r ) echo "Run Numbers - argument = $OPTARG " ;; l ) echo ...
2
votes
2answers
69 views

Optional arguments after or before the mandatory arguments?

I'm creating a shell script and I need it to take two mandatory arguments and one optional. How do I check that? In most scripts I've seen, the optional arguments are passed before the mandatory ones, ...
0
votes
0answers
6 views

rpm :deptype flags explained

On Fedora 20 (Heisenbug) I issed the following command … rpm --query --queryformat="%{REQUIREFLAGS:deptype}\n" --all | sort --unique --dictionary-order … to get all possible :deptype ...
0
votes
1answer
38 views

Options to a command specified in a file

How can I have some of the options to a unix command come from a file? That is the file does not contain all the options -- other options are specified elsewhere. For example I have the ...
2
votes
1answer
29 views

FAT Mountoption allow_utime explained

I trying to figure out what the following Mountoption for (v)FAT exactly does (in Linux): allow_utime=### -- This option controls the permission check of mtime/atime. 20 - If ...
3
votes
4answers
233 views

Test if command accepts a specific option

What is the preferred way to test if a command takes an option? What are the caveats? As a motivating example, at login my shell aliases grep to add several --exclude-dir options but this option is ...
1
vote
1answer
38 views

How to know DHCP options value on debian/ubuntu and other linux

How to know all DHCP options and values (on the client side, Linux Ubuntu / Debian / ArchLinux ) provided by the server. I need to pass non-standard option to the client by the DHCP option code ...
1
vote
1answer
37 views

in which units does tar --checkpoint measure?

GNU tar offers the option --checkpoint where a message should be printed each checkpointreached. Question:: In what does --checkpoint measure? My best guess is Bytes. I wasn't able to find a hint ...
2
votes
1answer
28 views

Understanding passwd --keep-tokens

On GNU/Linux, I do have trouble understanding the meaning of the --keep-tokens option for passwd. As it doesn't seem to be much used as I am not able to find any examples and only online copies of man ...
12
votes
4answers
689 views

Why does ls accept duplicate switches?

I'm curious - is there a difference between ls -l and ls -lllllllllllllllllllllllllllll? The output appears to be the same and I'm confused on why ls allows duplicate switches. Is this a standard ...
5
votes
2answers
283 views

How do you get fgrep to find the literal “--help”?

fgrep --help | fgrep "--help" returns just the whole fgrep --help, how do I return just the lines that have the literal "--help" in them? The quotes don't do anything, nor does \-\-help.
2
votes
1answer
48 views

What is a command that will only show me the command syntax and options?

Is there a command which will just list all the options for a given command on one or two lines and not as long and words as man or info ?
3
votes
3answers
174 views

Interactive command usage reference: do you generally have that on Unix?

The question of why some commands rely on manpages whereas others rely on something like the --help flag for providing command usage reference is not new. There is usually a difference in scope ...
8
votes
1answer
342 views

How to append multiple lines to a file with bash, with “--” in front of string

Question very similar to How to append multiple lines to a file with bash but I want to start the file with --, and also append to the file, if possible. printf ...
34
votes
7answers
3k views

Is `-` used only with cd?

cd - can switch between current dir and previous dir. It seems that I have seen - used as arguments to other commands before, though I don't remember if - means the same as with cd. I found that - ...
5
votes
2answers
51 views

Is it possible for bash completion to cycle through the alternatives?

When using bash completion and an a number of characters have been entered, tabbing ceases to work then the prefix you have typed is matched by more than one of the possibilities. Is there a way to ...
1
vote
2answers
29 views

Shell is option given

I have a couple of arguments inside a list (array, e.g. $@) and I'd like to know if the option -v is in the list. In Python I would simply do: verbose = "-v" in sys.argv How do I achieve that in ...
1
vote
1answer
221 views

Debian + Linux kernel 3.12.22: “Kernel module loader” option is not available

The Debian guide for compiling a kernel says: Do not forget to select “Kernel module loader” in “Loadable module support” (it is not selected by default). If not included, your Debian installation ...
1
vote
1answer
18 views

Can't search for flags in qalter's man page?

I was trying to find out what qalter's -r flag does, but I can't search for -r when viewing the man page for it (pattern not found). Yet it's clearly there. If you scroll down a bit you'll see it. Why ...
4
votes
1answer
55 views

POSIX usage standards for requiring at least one optional arg

So, I'm writing a CLI for an API, and I ran into a point where one of the commands support has two optional arguments, id and fields I want to know how to show that these arguments are optional, BUT, ...
0
votes
1answer
56 views

Is there a command which displays options like `errexit` and `braceexpand` other than `help set`?

If you type help set, then - among other things - a list of shell options is displayed. But these options are not the same as those displayed with shopt. And different also from those displayed with ...
2
votes
1answer
19 views

Correct way to document variable length options in man pages

Sometimes I see usage information like some_utility [arg [arg [...]]] or some_utility [arg[, arg[...]]] that indicates that you can pass more than one of the same argument. I've also seen it ...
2
votes
2answers
228 views

Arguments, options and dashes

Why do console applications get the arguments started with either: a) one dash (myapp -arg1 123; ls -al) b) two dashes (myapp --arg1 123; git push origin master --force) c) without dashes at all ...
3
votes
2answers
516 views

Passing arguments to su-provided shell

man su says: You can use the -- argument to separate su options from the arguments supplied to the shell. man bash says: -- A -- signals the end of options and disables further option ...
2
votes
4answers
2k views

Parsing process command-line arguments from pargs in a shell script

I get list of PIDs in my bash scripts (Java processes) and have to analyze their command-line arguments to determine which instance of server each PID corresponds to. At the moment I do it that way ...
1
vote
1answer
389 views

bash control statment for when an option flag is used

I trying to make control statement to check on a option flag is used or not? For -o output.file if is used I would like to make equal to variable OUTPUTSUM = OUTPUTFILE and if there no -o option use ...
3
votes
2answers
376 views

Privileged mode in bash

I've used bash for years but I 've stuck with the"privileged mode" that it can be configure with the set command. For example: set -p I've read the bash man page but it's somewhat obscure. For ...
2
votes
2answers
87 views

Parsing of command line options

For I school project, I have to implement a shell/terminal app. But I am wondering how are command line options parsed, because it appears abit weird to be. For example for the command paste (and I ...
1
vote
1answer
126 views

Is there a simple way to get array of all arguments that do not begin with a hyphen?

zsh includes a powerful utility for parsing command-line options zparseopts, but for quick shell scripts and shell functions, but is there an easy way to extract the array of all command-line ...
3
votes
1answer
46 views

“mke2fs -r fs-revision-level” - how is this used?

mke2fs -r offers Set the filesystem revision for the new filesystem. Note that 1.2 kernels only support revision 0 filesystems. The default is to create revision 1 filesystems. Trying to ...
1
vote
2answers
792 views

fdisk (expert mode) options

On GNU/Linux with fdisk (util-linux 2.20.1), when using, say fdisk /dev/sda3 there are quite some options and the and even an "expert mode" (x). Most of these are explained through the m option. But ...
0
votes
1answer
35 views

w command: same output with(out) -u option?

According to the manpage for w: -u   Ignores the username while figuring out the current process and cpu times. To demonstrate this, do a "su" and do a "w" and a "w -u". I've tried this ...
2
votes
1answer
355 views

Automatically start an application with a modifed LD_PRELOAD?

I have an application that needs a modified LD_PRELOAD. I want to start the application using the originally provided rc script, so I can benefit from an automatically updated rc script on an update ...
5
votes
1answer
60 views

how to input this command line

hume@linux-o1dm:~> gnomesu -u legum java -jar '/home/legum/frem/frem.jar' Unknown option -jar I want -u for gnomesu and -jar for java, but the openSUSE treat -u -jar only for gnomesu. What is ...
2
votes
2answers
532 views

Passing options to subcommands in bash

I'm scripting a sequence of commands I used to enter by hand. The rough outline goes something like this $ echo ${FILENAME_ARGS} | some | big | pipeline | sort -options | etc >temp $ gs ...
2
votes
1answer
134 views

diff --git unknown option

when I try to run diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c I get unknown option (I have installed git via apt-get install git)
3
votes
1answer
97 views

What is “userdel --root?” supposed to do

On a GNU/Linux system, I found the following, (for me very confusing seeming entry) about an option for userdel in the German version of its man page: I'm truly sorry, but I can't really provide ...
0
votes
1answer
119 views

How to make options mandatory in KSH script

Here is the skeleton to catch arguments in my script : # fMain(){ while getopts "d:e:h" _OPTION; do case $_OPTION in d) ...
3
votes
3answers
496 views

What is a “non-option argument”?

I am trying to understand info who but completly fail at the term »non-option argument«. Can someone please explain this term to me in simple words or an example? UPDATE: from ' info who' ...
3
votes
2answers
917 views

cp -L vs. cp -H

Problem When copying files with cp -H or cp -L, I get the same results: $ ls -l fileA fileA -> fileB $ cp fileA somewhere/ -H $ ls -l somewhere/ fileA # fileA is a copy of fileB, only ...
4
votes
3answers
3k views

convert soft- to hardlinks with cp

The cp command's infopage offers on the option --preserve= the following: links Preserve in the destination files any links between corresponding source files. Note that with -L' ...
1
vote
2answers
2k views

The -cp option to the java command [closed]

java -cp FILE.jar FILE.Main inputfile What does the -cp option mean? For that matter, what a negative sign in front mean? I've searched everywhere and couldn't find the answer.
2
votes
3answers
761 views

Restrict standard users to run a command with a specific argument

I know how to restrict standard users to run a command by removing execute permissions for that command. But it's possible restrict standard users to run a command with a specific option/argument? ...
5
votes
3answers
242 views

What's the real point of the -f option on rm?

By reading the GNU coreutils man page for rm, one of the options is -f, which according to the manual, -f, --force ignore nonexistent files and arguments, never prompt Now, I made some ...