samedi 9 mai 2015

Changing /etc/hosts with sed command

I'm trying to change /etc/hosts file with sed command , I use sudo to execute the following command

 sudo sed 's/127.0.0.1 localhost/127.0.0.1 localhost mydomain.com/g' /etc/hosts |sudo cat > /etc/hosts

but this is the error that I get

-bash: /etc/hosts: Permission denied

Aucun commentaire:

Enregistrer un commentaire