How do i get Terminal to accept sudo echo?

We are trying to use a "development" environment on a server to work on a web site reconstruct under our domain while leaving the current site live. Our provider advises resolving the domain name by changing something in the Terminal window:

Last login: Thu Nov 11 11:46:46 on ttyp1
Welcome to Darwin
520bro057036b:~ user-name$

* At the prompt type:
sudo echo "xxx.xxx.xxx.xxx example.com" >> /private/etc/hosts
_____________________________
followed this instruction and got "-bash: /private/etc/hosts: Permission denied"
-expected perhaps to be asked for password but it didn't do that
-logged in under administrative user

Any suggestion what i've done wrong? My first exposure to the Terminal utility also -Where can i find documentation on what is the Terminal window to try and understand what is going on in general?

MacBookPro, Mac OS X (10.4.11), IntelCore Duo; 2 GB 667 MHz DDR2 SDRAM

Posted on Apr 28, 2009 10:48 AM

Reply
2 replies

Apr 28, 2009 12:03 PM in response to CatalogueGirl

In light of the file permissions of hosts and its containing directories, I don't know why sudo echo "xxx.xxx.xxx.xxx example.com" >>/private/etc/hosts won't work from an admin-privileged account. But if you first elevate your privileges with sudo ‑s, then you will be root and then all you'll need to do is to just type echo "xxx.xxx.xxx.xxx example.com" >>/private/etc/hosts. At least doing that worked for me.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do i get Terminal to accept sudo echo?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.