How to Check for Open Ports in Ubuntu

There are various ways to view for open ports on your local Ubuntu/Linux machine. However, I particularly prefer two methods/command below, since it is simple, and without any third-party application.

Open your command prompt, and type:
netstat -an | grep "LISTEN "

Or, another method:
sudo netstat --tcp --udp --listening --program

It will list all ports that your machine are listening to. The latter method will even shows the program name associated to it.

Enjoy.

How to Enhance Your Linux Desktop with Conky

I have been using Conky as my desktop monitoring widgets for quite some time now. Before this, I’ve been using few applications like screenlets and gdesklets, but there’s a lot of drawbacks on these applications. Among them were limited customizations, it’s difficult to develop your own widgets, unable to find widgets you’re looking for, and if you do find them, they are too buggy to be used in the first place.

Then, I’ve found Conky. I’ll never turn back.

This is the best system monitor I have ever experienced. It is highly customizable, all you have to do is modify the Conky config file. There’s a lot of widgets/variables to use, such as system monitoring tools (CPU, RAM, SWAP, Hard Drive, etc), batteries capacity, networking, and more. And best of all, it is very, very easy to create your own widgets. If you know any programming language such as Python, Perl, or even a simple Shell Scripts, then you’re off to create your own.

Continue reading

Extend Transmission Torrent with Scripts

Transmission is one of my favourite bittorrent client. However, it’s lack the feature of running command(s) before or after you have finished downloading. Luckily we can improvise this with the help of transmission-remote, a command based client for transmission, and along with some Linux bash scripting.

Below I have created a simple bash script. What it does is, converting all of the finished avi’s to wmv. The conversion is via ffmpeg. The script below is easily modified to suit your needs, such as:
i – Copying the finished torrent to another location.
ii – Doing any conversion to your media.
iii – Send you mail notifying the torrent have finished downloading.
iv – etc, etc.

So, let’s get started.
Continue reading

How To Share Media Between Xbox 360 and Linux

I’ve got a little project going on in the past few days. I have a reasonable amount of media; movies, mp3’s and family pictures in my Linux desktop, Ubuntu 8.10. Would it be nice if I could stream all the movies and music directly from the Linux machine to my Xbox 360? This is a very easy feat in Windows, where we could simply use the Windows Media Share option in Windows Media Player 11. But, what about Linux?

Xbox-Linux box media sharing could be achieved by using GeeXbox uShare. GeeXboX uShare is a free UPnP A/V & DLNA Media Server for Linux. Installation and configuration explained after the jump below:

Continue reading

Indispensible Unix commands

The first lab session of my Computer Science course consisted primarily of learning the following Unix commands: pwd, ls, cd, cp, mv, rm, mkdir, chmod, more, man. Although I’ve been using nothing but Windows throughout my career – from Windows 95 to 2000 to XP – these commands have proven to be indispensible for those occasions when I need to remotely administer a Linux box.

Let’s go through them one by one.

You log in to a Linux server and all you get is a dollar sign and a cursor. The first thing you want to know is: where am I? So you want to print the working directory:

pwd

Then you want to list all the contents of the current directory in a long listing format:

ls -al

To get around, you change directory:

cd /another/directory

Then, to copy a file from one directory to another:

cp /some/directory/somefile.txt /another/directory

To move it instead:

mv /some/directory/somefile.txt /another/directory

There is no command to rename, you just move it:

mv oldname.txt newname.txt

To remove a file:

rm filename.txt

To remove a directory and its contents recursively:

rm -r dirname (use with extreme caution!)

To make a directory:

mkdir dirname

To change the mode of a file or directory to make it writeable by everyone:

chmod ugo+rwx file_or_directory

ugo+rwx means, for (user, group, others), add (read, write, execute) permissions. Use the minus sign instead of the plus sign to remove permissions. ugo and rwx can be used in any combination, e.g., go-w.

Finally, to get to know more about the contents of a file:

more filename.txt

Press space to scroll to the next page, and q to quit. (Note: less is better than more. With less, you could go both backwards and forwards.)

Finally: when in doubt, consult the manual!

man command

Update 13 February 2009

See also Commands that you must know in Linux… by dirn.name.