Tip Details Add a Related Tip

Rate as: Positive Negative

Empty the contents of a file

For *nix users, here's a command you can use to clear out the contents of a file without having to delete the file and create it new again (which can be especially big hassle if you have to change file permmissions)

cat /dev/null > THE_NAME_OF_YOUR_FILE

Nothing earth shattering. But I find this useful for dealing with some types of log files. When they get too a certain size and I want to delete them and start again I can use this command to delete the contents without having to create the file again.
Rating: no ratings, 0 total Votes
Categories: UNIX linux
Added: on Aug 21, 2008 at 9:09 am
Added By: an anonymous user
Searches: file unix linux content delete

Comments on this Tip

Add a Comment
There are no comments for this tip
Your Comment:
(how to format)
Rate This Tip:

Verify Humanity:
Sorry, we know it's annoying, but please enter the characters shown in the image to the left so that we know you're an actual person and not an evil spammer. Thanks.
       

Related Tips

ssh and scp without passwords

Categories: shell Mac linux UNIX
100% positive, 2 comments - last added on Jun 19, 2009 at 8:29 am
– Tip added by an anonymous user on Dec 21, 2007 at 2:51 pm

Running Linux jobs even when disconnected

Categories: Linux UNIX command line
100% positive, 1 comment - last added on Dec 24, 2008 at 1:14 pm
– Tip added by an anonymous user on Dec 22, 2008 at 2:21 pm

Show calendars on the UNIX command line

100% positive, 0 comments
– Tip added by an anonymous user on Jan 20, 2009 at 4:45 pm

Color coding the ls command in Fedora

100% positive, 0 comments
– Tip added by an anonymous user on Apr 25, 2008 at 8:27 am

listing files on a single line

Categories: linux Unix command line
100% positive, 0 comments
– Tip added by an anonymous user on Feb 19, 2009 at 8:03 am

Read diffs easier

Categories: UNIX linux CVS command line
100% positive, 0 comments
– Tip added by an anonymous user on Dec 12, 2008 at 2:10 pm

Running background jobs

Categories: linux UNIX
100% positive, 0 comments
– Tip added by an anonymous user on Dec 04, 2008 at 10:04 am

Finding files older than a certain time on Linux

Categories: Linux find UNIX
no ratings, 0 comments
– Tip added by an anonymous user on Jul 27, 2009 at 1:47 pm

Forcing users to change their password

no ratings, 0 comments
– Tip added by an anonymous user on Sep 30, 2008 at 11:27 am

Software Development Automation with Scripting Languages

Categories: linux unix scripting
no ratings, 0 comments
– Tip added by an anonymous user on Jun 05, 2008 at 2:40 pm

Running X11 programs from the terminal

no ratings, 0 comments
– Tip added by an anonymous user on Jan 28, 2008 at 8:04 am

Changing an already running job to execute in the background

Categories: linux UNIX Mac
no ratings, 0 comments
– Tip added by an anonymous user on Aug 06, 2007 at 11:57 am

Update your shell prompt

Categories: UNIX Mac linux shell
no ratings, 0 comments
– Tip added by an anonymous user on Jun 04, 2007 at 9:15 pm

Hacking Windows Using Linux

85% positive, 0 comments
– Tip added by an anonymous user on Jun 08, 2009 at 12:03 pm

How to execute chm files in linux

Categories: linux chm files hacks tricks
88% positive, 0 comments
– Tip added by an anonymous user on Jun 29, 2009 at 7:02 am

20 Free Operating Systems that are not Windows

85% positive, 0 comments
– Tip added by an anonymous user on Jul 05, 2009 at 8:47 am

MP3 support in Fedora 10

Categories: Linux Fedora mp3 music yum
85% positive, 2 comments - last added on Jan 04, 2009 at 11:11 am
– Tip added by an anonymous user on Dec 29, 2008 at 4:15 pm

Transform Linux to Windows 7

100% positive, 0 comments
– Tip added by an anonymous user on Jul 23, 2009 at 10:56 am

Manage your battery in linux

no ratings, 0 comments
– Tip added by an anonymous user on Sep 03, 2009 at 1:29 pm

Resetting the root password in Linux

Categories: Linux password root
0% positive, 1 comment - last added on Aug 01, 2009 at 1:15 am
– Tip added by an anonymous user on Feb 26, 2009 at 1:01 pm