The tag has no wiki summary.

learn more… | top users | synonyms

37
votes
7answers
6k views

How do I delete a file whose name begins with “-” (hyphen a.k.a. dash or minus)?

How do you remove a file whose filename begins with a dash (hyphen or minus) -? I'm ssh'd into a remote OSX server and I have this file in my directory: tohru:~ $ ls -l total 8 -rw-r--r-- 1 me ...
27
votes
7answers
3k views

why does ls -d also list files, and where is it documented?

when specifying ls --directory a* it should list only directories starting with a* BUT it lists files AND directories starting with a Questions: where might I find some documentation on this, ...
20
votes
2answers
583 views

What is `--` called?

Recently I got to know of -- that is double-hyphen which is used to tell a command that the option list has ended and what follows should not be considered as a option. So, grep -- 'search_word' * ...
16
votes
2answers
9k views

tar cvf or tar -cvf ?

I have learned to use tar without '-' for options, like tar cvfz dir.tar.gz Directory/ but I recently came accross the slightly different tar -czvf syntax (I think the 'f' must be the last option in ...
15
votes
4answers
2k views

Single dashes `-` for single-character options, but double dashes `--` for words?

Where did the convention of using single dashes for letters and doubles dashes for words come from and why is continued to be used? For example if I type in ls --help, you see: -a, --all ...
10
votes
5answers
5k views

Compiling GNU/Linux with -O3 optimization

It's said that compiling GNU tools and Linux kernel with -O3 gcc optimization option will produce weird and funky bugs. Is it true? Has anyone tried it or is it just a hoax?
9
votes
3answers
2k views

Is there a 'rc' configuration file for grep/egrep? (~/.egreprc?)

I usually do some grep when developing, and there are some extensions that I always don't want to look for (like *.pyc). Is it possible to create a ~/.egreprc or something like that, and put some ...
8
votes
4answers
4k views

How do I handle switches in a shell script?

Are there some built-in tools that will recognize -x and --xxxx as switches, and not arguments, or do you have to go through all the input variables, test for dashes, and then parse the arguments ...
7
votes
3answers
3k views

getopt, getopts or manual parsing - what to use when I want to support both short and long options?

Currently I'm writing a Bash script which has the following requirements: it should run on a wide variety of Unix/Linux platforms it should support both short and (GNU) long options I know that ...
6
votes
3answers
436 views

What's the purpose of `rm -P`?

I was reading the man page for rm when I came across this option: -P Overwrite regular files before deleting them. Files are overwritten three times, first with the byte pattern 0xff, then ...
6
votes
1answer
2k views

How can I execute local script on remote machine and include arguments?

I have written a script that runs fine when executed locally: ./sysMole -time Aug 18 18 The arguments "-time", "Aug", "18", and "18" are successfully passed on to the script. Now, this script is ...
5
votes
4answers
467 views

How can I create a empty file whose name begins with a dash? [duplicate]

How can we create a empty file with the unix name -stuff. It means the name start with -. I tried with touch -stuff but it didn't work.
5
votes
3answers
144 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 ...
5
votes
1answer
579 views

In the usage string of my custom shell script, shall I also display --help and --version?

I'm currently developing a shell script, called up, which shows a usage string on the commandline when called with --help. The output looks like this: $ up --help usage: up [-n ...
5
votes
2answers
74 views

Handling an option-like filename in the shell [duplicate]

Possible Duplicate: How do I delete a file whose name begins with "--"? Due to mismatched switches when I was trying to run a command, I have a log file named -w in a directory. I ...
5
votes
1answer
184 views

Handling filenames that contains a hyphen, within a script

I have few files that was incorrectly encoded, during extraction, file names now become something similar to -a -b, Now I'm trying to fix this issue with: convmv -f ENCODING -t utf8 --notest * But ...
5
votes
1answer
53 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 ...
4
votes
3answers
1k views

Remove many many many files from a folder

I have a folder with 137795 files in it. I need to delete all of them. When I run rm * I get -bash: /bin/rm: Argument list too long. How do I get past this error?
4
votes
2answers
4k views

How can I detect that no options were passed with getopts?

I have this code - #getoptDemo.sh usage() { echo "usage: <command> options:<w|l|h>" } while getopts wlh: option do case $option in (w) name='1';; ...
4
votes
3answers
229 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' ...
4
votes
2answers
2k views

what is commit=0 for ext4? does mdadm not support it?

I see this in my dmesg log EXT4-fs (md1): re-mounted. Opts: commit=0 EXT4-fs (md2): re-mounted. Opts: commit=0 EXT4-fs (md3): re-mounted. Opts: commit=0 I think that means that dealloc is disabled? ...
4
votes
1answer
121 views

If I'm logged in as root, how do I restart mysql or apache with options?

I know the commands to restart/stop/start, but when I try to pass options it doesn't seem to work! CENTOS 6, MySQL 5.14 service mysql restart service httpd restart Then I tried this: ...
4
votes
1answer
1k views

What does Linux's “nointremap” option do?

Ubuntu 12.10 alpha 2 works perfectly on my new 11" 2012 Macbook Air, but only when I boot with the "nointremap" option. Supposedly this is not good to use as a permanent solution. What exactly does ...
3
votes
2answers
2k views

Download list of files if they don't already exist

If I have a list of URLs separated by \n, are there any options I can pass to wget to download all the URLs and save them to the current directory, but only if the files don't already exist?
3
votes
3answers
185 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
451 views

Is it possible to disable verbose in the middle of running?

I am running a program fls (from the Sleuth Kit) with option -v for verbose mode. However it takes too long, and the program is still running since yesterday. I guess it will run faster without ...
3
votes
2answers
3k views

How to catch optioned and non optioned arguments correctly?

I want to write a shell script which will take some arguments with some options and print that arguments. Suppose the name of that script is abc.ksh. Usage of that script is - ./abc.ksh -[a ...
3
votes
1answer
80 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 ...
3
votes
1answer
156 views

Understanding grep --label=

I am looking for an explanation how grep --label=LABEL works: Maybe somebody can give me an example [or two] on what --label= is for. I understand what grep and zgrep are supposed to do – the ...
3
votes
1answer
2k views

xmessage over ssh

The following command prints a message over ssh : xmessage Message -display :0 & How does it work? there is no -display option in xmessage's man page.
3
votes
2answers
81 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 ...
3
votes
2answers
129 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 ...
3
votes
2answers
457 views

Getopts option processing, Is it possible to add a non hyphenated [FILE]?

I'm using getopts for all of my scripts that require advanced option parsing, and It's worked great with dash. I'm familiar with the standard basic getopts usage, consisting of [-x] and [-x OPTION]. ...
3
votes
1answer
25 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 ...
3
votes
1answer
142 views

mount --no-canonicalize?

Neither man nor info page provide more information on this than: mount --no-canonicalize Don't canonicalize paths. The mount command canonicalizes all paths (from command line or fstab) ...
2
votes
2answers
579 views

List of available command options?

I'm currently setting up my first web server without a control panel and so far things are going pretty good! I was just wondering if anyone could direct me to somewhere that explains all of the ...
2
votes
3answers
324 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? ...
2
votes
1answer
545 views

How to find every symbolic link on a server?

I need to find every symbolic link on the server. The version is AIX 6.1. man find says -L Follow symbolic links But find -L is not a proper usage. Usage: find [-H | -L] Path-list ...
2
votes
4answers
101 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 ...
2
votes
1answer
180 views

difference between useradd -b and useradd -d

Can somebody please explain to me the exact differences between useradd -b and useradd -d in [Debian] Linux? Both seem to work quite similar to me, but then I spot differences that confuse me.
2
votes
2answers
79 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
56 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 ...
2
votes
1answer
103 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 ...
2
votes
2answers
119 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
2answers
625 views

syntax of ls --hide= and ls --ignore=

ls --hide and ls --ignore provides the possibility leave out files defined through regular expressions set after the --ignore= part. The latter makes sure that this option isn't turned off via -a, -A. ...
2
votes
1answer
382 views

What is the `less` command line option to page to the next file at the end of the current one?

I'm sure there used to be an option in less which allowed you to page onto the next file after you reached the end of the current file, so you could just keep *space*ing through a bunch of short files ...
2
votes
1answer
886 views

Altering the default boot option on CentOS

I recently installed a copy of CentOS onto my main hard drive (I now have Windows 7 and CentOS). Whilst installing CentOS, I accidentally set it to be the main boot option, so when I start my PC I ...
2
votes
1answer
2k views

How to run a specified codeblock with getopts when no options or arguments are supplied?

So I am writing a script that mixes options with arguments with options that don't. From research I have found that getopts is the best way to do this, and so far it has been simple to figure out and ...
2
votes
1answer
210 views

Processing shell script options with awk

I'm looking for way to process shell script arguments that is cleaner and more "self documenting" than getopt/getopts. It would need to provide... Full support of long options with or without a ...
1
vote
4answers
338 views

What is this Bash line supposed to mean?

find . -name "*.html" -exec grep -l somethingtobefound {} \; I was just wondering what the keywords "-name" "-exec" "-l" "{}" "\" and ";" were supposed to signify. Also, I commonly see ...