Questions tagged [options]
Passing options like -l or --word to commands, or parsing them in scripts.
335
questions
0
votes
1
answer
25
views
Could someone explain when I would use sync -d over sync with no options?
I'm looking at an online man page for the sync command and I can't quite figure out the intended use of the -d or --data option.
Is it faster? Does it have any noticeable effect? Or is it something ...
0
votes
1
answer
29
views
Duplicate boot params after grub2-mkconfig
I removed the flags 'quiet' , 'splash' , and added others in the file /etc/default/grub, applied them: grub2-mkconfig -o . After a reboot, the kernel boot flags began to double. With each 'grub2-...
8
votes
1
answer
651
views
Looking for a more permissive alternative to GNU getopt for wrapper script
I often find myself writing shell functions or shell scripts that are meant to be wrappers around other commands.
It is also frequent that I want such a wrapper to support a few flags/options. The ...
5
votes
1
answer
108
views
How can I force zsh to write automatically complete path to history?
Suppose I did some time ago cd /path/to/foo/bar and then evince file.pdf. Now if I want to open file.pdf again I have also to do both steps again (using history). However I would do it in a single ...
0
votes
4
answers
62
views
listing existing users sorted by date of creation using cut command
ASK: to use cut command to list all users to confirm a successful useradd.
ISSUE: The list was very long and I had to scroll through output to find user.
NEED: Sort by the date the user was created. ...
-1
votes
1
answer
108
views
How to check for passed options using getopts in a POSIX shell? (Report, count, and discard.)
How to check for passed options using getopts (man page) in a POSIX shell? (Report, count, and discard.)
My idea is this: Many of my scripts take no options (not even -h for help, I am transitioning ...
0
votes
0
answers
54
views
DHCP Option not working
I'm using Debian with a DHCP server. I want my SIP Phone to get another VLAN and some more options, so I set the following configuration:
option space OptiIpPhone code width 1 length width 1 hash size ...
-1
votes
1
answer
39
views
Script is not activating the options
I'm making a script to open url by terminal and when typing:
#!/usr/bin/bash
## origin: https://www.vivaolinux.com.br/script/Abrir-arquivos-em-nova-aba-no-Firefox
##
### Se quizer que o novo link ...
1
vote
2
answers
87
views
rm command contradictory options -i and -f
I learned that -i option is interactive mode and -f option is force model in rm command.
When I tried both options
rm -if test.txt
it did not ask me and just deleted it which means -f option overrode ...
0
votes
2
answers
131
views
Error parsing arguments for options in script Unexpected option in Shell Script
I'm trying to parsearg arguments to pass options to the script.
but it is showing the following errors Unexpected option: -u in addition to looping below:
$ gitpratico -u "<usuario_github>&...
1
vote
1
answer
23
views
install --compare is said to, in some cases, not modify the destination at all - but in which cases?
The man page for install describes the --compare option like so:
-C, --compare
compare each pair of source and destination files, and
in some cases, do not modify ...
3
votes
2
answers
1k
views
What precisely does cp -b (--backup) actually do?
Before you hit me with the obvious, I know, the backup option makes a backup of a file.
But the thing is, the cp command in general backs up a file. One could argue a copy of a file is a backup.
So ...
0
votes
3
answers
93
views
Difference between -q and --quiet? [closed]
I was wondering:
What is the difference between -q and --quiet?
And in which case do I use -q and --quiet?
Thank you!
-1
votes
1
answer
48
views
less option --save-marks does nothing
I less vesion
less 590 (GNU regular expressions)
I use
export LESSFILE="/root/.lesshst_for_manpages"; export MANPAGER="pager --save-marks -I"; man -L en <<somemanpage>>;...
0
votes
1
answer
124
views
Add options with default value on shell script
I want to add some options to my custom shell script. I can show it to you since it is not top secret content :-P
In my experience, there are two option types, set and unset options: set options are ...
1
vote
1
answer
1k
views
in bash the option "set -e" causes exit immediately, which is a problem in sourced scripts
When using bash in a terminal often scripts have to be run sourced. In such cases terminating the script must be done by "return", but not by "exit" in order to not kill the basic ...
0
votes
1
answer
320
views
When is mandatory use the "--keep-newer-files" option for the tar command?
About the tar command
Introduction
Having for example:
source
numbers
001.txt # with the 111 content
002.txt # with the 222 content
003.txt # with the 333 content
If is created the numbers.tar....
1
vote
1
answer
2k
views
How to extract the tar.gz file but without overwriting existing files?
With the unzip -n /path/to/filename/filename.zip command the compressed file is uncompressed but does not overwrite existing files. This approach is useful when the same compressed file was ...
0
votes
1
answer
2k
views
curl: (6) Could not resolve host: services.gradle.org
If in Ubuntu Server is executed:
curl https://services.gradle.org/distributions/gradle-7.5.1-bin.zip -O
appears:
% Total % Received % Xferd Average Speed Time Time Time Current
...
0
votes
1
answer
738
views
Llist installed packages with their repository name, version, and architecture using zypper
zypper se -i shows installed packages, but unlike zypper pa the repo, arch, and version information is missing. Is there a command option that shows these bits?
0
votes
1
answer
991
views
tar create: How to avoid to show the "tar: Removing leading `/' from member names" message in the terminal?
About the tar command
If is executed the command:
tar -czf numbers.tar.gz numbers
The numbers.tar.gz file is created - from the numbers - in the current directory
But for script purposes - by testing ...
-1
votes
1
answer
1k
views
Why tar command uses gzip command through 'z' option?
In Linux Ubuntu about the 'tar' command for these versions:
tar -tzf /path/to/filename.tar.gz # Show the content
tar -xzf /path/to/filename.tar.gz # Extract the content
Observe both commands use ...
4
votes
1
answer
2k
views
curl: when use "--no-progress-meter" over "-sS"?
About curl about to hide the Progress Meter I found many answers through Stack Exchange branches doing mention of -s and -S or simply -sS where
-s hides the progress meter
-S only shows error ...
4
votes
1
answer
4k
views
curl: download file with the same name with "-O" but defining a specific path directory
With curl is possible do
curl http://somedomain.com/originalfilename.tar.gz -o newfilename.tar.gz
curl http://somedomain.com/originalfilename.tar.gz -o /other/path/newfilename.tar.gz
Therefore with -...
0
votes
2
answers
114
views
Effect of slash (/) suffixes on symlink names for `ls` with the `-F` option
By way of example, I have a directory structure like this:
$ \ls -F
dir/ lnk@
$ \ls -F dir
FILE
$ \ls -l lnk
lrwxrwxrwx 1 user group d Mon hh:mm lnk -> dir
My ls command is aliased. I am using \...
0
votes
1
answer
179
views
Remove options from command
My inputs are commands followed by an unrestricted number of single-letter options, e.g. command -abc. Neither the command nor the options take any arguments. My goal is to remove certain options.
...
0
votes
1
answer
260
views
How does "-" work in the "ssh-keygen -lf -" command?
I read this question
Get SSH server key fingerprint
In the answer and solution appears the following command (adapted here for presentation purposes)
ssh-keyscan 192.168.1.X | ssh-keygen -lf -
I ...
0
votes
1
answer
288
views
getopt and case function not executing
I encountered such a problem when passing a parameter to a script, the function corresponding to the case menu is not executed. The script accepts parameters as input and performs the appropriate ...
1
vote
0
answers
263
views
/etc/fstab mount option restrictions - How to get full options list applied?
This question is a related but tangent question on problem described in this posting .
While trying to finalize the options during the previous post, I always left the root partition alone, untouched, ...
0
votes
1
answer
229
views
EXT4 on USB - how to specify journalling behaviour to be same as for root disk partitions
Please consider the prior discussion as background to this new question.
I have modified my script and applied the same filesystem options to my USB drive's ext4 partitions using tune2fs, and mount ...
5
votes
1
answer
425
views
OS seems to apply ext4 filesystem options in arbitrary fashion
I fear I may have to revert to system defaults if I can't get this sorted out.
I'm trying to set various system configurations for more robust ext4 for a single-user desktop environment. Trying to ...
3
votes
3
answers
1k
views
Replacing command line arguments while preserving spaces
I would like to selectively replace a command-line argument that is being passed to automatically format it for the downstream command being executed. The argument will have spaces and that is the ...
12
votes
2
answers
1k
views
Why does sort have an --output= option?
sort -o seems superfluous. What is the point of using it when we can use sort >?
Is it sometimes impossible to use shell redirection?
2
votes
2
answers
77
views
Why is `-W` reserved for vendor extensions?
Why does the POSIX standard reserve the -W option for vendor extensions of the system utilities? I do not understand why the letter ‘W’ is used. ‘V’ (for vendor) could make more sense.
Maybe this ...
0
votes
1
answer
54
views
What does '-' mean in a Shell script?
I'm trying to understand a script I have and it has a line that says
cut -d '-' -f 1
I don't understand what '-' does here
-4
votes
1
answer
194
views
ps command: how does the '-q' option work?
According with the ps command, for the -q option
Through the man is indicated:
-q pidlist
Select by PID (quick mode). This selects the processes whose process ID numbers appear
in ...
0
votes
1
answer
297
views
ps command: how show the complete command with options, pipes and redirection? (or all together)
About the ps command, consider if for simplicity:
in tty3 is executed the yes command
in tty4 is executed the yes > /dev/null command
through ps I need to show in the report the complete command ...
-1
votes
1
answer
439
views
ps command: how does the 'r' option work? How should be used?
About the ps command for the r option
According with man ps it indicates
r Restrict the selection to only running processes.
And according with ps --help a it indicates
r only ...
0
votes
1
answer
72
views
less command: b/f vs w/s
About the less and according with:
Less command
Linux / Unix Colored Man Pages With less Command
indicates the following:
f ^F ^V SPACE * Forward one window (or N lines).
b ^B ESC-v * Backward ...
5
votes
2
answers
575
views
less command g vs p option
In less for navigation purposes according with this tutorial
Less Command in Linux
indicates:
g Go to the first line in the file.
p Go to the beginning of the file.
I tested both, and of course ...
7
votes
1
answer
777
views
What is correct or suggested approach to send the signal name through 'kill' command?
I read many tutorials about the use of kill command, mostly 3 approaches
kill -15 <pid>
kill -SIGTERM <pid>
kill -TERM <pid>
For scripts purposes and for portability with macos too, ...
4
votes
3
answers
1k
views
Why are the signal lists for kill, killall and pkill not the same?
I researched the kill, pkill and killall commands, and I understood most of their differences. However, I am confused about their signals:
If I run kill -l, I see:
1) SIGHUP 2) SIGINT 3) ...
0
votes
0
answers
33
views
ps command: Practical difference between the -p and -q options [duplicate]
According with man ps exists:
-p pidlist
Select by PID.
This selects the processes whose process ID numbers appear in pidlist.
Identical to p and --pid.
-q pidlist
Select by PID ...
1
vote
1
answer
42
views
ps command: strange behavior with 'O' option, extra column/header does not appear as expected
About the ps command - to add one/many extra column/header with the default headers according with the option(s) used with the ps command - it through O the option.
Intro
If ps x is executed the ...
4
votes
1
answer
2k
views
ps command: how to know all the headers with their respective descriptions?
Through the following valuable tutorial:
Ps Command in Linux (List Processes)
If the ps -ef command is executed then the output has the following header:
UID PID PPID C STIME TTY ...
0
votes
0
answers
358
views
What does '-x' mean in the context of the 'ps' command?
If is executed ps x (observe there is no -) then the output is as follows:
PID TTY STAT TIME COMMAND
2489 ? Ss 0:00 /lib/systemd/systemd --user
2490 ? S 0:00 (sd-pam)
...
0
votes
1
answer
321
views
ps command: How generate the report of processes but according with only either tty or pts?
Through the ps --help all command about the option(s) related with tty exists the following:
-a all with tty, except session leaders
a all with tty, including ...
4
votes
2
answers
331
views
What does '-P' mean in the context of the 'ps' command?
If is executed ps -p 3384 3395 (observe -p is lowercase) then the output is as follows:
PID TTY STAT TIME COMMAND
3384 tty6 S+ 0:00 man ls
3395 tty6 S+ 0:00 pager
Until ...
1
vote
1
answer
4k
views
What does the "+x" option in "bash +x script.sh" mean?
I know what bash -x does, but what does bash +x do?
Googling found no results and the manual also says nothing about it.
0
votes
1
answer
80
views
Why does the option --add_extra_groups in adduser contain underscore rather than hyphen word delimiters?
Premise
Most of the long-form options in the various *nix tools use hyphens as word separators.
Examples
from man tr:
--squeeze-repeats
--truncate-set1
from man sudo:
--preserve-env
--set-home
--...