Wednesday, March 02, 2011

Insert text by command line linux

sample for insert text on file


sudo echo "127.0.0.1 wordpress.ruamit.co.cc" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 forums.ruamit.co.cc" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 support.ruamit.co.cc" | sudo tee -a /etc/hosts



check after insert

mint@mint ~ $ cat /etc/hosts
1.1.1.21 mint # Added by NetworkManager
127.0.0.1 localhost.localdomain localhost
::1 mint localhost6.localdomain6 localhost6
127.0.1.1 mint

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

127.0.0.1 wordpress.ruamit.co.cc
127.0.0.1 forums.ruamit.co.cc
127.0.0.1 support.ruamit.co.cc
mint@mint ~ $

No comments:

Post a Comment