I am trying to add entry to /etc/hosts file using 'sudo echo '192.168.1.254 router' >> /etc/hosts' command, but getting an error that read as, -bash: /etc/hosts: Permission denied. How do I insert or append text to a file when running sudo command on Linux or Unix-like system?
The post How to append text to a file when using sudo command on Linux or Unix appeared first on nixCraft.