Categories
mac Terminal Tutorials

Mac – How to clear a file’s contents using Terminal command

A quick trick to empty a file using Terminal on Mac.

1. Open Terminal

2. enter the following command in Terminal

cat /dev/null > fileName

If you get a warning Permission Denied you can do the following trick.

sudo sh -c 'cat /dev/null > fileName'