Attention please:
I am not asking how to make a file from the command line!
I have been using touch
for making files for years without paying attention that its main purpose is something else. If one wants to create a file from command line there are so many possibilities:
touch foo.bar
> foo.bar
cat > foo.bar
echo -n > foo.bar
printf '' > foo.bar
And I'm sure there are more.
But the fact is, none of the commands above are actually designed for creating files. For example, man touch
suggests this command is for changing file timestamps. Why doesn't an OS as complete as Unix (or Linux) have a command solely designed for creating files?
cat
enation! – SF. Apr 10 '14 at 12:07more
whenless
does more than whatmore
do!? Ordir
andls
. Albeit, I'm aware of compatibility issues. – Pouya Apr 10 '14 at 12:08more
predates the creation ofless
.less
has been created specifically to address shortcomings ofmore
.more
still exists for backward compatibility reasons.dir
andls
are, for most intents and purposes, the same executable - they differ only in a handful of bytes. A new tool intended specifically for creating files would do less than existing tools, and as such it would be a regression, not an improvement like in the case ofless
vsmore
. – lanzz Apr 10 '14 at 13:46vim -
(vim read from stdin) which AFAIK does even more thanless
;) – Izkata Apr 10 '14 at 14:11>
character? I think the basis of this question is flawed. – krowe Apr 11 '14 at 02:51cp /dev/null foo.bar
. – user1024 Apr 11 '14 at 05:48