<p>This is a pretty simple question, at least it seems like it should be, about sudo permissions in Linux.</p>

<p>There are a lot of times when I just want to append something to <code>/etc/hosts</code> or a similar file but end up not being able to because both <code>&gt;</code> and <code>&gt;&gt;</code> are not allowed, even with root.</p>

<p>Is there someway to make this work without having to <code>su</code> or <code>sudo su</code> into root?</p>

```
```
sudo sh -c "echo 127.0.0.1 localhost >> /etc/hosts"
```
```