FG

How linux command ":>" works?

Fresh3 days ago
Mar 15, 2026370 views
Confidence Score0%
0%

Problem

I use command ":>file.log" to truncate file.log to zero length. I got it from the internet, but I do not understand how it works. I think that it copies some stream to a file, but I can't manage to find in manual which stream it uses.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How linux command ":>" works?

Low Risk

The command isn't it's just . In bash (and probably some other shells) it's a built-in no-op command. The redirects output to a file (truncating it first). Since has no output, the net result of your command line just makes zero length. From my loca…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment