Quickzi: How To Block Incoming Access to Port 80

Here is a quick Linux tip to block incoming access to port 80 using iptables.

iptables -A INPUT -j DROP -p tcp --destination-port 80 -i eth0

The code above will drop all tcp packets coming into your Linux computer on device eth0 on port 80.  If your Internet connection runs through a device other than eth0, go ahead and make the adjustment.

To remove the iptables rule use the following code:

iptables -D INPUT -j DROP -p tcp --destination-port 80 -i eth0

For more information on using iptables visit the iptables man page.

Getting help with the Linux Command Line

This is a guest post by Taylor Douglass

The command line interface (CLI) is a very powerful part of Linux. Linux beginners undoubtedly agree that at first it can seem a bit daunting and even dangerous. While it is true that there far more Linux commands available than most will ever want or need to know and that some of these commands are capable of wreaking havoc on your system if used incorrectly; it’s reassuring to know that help isn’t far away. While a new Linux user who is Internet savvy might be inclined to run straight to Google when they need help with a particular command or are searching for the command they need, this is not necessary. In fact, most of the time you don’t even need to leave your terminal. How is this possible? Simple, it’s the man command.

Getting Started With Man

Man is short for Manual, and basically means that by using the man command you are accessing the manual for a particular command. Let’s begin by exploring how man is used. Startup a terminal and type “man intro”. This brings up a basic introduction to user commands, and the CLI in general. Once you have finished reading the intro go ahead and exit the manual page by hitting the letter “q”. You should now be back at the command prompt. The next step you will want to take is to read the manual page for the man command itself. This is accomplished by typing “man man“. You may be beginning to see a pattern here. To see the manual for any command simply type “man command” at the prompt. You may also begin to notice a pattern in how the manual pages look. Most manual pages consist of several different sections. Let’s take a look at the sections available for mv command. Type “man mv” into your terminal.

This section shows the command and gives a brief description of the command. In our example we see that the mv command is used to move or rename files.

Here you can find precise information on using the command that you are viewing. This includes all the switches and options available for the command. The first two sections (Name and Synopsis) are meant to be a quick reference for using the command that you are viewing. Further sections dive a little deeper and give you even more information.

The description section breaks down all of the options available and tells you what they do. In our example with mv we can see that using the -i option prompts the user before overwriting any files that are being moved. Also note that we could also use –interactive to do the same thing.

Other sections
Other sections that you might find in the manual pages are author information, bugs, copyright, files, see also, and examples. The two that might be worth mentioning are the See Also and Example sections. See Also gives you a list of other manual pages that may be relevant to the page you are currently viewing, while the Example section gives you a real world example of using the command you are viewing.

Searching For Commands

Let’s say that you want to copy a file but you are not sure what the command for copy is. Perhaps one of the most useful features of the Linux manual pages is the ability to search them. If we look at the manual page for the command man (Again that is “man man” at the command prompt) we can see that one of the options available is -k. What this option does is allow us to search the short description for keywords and display any matches. Back to our example for finding the command to copy files, let’s get to the command prompt and type “man -k copy“. This displays all the commands that have “copy” listed in the description. If you glance through the list of commands that man -k has found you should see “cp(1) -copy files and directories“. That looks like the command we need, but to be sure let’s look at the manual page for that command to be sure. “man cp” brings up the manual page for the command cp. As you can see by looking at the name and synopsis sections, this is indeed the command we need to copy a file.

Man I’m Glad There are Manual Pages

The man command has gotten me out of a jam on more than one occasion. I recommend that if you are just beginning to explore the CLI that you do a quick check in the manual before using any command. As I mentioned before the CLI is very powerful and it’s better to be safe than sorry when using it.

Creating Custom Linux Commands

This is a guest post by Taylor Douglass

The other day I ran across a script at shell-fu that generates a random quote from their website (here). I thought it would be useful to make this a command that I could execute at any terminal at anytime. Let’s get started.

First of all you are going to need links. If you don’t have links or are not sure if you do or not, fire up a terminal and type the following:

# sudo apt-get install links

