Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I saw some postinst script

    # setting wget options
    :> wgetrc
    echo "noclobber = off" >> wgetrc
    echo "dir_prefix = ." >> wgetrc
    echo "dirstruct = off" >> wgetrc
    echo "verbose = on" >> wgetrc
    echo "progress = dot:default" >> wgetrc
    echo "tries = 2" >> wgetrc

What does the :> do here ?

share|improve this question
up vote 11 down vote accepted

Nulls out the file called "wgetrc" in the current directory. As in creates an empty file "wgetrc" if one doesn't exist or overwrites one with nothing if it does.

Equivalent to the following:

cat /dev/null > wgetrc
share|improve this answer
Just to clear any possible ambiguity, "nulls out" and "overwriting with nothing" does not mean that "null" characters (hex 00) are written to the space the file was using.. It only tells the filesystem to "mark" that file as having no data in it... Also. you do not need the : at all... >file is enough. – Peter.O Apr 28 '12 at 5:30
@Peter.O: There are a few cases where >file will not have the same affect as :>file. In particular some interactive shells (zsh by default, bash with options) will interpret that as a time to ask the user for input rather than using null. If you want your code to be portable between interactive and script environments (so it works the same copy/pasted as in a script for example) using :>file is safer. Otherwise, your point about 'nulls out' is well given. – Caleb Apr 28 '12 at 14:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.