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
  • 5,471
  • 11
  • 50
  • 112

1 Answers1

4

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

Nagakishore Sidde
  • 2,189
  • 1
  • 14
  • 9