Next navigate to your /bin folder and create the file

# sudo touch shell-fu

Make the file readable and executable

# sudo chmod +rx shell-fu

Now edit the file and add the code for retrieving the shell-fu quote (I use nano for this)

# sudo nano shell-fu
# links -dump "http://www.shell-fu.org/lister.php?random" | grep -A 100 -- ----
^O (writes the file from nano)
^X (exits nano)

You now have a custom command named “shell-fu” that you can type from anywhere and retrieve a random shell-fu quote.

Customizing Your Ubuntu Experience

This is a guest post by Taylor Douglass

After a Ubuntu install one of the first things that users want to do is customize the look to their liking. Lynucs.org has a great collection of screen shots to provide some inspiration for this process. This article is meant to get you going in the right direction as far as customizing the look and feel of Ubuntu.


One of the easiest and quickest ways to change the look of your desktop is simply to change the wallpaper. One of my favorite wallpaper repositories is socwall.com. Their wallpapers are very well organized and voted on by the community. Once you have a wallpaper that you think would look nice on your desktop you have two options. Please keep in mind that in both of these examples I am using Firefox.

Option one is to right click on the image and select “Set As Desktop Background“. From there you will presented with a dialog box that gives you different options for your wallpaper such as center, tile, and stretch. You can also set a background color if your wallpaper doesn’t cover the entire desktop.

The second option is to first save the wallpaper by right clicking on the image and selecting “Save Image As“. Save the picture in a directory you are familiar with such as your home directory under Pictures. Now go to the System menu, then preferences, click Appearance, and then select the background tab. Click the Add button, navigate to the place where you saved your wallpaper, and select your wallpaper.

Changing Your Gnome Theme

Changing your theme will give you the most dramatic results as far as the overall appearance of Ubuntu. If you go back to the Appearance Preferences (System -> Preferences -> Appearance) you will notice a tab named “Theme“. These are the themes that are currently available on your system. None of these really tickle my fancy, so let’s go out to gnome-look.org and get a nice looking theme.

When it comes to themes you can get really carried away very easily. Some themes require that additional modules, tweaks, and minor fixes be applied before the theme will work correctly. Gnome-look is very good at explaining everything that you need to do in order to correctly install your theme. For simplicities sake, let’s install a theme called Green Lemon 2. Download the theme (green lemon 2.tar.gz) and save it to a place that you can easily find it. Now go back to your appearance preferences, under the theme tab, and click install. Navigate to the place where you downloaded green lemon to and click open. You will then see the theme magically change before your eyes. After it’s done changing you should see a dialog box that says “GNOME Theme Green lemon 2 correctly installed”.


Panels are a quick and easy way to customize Ubuntu. You can use panels to display various information such as notes, weather, and the time. You can also use panels as tool bars to launch applications and documents. To begin playing with panels right let’s add a weather report. Right click on the top panel on your desktop. This will bring up a menu that has various options such as add to panel, properties, delete this panel, and new panel. We want to select add to panel. You should now see a list of various different items that you can add to your panel. Under the accessories section, select Weather Report, and click close. Now you have an icon on your panel that has a question mark and two dashes after it. This is because we haven’t yet set our location, so the weather report doesn’t know what to report. Right click on the icon and select preferences. Under the general tab set your preferences such as temperature unit and wind speed unit. Now go to the location tab and set your location and then close the preferences window. Before your weather information is displayed you may have to refresh it. Simply right click on the weather icon and select update. Now we want to move the icon. Right click on it and select move. Now move the icon to where you want it to be. I prefer that my weather icon sits right next to my clock. An interesting thing about the weather icon is that if you right click on it and select details, you get a lot more information such as current conditions, a forecast, and a radar map.

Something I will mention but is well beyond the scope of this tutorial is AWN or Avant Window Manager. This is a much more powerful application that is similar to Ubuntu panels. It allows you to add various tool bars and applets to your desktop. For more information about AWN, check out the wiki.

Pushing the Customizing Window

