1

I'm trying to append to the /etc/hosts file from the termimal:

sudo echo -e "127.0.0.1      localhost-myproject" >> /etc/hosts

Even though I'm doing as sudo, it won't let me. I get permission denied:

bash: /etc/hosts: Permission denied

I've looked at a couple other posts and they instruct like this. But I'm getting this error. How can I do this? Thanks

Martyn
  • 6,031
  • 12
  • 55
  • 121

1 Answers1

4

sudo /bin/bash -c 'echo -e "127.0.0.1 localhost-myproject" >> /etc/hosts'

Nagakishore Sidde
  • 2,617
  • 1
  • 16
  • 9