Quickzi: Disable Login and Logout Sound on Ubuntu

I don’t know about you but I find the login sound on Ubuntu pretty annoying. Here is a quick, nice and easy way to disable it.

How to disable Ubuntu Login and Logout sounds

Navigate to System > Preferences > Sound then click the Sounds tab.

Disable Login and Logout Sound on Ubuntu

Set the Log Out and Log In sounds to “No Sound” to disable the login and logout sounds in Ubuntu.

5 Reasons Ubuntu is superior to all other Linux distributions

It may be a bold statement to make, especially considering the fact that I’m by far no Ubuntu fanboy.  My background in Linux began with Slackware, and I’ve always preferred the more simplistic distributions that allow you to have complete control over what goes on.  However, as the demand and the user base for Linux grows, it’s obvious that people want simplicity in another way; people want an operating system that is free and easy to install, configure, and most of all, use.  Ubuntu has answered the calling for a Linux desktop that moms, dads and grandmas alike can all use with a little openness to a change in the overall look and feel.  These are my arguments as to why I believe Ubuntu is superior to all other Linux distributions available today.

The ability to try everything out

The fact that Ubuntu has a live CD built right into the installation disk allows users to actually test out the basics and get a feel for Ubuntu right from the start without installing anything to your disk.  With all of the distros available to choose from these days it’s important for a distro to offer a straightforward, easy to use live CD option.

Ease of installation

Ubuntu offers users very simple methods of installation. Whether you choose to install from windows using wubi, dual boot, or single boot, every option is easily configurable and straight forward.  You don’t have to be a tech geek or have understanding of partitions and swap space in order to install Ubuntu.

Ease of upgrades

Since Ubuntu is based off Debian and uses the apt package manager, upgrades to new versions as well as security updates are simple to apply requiring almost no interaction apart from entering a root password.  It’s important to offer users an easy way to update packages for security as well as upgrade to a newer version when one is available.  Upgrading Ubuntu from one version to the latest version is as easy as pie; a few clicks, a little waiting, and a system restart and you’re on the newest version.

Community

Having a community that can offer support is crucial for any Linux distribution. It’s what makes or breaks any Linux project. Ubuntu has a great community for both development and support.  The Ubuntu forums are full of great questions and answers from both new Linux users and old timers.  The IRC channel on freenode is also a great place to hang out and ask questions or even provide your own assistance to those that need it.

Ubuntu just works

Taking into account that Ubuntu is just a distibution of Linux and it is actually Linux that “just works” it is important to note the fact that the the ubuntu developers have done in excellent job in creating a Linux distrobution that just works right out of the box. From plugging in third party devices such as digital cameras and usb drives, easy to use wireless, to the ability and awareness of using restricted device drivers if you wish makes Ubuntu great for people of all skillsets.

The Best Way To Learn Linux

Dan Craciun posted a nice article on his blog titled What is the best way to learn linux? that got me thinking just what some of the best ways to learn Linux are.  Dan and I agree that reading documentation is one of the best ways to learn Linux in general.

Dan uses the famous quote “give a man a fish and he will have food for one day, teach the same man how to fish and he will have food for his entire life” which really does make sense in relation to learning Linux.  A lot of new Linux users will ask a question on a forum or in an IRC chat room and demand or expect a direct answer.  However, a lot of times what they end up getting is a way to solve their problem, not exactly how to do it.  There is a general consensus among old time and advanced Linux users that it’s important to read documentation and manuals if you want answers.

Here are some of the best ways to learn Linux:

  • Start off on the command line to learn the true way of Linux before you start on the desktop and use GUI tools to do everything for you.  Remember each GUI tool you use is just a front end for command line tools that can accomplish the same thing.
  • Read manuals and ask a lot of questions.  Be sure you’re asking the right questions though. Research before you ask.  Don’t bother to ask questions to something that you could easily find by spending 5 minutes searching Google.
  • Subscribe to Linux blogs and participate in Linux forums.
  • Explore your options by trying different Linux distributions.

How To Install and Configure Avant Window Navigator for Ubuntu

If you have a video card capable of running a composition manager like Compiz, you may be interested in running the Avant Window Navigator for Ubuntu.  This document will explain the steps you need to take to install and configure the Avant Window Navigator on Ubuntu 8.04.

The Avant Window Navigator (AWN/Awn) is a dock-like navigation bar for the Linux desktop that positions itself at the bottom of the screen. It can be used to keep track of open windows and behaves like a normal window list. It is very similar to the menu doc in Mac OSX Leopard.

First, you need to make sure you have composition turned on.  In Ubuntu, navigate to the System > Preferences > Appearance > Visual Effects tab.  Make sure that visual effects is enabled.

Enable Compiz in Ubuntu

Now that we know composition is enabled, we can go ahead and install AWN.

Installing Avant Window Navigator

First we need to make sure that you have the backports repository enabled in your /etc/apt/sources.list.  This can be done via the GUI, but I am going to demonstrate how to edit the file from the command line, the true Linux way.

Edit the /etc/apt/sources.list file with a text editor such as vi or nano.

# nano /etc/apt/sources.list

Locate the following lines:

# deb http://us.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse

