I added this to ~/.bashrc to provide colorized tail:

tailc () {
  tail $@ | ccze

And I can run it as so: tailc -f -n 10 foo/log.txt

But I can't use it on a privileged file:

sudo tailc -f -n 10 /var/log/syslog


bash: tailc: command not found

I know I can do it like this: sudo bash -i -c '...' but I want to know if I can run it without that more complicated syntax. What can I do to be able to just type sudo tailc ...?

BTW, I added that function to /root/.bashrc as well, but that didn't help either.


1 Answer 1


The way to do it is:

sudo bash -i -c 'tailc -f -n 10 /var/log/syslog'

But that syntax is ugly, so I went in a different direction.

I created a script /usr/local/bin/tailc with permission 755:


tail $@ | ccze

Now I can use tailc / sudo tailc as I wanted.

Not the answer you're looking for? Browse other questions tagged .