Something that is fairly new to the Ubuntu world is Beryl/Compiz. This application allows you to take customization to a whole new level. With Compiz you can adjust the opacity of windows and menus, add flashy affects when opening, closing, or moving windows, and change the way that you switch between desktops. Although Compiz requires a decent graphics card and a faster computer, it is rather amazing what is possible with it. For more information about installing and using Compiz, check out compiz.org.

Quickzi: How To Remove Blank Lines from a File

If you want to remove all blank lines from a file, a quick way of doing it from the Linux command line is to use sed.

So, lets say that your file looks like this:

# vi example_file

This is an example text file.
We will be using sed to remove blank lines from this example file.

sed is a stream editor for filtering and transforming text

There are a lot of powerful things you can do with sed.


Now, to remove the blank lines in this file, we’ll use sed.

# sed -i '/^$/d' example_file

# cat example_file

This is an example text file.
We will be using sed to remove blank lines from this example file.
sed is a stream editor for filtering and transforming text
There are a lot of powerful things you can do with sed.

If you want to preserve the original file, then you can pipe the changes to a new file:

sed '/^$/d' example_file > example_file_new


Quickzi: How To List Files with a Certain Date Stamp

Here is a quick tip on how to list files in a directory with a certain date stamp using awk.

Let’s say that you want to list all files stamped with 2008-04-11.

# ls -l | awk '{if($6=="2008-04-11") print $N }'

-rw-r--r-- 1 adam users 0 2008-04-11 16:27 file1
-rw-r--r-- 1 adam users 0 2008-04-11 16:27 file2
-rw-r--r-- 1 adam users 0 2008-04-11 16:27 file3

If you want to list only the file names, add an F switch.

# ls -l | awk '{if($6=="2008-04-11") print $NF }'

Quickzi: How To Add a Welcome Message for SSH Users

Here is a quick tip on how to add a welcome message for your SSH users.

If you want users to see a banner welcome message when connecting to your SSH server, you need to turn on the banner configuration of SSHd and then create a banner file.

Step 1:

Create a banner file that contains text you want people to see when connecting to your SSH server.

Create and open the banner file:

# vi /home/adam/banner

Add your text:

This is the banner file for Foogazi.com! Welcome!

Write the file and quit:


Step 2:

Edit sshd_config to set a default banner path.

# vi /etc/ssh/sshd_config

then add the following to the config file:

Banner /path/to/banner

Write the file and quit:


Step 3:

Restart the sshd server.

# /etc/init.d/sshd restart

Step 4:

SSH to your server and test to see if the banner is working:

# ssh adam@foogazi.com
This is the banner file for Foogazi.com! Welcome!

adam@foogazi.com's password:

It’s working!

How To Explain Linux to a Windows User

Theres been a question I have seen on multiple occasions both on the “How do I explain Linux to a Windows user” end as well as the “What is Linux?” question. That got me thinking.. what is the best way to explain Linux to a normal Windows user who has never heard of Linux? Have you ever been using a laptop in a public place, or have someone over at your house, and you’re running Linux and someone asks you why it looks different? Do you take the easy way out and say “it’s Linux, it’s like Windows but different!” or do you actually explain what Linux is? Here are some ideas of getting the message across as easy and straightforward as possible.

Explaining Linux to a Windows user

Here are a few ideas you can put together to help you explain Linux:

  • Every computer has an Operating System. Windows is an Operating System. So is Linux.
  • Linux was written in the early nineties by a college student name Linus.
  • Linux is not owned by any one person.
  • Linux is free, unlike Windows. Most people pay the Windows fee when they buy the computer that comes “pre-installed” with Windows.
  • It’s fun to use.
  • You have complete control of all aspects of the operating system.
  • It’s “look and feel” is completely customizable. You can make it look like Windows or you can make it look unique.
  • You can’t use all of the same software applications that you use on Windows, but there are alternatives to windows programs.
  • If your computers primary use is for playing popular computer games, hold off on installing Linux.
  • Linux is secure and practically virus and spyware free.
  • It can be a lot faster than Windows with the right setup and configurations.

How do you explain Linux to a Windows user?