Ping not resolving on Linux?

Weird one, but sometimes some of my virtual machines can’t resolve external web addresses. Ping fine, but ping and you get an ‘unknown host’ error.

Seems to be a problem with resolv.conf – always check /etc/resolv.conf and see if it is pointing to as the DNS.


Tip: how to get the size of a folder in Linux CLI

It seems like a simple request…and it mostly is. But if you want to get the size of a folder – including sub-folders – in Linux from the command line, you need to use the du command. The simplest trick (thanks to get the total size without listing all the sub-folders is to use the following:

du -h | grep -v '/' | awk '{print $1}'

Shutting down via the web

One of the annoying things about Ubuntu is the fact that you need to be an admin user to shutdown the PC. This makes sense if you are running a server, but not when you have a few PCs scattered throughout the house that you’d just like to shutdown quickly.

So, I found a way to enable this through Apache. Warning: this will allow anyone who browses to your PC to shut it down without prompting. So use carefully.

Basically, what you need to do is remove the need for admin/sudo access when shutting down as the www-data (Apache) user. To do this, you use a specific command called visudo which specially edits a file containing what commands require admin access.

In short, make sure that the last line in that file is the following:


and that there is a line further up that says Cmnd_Alias SHUTDOWN_CMDS = /sbin/shutdown, /sbin/reboot, /sbin/halt.

Then, once this is done, you can have a shutdown.php that has the following code:

echo exec('sudo shutdown -h now');


Streaming PVR-150 via VLC

So, after some pretty massive renovations, I now have Cat-5E cable throughout the house. Sweet. 🙂

I also have a need to somehow get the feed from my Sky box upstairs to the TV downstairs so the younglings can watch Playhouse Disney. In the past, I’ve done this through ye ol’ UHF backfeed, but the new HD box doesn’t allow that without an RF modulator.

What to do? Oh, well I do have an Xbox softmodded with XBMC downstairs. And I do have a Shuttle running Ubuntu with a Hauppauge PVR-150 TV card beside the Sky box upstairs. How abouts a little VLC streaming? 🙂

I’ve added the following line of code to my


file on the Shuttle:

su [A NON-ROOT USER] -c "vlc pvr:// :pvr-device=/dev/video0 :pvr-norm=0 --sout '#standard{access=http,mux=ts,dst=[IP ADDRESS OF SHUTTLE]:8080}' --daemon"

Then, on my XBMC install, I have a file called


which has this one simple line in it:


and is sitting under the Playlists folder in the Videos directory of my UserData folder. When I go and select it, after a couple of seconds I get full MPEG-2 streaming across my network!

I can also access the stream from any VLC player on my other machines too.

Super sweet!

EDIT: After upgrading to 10.04, I inexplicably needed to add the line :pvr-channel=2 to make this pick up more than static.

Great link for command line SAMBA

I’m just discovering the usefulness of smbclient and this link has a great summary of the commands you can fire through this tool from the terminal.

Probably the most common one I need to do is to use the tarmode to copy whole folders down, like so:

lcd /tmp #this switches the local directory
mget pdf995/ #this recurses and tars the pdf995 remote directory and puts it in /tmp on the client