I was trying to update my system path, followed some directions online and accidentally types:

touch ~/.profile

Did I overwrite my .profile file? Does this mean that I have destroyed all of my PATH information? If so, how do I fix this?

migrated from stackoverflow.com Apr 14 '16 at 11:39

This question came from our site for professional and enthusiast programmers.


The short answer is "no".

The touch command does not modify the data in a file at all. Its effects on a file are:

  1. If the file does not exist it is created
  2. If the file exists if sets its access time metadata to the current time

There are some more options but in this case they are irrelevant, you can see the whole documentation by typing man touch in the terminal.

So, no worries, your .profile file was not modified.


I see that you are on OSX which doesn't have a ~/.profile file by default. So you probably didn't do any damage.

Just run echo $PATH to confirm that it has the usual directories: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

You must log in to answer this question.