touch and echo

hello

what is the difference between :

touch /home/toto
and
> /home/toto

thank you

Touch will create the specifie file with no data in it

If the file already exists it will change its last access time

> /dir/file

is the path of the specified file

Rather than the above, the command below (in red)

[sh-2.05b$] :>/home/toto 

will create a file if it does not exist.

If it exists, it will clear the contents.

touch on the other hand will not clear the contents. But it will update the timestamp.

vino

> /home/toto
:>/home/toto

are both legal and will have the same result.

True.

And thanks.

-vino

thank you for all responses !
:slight_smile: