How To Create An Empty File With Linux Shell Command Echo
Posted On Mon Oct 22, 2007 By hostman In Linux wallpaper Hosting forums topics about gallery sites in linux systems Forums
today i wanted to create an empty file with the echo utility. so this is how you do it:
now try it and tell me if it worked for you. please. i would like to know your opinion or comments so i can help as much people as i can. now that you learned something from me for free, i would like to learn something from you. thanks
echo > whatever_file_name.txt
now try it and tell me if it worked for you. please. i would like to know your opinion or comments so i can help as much people as i can. now that you learned something from me for free, i would like to learn something from you. thanks
did it work for you?
phatrick Tue Mar 05, 2013
echo > fname.txt
adds a single new line
print > filename.txt
does the same thing without a newline, so gives you a really empty file.
adds a single new line
print > filename.txt
does the same thing without a newline, so gives you a really empty file.
struth Thu Apr 05, 2012
that's way cool, who would of thought touch!, I truly am "touched" lol thanks
Nob Wed Jan 25, 2012
useful, cheers.
Carlos Mon Oct 10, 2011
Ty, it was just what i was looking for
Chris Wed May 26, 2010
Thanks! You just saved me a LOT of time. Blessing upon thee!
-Chris
-Chris
gabi Sat Mar 06, 2010
yes, it works :) *bonus text, because my comment is too short*
Johan Sun Mar 01, 2009
if you want to create an empty file, use touch:
$ touch filename.txt
$ touch filename.txt
Joe Tue Oct 28, 2008
that command will put a newline in the file, so it's not quite empty (at least in ubuntu linux). you can add the -n option to prevent the newline, like so:
echo -n > whatever_file_name.txt
a shorthand way to do the same thing (might depend on your shell though) is:
> whatever_file_name.txt
echo -n > whatever_file_name.txt
a shorthand way to do the same thing (might depend on your shell though) is:
> whatever_file_name.txt
dW Thu Jul 24, 2008
i am using ubuntu and my operator command does not like to work to create any files. i can use vi, save and exit to create a blank file.
the reasoning behind me wanting a blank file in the first place is because i am creating scripts and the redirction will only work if the file is created and the owner:group are both the current user/ non-root.
please help sudo does not work either
the reasoning behind me wanting a blank file in the first place is because i am creating scripts and the redirction will only work if the file is created and the owner:group are both the current user/ non-root.
please help sudo does not work either
Related Content
Information
Forums »
Linux wallpaper Hosting forums topics about gallery sites in linux systems »
How To Create An Empty File With Linux Shell Command Echo
Linux wallpaper Hosting forums topics about gallery sites in linux systems »
How To Create An Empty File With Linux Shell Command Echo
Title: How To Create An Empty File With Linux Shell Command Echo
Description: How To Create An Empty File With Linux Shell Command Echo
Tags: how ,to ,create ,an ,empty ,file ,with ,linux ,shell ,command ,echo
Info: This Post Has Been Viewed 0 Times Since
Date: Mon Oct 22, 2007
Author hostman Received 9 Replies #458
Date: Mon Oct 22, 2007
Author hostman Received 9 Replies #458
Share
URL: 

Embed: 

To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it
BBCODE:: 

BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
wallpaperama | Wallpapers | Forums | Terms Of Service
copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5
copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5