from small one page howto to huge articles all in one place

search text in:

Which filesystem do you use?

poll results

Last additions:
using iotop to find disk usage hogs

using iotop to find disk usage hogs






average rating: 1.7 (102 votes) (1=very good 6=terrible)

May 25th. 2007:




why adblockers are bad

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels






average rating: 1.4 (41 votes) (1=very good 6=terrible)

April, 26th. 2006:

Druckversion . pdf icon
You are here: System->Tips and Tricks

Introducing the -- flag

This tip introduces the -- flag. This flag is supported by many utilities but isn't always documented in the man pages. However, it can be very useful, especially when dealing with malformed filenames.

Note: Most programs that make use of --option also support the -- flag since it is a standard feature of GNU getopt().

The -- flag forces everything passed in after it to be an argument to the command. This can be extremely useful when dealing with filenames that start with a - which would normally indicate an option or flag passed to the command.

For example, assume that for some reason, there is a file named -file that needs to be deleted. Normally you would use the command rm to delete a file, but this doesn't work since the file in question starts with a -. But by using the -- flag, we force rm to recognize -file as an argument and not an option.

Code Listing 1: Using the -- flag

// Attempting to use rm results in an error as rm tries to 
// process all of the letters as options (f,i,l,e). It fails 
// on 'l' since that isn't a valid option for rm. 
% ls 
% rm -file 
rm: invalid option -- l 
Try `rm --help' for more information 
% rm -- -file 
% ls 
// -file was successfully removed

Note: For more technical information, see man 3 getopt.


rate this article:
current rating: average rating: 1.5 (20 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)


Support us on Content Nation
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2020 Sascha Nitsch Unternehmensberatung GmbH
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 53.8 ms