I'm working on a bash script tied to /etc/profile but instead of appending, I accidentally wrote over it, losing all its contents. How can I restore the file?


You can find the template of /etc/profile in /usr/share/base-files/profile If you want to restart with a new one, you can easily copy it :

sudo cp /usr/share/base-files/profile /etc/profile
  • 1
    The files in /etc/skel are copied to the home directories of new users. The file /etc/profile is a system-wide configuration file and somewhat different.
    – mook765
    Mar 27 '18 at 14:51
  • @mook765 They updated the answer with a file that does match the default /etc/profile. May 15 '18 at 23:27
  • @ChaiT.Rex Thanks, removed downvote, edited and upvoted...
    – mook765
    May 15 '18 at 23:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.