Purpose: When you start using Linux everyday, from time to time you might encounter certain problems that can be easily fixed with the help of simple commands. In this blog post, I am going to highlight 10 important commands which might help you to fix or troubleshoot certain problems. Although I am using Debian as I am writing this blog post, but these command should be applicable to almost any Linux distros like Ubuntu, SuSE, Fedora, etc.

Command #1: dhclient

Many times you will notice that your computer does not get an IP address and as a result of that you are not able to connect to the internet. To solve this issue give the command:

# dhclient ethX

Where X = Ethernet interface

You can see all your network interface by giving following command:

# ifconfig -a

So your actual command might look like this:

# dhclient eth1

For more ethernet, network related issues, please refer to the ethernet troubleshooting post.

Command #2 update-grub

Suppose you added certain global parameters in your GRUB configuration file – /boot/grub/menu.lst – Now to add the parameter in your existing kernel entries give the following command:

# update-grub

Command #3 mkinitramfs

If you are having trouble with your kernel image during boot and you think it might be an initrd (Initial RAMDisk) issue, you can create a new one by giving the following command:

# update-initramfs -t -c -v -k <kernel-version>

Where kernel-version = The version of your Linux kernel for which you would like to create an initrd image.

You can see all your kernel version here by giving following command:

# ls /boot/vmlinuz*
/boot/vmlinuz-2.6.26-1-686 /boot/vmlinuz-2.6.28-2-686

So your actual command might look like this:

# update-initramfs -t -c -v -k 2.6.26-1-686

Command #4: kill

If you would like to kill a stubborn process which you cannot close or exit normally, you can kill it by giving following command:

# kill -9 <pid-number>

Where pid-number= Process ID number

You can get the process ID number by giving the following command:

# ps -ef


root         1     0  0 Jun08 ?        00:00:02 init [2]
root         2     0  0 Jun08 ?        00:00:00 [kthreadd]
root      2334     2  0 Jun08 ?        00:00:00 [kondemand/1]
root      2408     1  0 Jun08 ?        00:00:08 /sbin/syslogd
root      2446     1  0 Jun08 ?        00:00:00 /sbin/klogd -x
root      2455 1  0 Jun08 ?        00:00:00 /usr/sbin/acpid
104       2473     1  0 Jun08 ?        00:00:06 /usr/bin/dbus-daemon --system

Say I would like to kill the acpid daemon, then I will give the following command:

# kill -9 2455

Command #5: X server issues

Say you are having a hard time starting your X server. Try the following command from a command line:

# X -configure
# X -config /root/xorg.conf.new

For more details on this issue refer to the X server troubleshooting post.

Command #6: apt and dpkg problems

Most of the times your apt-get and dpkg problems can be solved by following commands:

# apt-get -f install
# dpkg --configure -a

For more details on Debian package management troubleshooting, please refer to the APT-GET and DPKG comprehensive guide.

Command #7: Create a quick test environment

To quickly create a test system on your existing system, just like a sandbox, give the following command:

# debootstrap --arch i386 lenny /home/kushalk/chroots/debian32 http://ftp.us.debian.org/debian

For more details on Debian’s debootstrap mechanism please refer to the following bootstrapping guide.

Command #8: Reload your GNOME environment

Sometimes you may notice that your GNOME desktop is not loading properly i.e. your icons are missing or your panel is not showing up. The following command will reload your entire GNOME desktop without having to restart your system.

# killall gnome-panel nautilus

Command #9: Switching to single user mode

Many time certain problems can only be solved in “single” user mode which is something similar to the equivalent of Windows “Safe mode”. You can easily switch to the single user run-level mode anytime by giving the following command:

# init 1

Command #10: GNOME sounds

If you are not able to hear GNOME sound events but are able to listen to music on your Linux system, give the following command:

# modprobe snd_pcm_oss

For more details on Debian’s GNOME sound/audio configuration, please refer the sound/audio comprehensive guide.

Happy commanding!

Be Sociable, Share!