Uncomment these by removing the pound (#) signs on both lines.  It should now look like this:

deb http://us.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse

Save the file in nano by hitting ^X then Y to accept the changes.

Now that we have allowed apt to search the backports repository, we have to tell apt-get to update the repository list.

# sudo apt-get update

Now we can install Avant Window Navigator:

# sudo apt-get install avant-window-navigator

apt-get will install a few other dependencies, such as awn manager.  Awn Manager is a tool that allows you to configure your dock.

Now that AWN is installed, you should be able to run it by going to:

Applications > Accesories > Avant Window Navigator

You should now see the AWN dock at the bottom of your screen.

Configuring Avant Window Navigator

To configure AWN to your liking, open up the Awn Manager by navigating to System > Preferences > Awn Manager

AWN Manager

You’ll notice that the Awn Manager allows you to configure many aspects of the dock.  From here, you can add applets, launchers, different themes, and modify the apperance and behavior of the dock.  Hint: A nice tip you should know is that you can add apps to the dock by navigating to the Applications menu and simply dragging applications into the dock in real time.

How to get Avant Window Navigator to run at start up

If you want AWN to run during startup, all you have to do is add it to your startup sessions.

Navigate to System > Preferences > Sessions

Under the Startup Programs tab, click +Add and fill out the New Startup Program dialog box:

Add AWN to Startup Programs

Awn should now start up during after your computer boots.

Further AWN Information

To find out more about the Avant Window Navigator visit the AWN Wiki and check out the AWN Frequently Asked Questions.

Quickzi: How To Delete Bash History

If you want to delete your bash history, there are a few options you have.  First you must understand that the history of your bash session is stored into RAM and then written to ~/.bash_history when you log out of the bash session.  So even if you delete the ~/.bash_history file, your current bash session will still be written to history once you log out.

Delete bash history

To delete the bash history for your current session as well as old sessions, you should do two things:

Delete the .bash_history file:

# rm -rf ~/.bash_history

Clear the current history stored in RAM:

# history -c

Stop writing to .bash_history for good

If you don’t want to log any history for good, you can do one of two things; turn it off for all users, or turn off logging history for a single user.

Turn off bash history for all users:

Append “unset HISTFILE” to /etc/profile:

# echo "unset HISTFILE" >> /etc/profile

Turn off bash history for a specific user:

Append “unset HISTFILE” to /home/USER/.bash_profile:

# echo "unset HISTFILE" >> /home/USER/.bash_profile

That’s it! Now you have successfully deleted the bash history and stopped logging to bash history.

Quickzi: How To Replace a Line in a Text File

Here is a quick tip on how to use sed to replace a line in a text file from the command line, without opening it.

Replace a Line in a File

First, replace the text you want with sed and output it into a temporary file to ensure that it is correct:

# sed -e 's/original-text/new-text/' textFile > newFile

View the newFile and make sure that the line is correctly replaced:

# more newFile

Overwrite the textFile with the newFile:

# mv newFile textFile

Quickzi: How To Add a Line into the middle of a Text File

Here is a quick tip on how to use sed to add a line into the middle of a text file from the command line, without opening it.

To clarify, let’s say you have a text file that has four lines:

Line1Text
Line2Text
Line3Text
Line4Text

Using sed, you can append a line anywhere you want with a simple command without even knowing the line numbers.

Add a Line into the Middle of a Text File

For this example, lets say we want to append a new line under Line3Text:

# sed '/^Line3Text/a NewLineText' textFile > newFile

You’ll notice that we output the results to a newFile so that we can make sure the new line appended correctly before overwriting the original file.  If you check the newFile, you should see a correct output, then you can overwrite the original textFile.

# mv newFile textFile

Linux Foundation Makes a Statement on Closed Source Drivers

The Linux Foundation and kernel developers alike have finally decided to speak out by issuing a statement on closed source drivers, recommending “that hardware manufacturers provide open source kernel modules.”

Here’s the entire statement:

The Linux Foundation recommends that hardware manufacturers provide open source kernel modules. The open source nature of Linux is intrinsic to its success. We encourage manufacturers to work with the kernel community to provide open source kernel modules in order to enable their users and themselves to take advantage of the considerable benefits that Linux makes possible. We agree with the Linux kernel developers that vendors who provide closed-source kernel modules force their customers to give up these key Linux advantages. We urge all vendors to adopt a policy of supporting their customers on Linux with open-source kernel modules.

Background Materials

There is no telling if the hardware manufacturers will take notice and actually adhere to the Linux Foundation’s statement, but at least they will know where the Linux community developers stand.  It’s obvious as to why the hardware companies don’t want to provide open source drivers, in order to remain competitive, but there has to be a tipping point at some point.

Visit the Linux Foundation website for more information.

MySQL Change Password Tip

I keep getting the question on how to change a mysql root password. Here is a quick tip on how to change the MySQL password from the command line.

# /etc/init.d/mysql stop
# mysqld --skip-grant-tables
# mysqladmin -u root password 'newpass'
# /etc/init.d/mysql start

Change MySQL Password for a standard user

You can also change the mysql password for a standard user using mysqladmin.

# mysqladmin -u username -p oldpass newpass