Knowledge Base

Introduction to basic troubleshooting commands within Ubuntu Linux



The following article provides an introduction to basic troubleshooting commands within Ubuntu Linux.


Table of Contents :

  1. Introduction
  2. Examples of basic troubleshooting commands within Ubuntu Linux and how to use them
  3. A list of basic troubleshooting commands and their function within Ubuntu Linux

1. Introduction

The following article deals with basic troubleshooting commands in terminal on an Ubuntu operating system.

If you were looking for a tutorial on general terminal commands, check out the article below:

If you were after a list of the most common commands, check out the reference below:


Back to Top


2. Examples of basic troubleshooting commands within Ubuntu Linux and how to use them

The following lists provides basic text commands within Ubuntu Linux and provides examples of how they can be used to help troubleshoot specific issues with your computer.

  1. Use the command uname to show what kernel is being used. The kernel is the first section of the operating system to load into memory, and controls such system areas as disk drive management, memory allocation, system processes, and interrupt handler. In the example below, the kernel being used is 3.11.0-15-generic:

    user@avalon:~$ uname -a
    Linux avalon 3.11.0-15-generic #23-Ubuntu SMP Mon Dec 9 18:17:04 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
    user@avalon:~$
  2. Use the command dmesg to show the contents of the boot log. This is a good way to find errors at startup:

    user@avalon:~/linux101$ sudo dmesg > dmesg.log

    In the example below, the command cat can be used with dmesg to join together the contents of the log file. The additional command grep can be used to show any instance of a particular file name occurring in the log, for example either Intel or error:

    user@avalon:~/linux101$ cat dmesg.log | grep intel
    [ 1.732400] intel_idle: MWAIT substates: 0x21120
    [ 1.732402] intel_idle: v0.4 model 0x3A
    [ 1.732405] intel_idle: lapic_timer_reliable_states 0xffffffff
    [ 10.148411] fbcon: inteldrmfb (fb0) is primary device
    [ 10.922434] i915 0000:00:02.0: fb0 inteldrmfb frame buffer device
    [ 10.926448] snd_hda_intel 0000:00:1b.0: irq 50 for MSI/MSI-X
    user@avalon:~/linux101$

    user@avalon:~/linux101$ cat dmesg.log | grep error
    [ 7.478502] EXT4-fs (sda2): re-mounted. Opts: errors=remount-ro
    user@avalon:~/linux101$
  3. The command lspci lists all devices found on the PCI bus:

    user@avalon:~/linux101$ sudo lspci > lspci.log

    Using the lspci command with the additional commands of cat and grep will help to isolate specific PCI devices, as in the case of Realtek below:

    user@avalon:~/linux101$ cat lspci.log | grep Realtek
    07:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. TRL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 07)
    09:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader (rev 01)
    09:00.1 SD Host controller: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader (rev 01)
    user@avalon~/linux101$
  4. Use the command lsmod to list all the loaded mod files within the kernel:

    user@avalon:~/linux101$ sudo lsmod > lsmod.log
    user@avalon:~linux101$

    In Linux, the driver files are loaded as mods. To see which driver/mods are loaded in the kernel, you can use the cat and grep command with lsmod to search for specific mod files, as in the two examples with Dell and hda below:

    user@avalon:~/linux101$ cat lsmod.log | grep dell
    dell_wmi 12761 0
    sparse_keymap 13948 1 dell_wmi
    dell_laptop 17369 0
    dcdbas 14847 1 dell_laptop
    wmi 19070 1 dell_wmi
    user@avalon:~/linux101$

    user@avalon:~/linux101$ cat lsmod.log | grep hda
    snd_hda_codec_hdmi 41117 1
    snd_hda_codec_realtek 55704 1
    snd_hda_intel 48171 3
    snd_hda_codec 188738 3 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_intel
    snd_hwdep 13602 1 snd_hda_codec
    snd_pcm 102033 3 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel
    snd_page_alloc 18710 2 snd_pcm,snd_hda_intel
    snd 69141 17 snd_hda)codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_seq,snd_rawmidi,snd_hda_codec,snd_hda_intel,snd_seq,device,snd_seq_midi
    user@avalon:~/linux101$
  5. Use the command lsusb to list all the USB devices connected to the USB bus:

    user@avalon:~/linux101$ sudo lsusb > lsusb.log
    user@avalon:~linux101$

    You can use this command with the additional cat and grep commands to isolate specific USB devices, as in the case of Intel below:

    user@avalon:~/linux101$ cat lsusb.log | grep Intel
    Bus 002 Device 003: ID 8087:07da Intel Corp.
    Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
    Bus 001 DEvice 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hib
    user@avalon:~/linux101$
  6. Use the ifconfig command to set and query your computer's network settings:

    user@avalon:~/linux101$ ifconfig > ifconfig.log
    user@avalon:~/linux101$

    You can use this command with the additional cat and grep commands to search for inet, which will list your computer's IP addresses:

    user@avalon:~/linux101$ cat ifconfig.log | grep inet
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    inet addr:192.168.1.90 Bcast:192.168.1.255 Mask:255.255.255.0
    inet6 addr: fe80::caf7:33ff:fedb:b2bc/64 Scope:Link
    user@avalon:~/linux101$


Back to Top


3. A list of basic troubleshooting commands and their function within Ubuntu Linux

The following table lists some of the more basic commands used within Linux for troubleshooting purposes, as well as giving the function and syntax for each:

Command Function Syntax
sudo Used before a command to run as root, or administrator. sudo apt-get update
ls Same as "dir"; lists the current directory. ls-ll
cp Copy file. cp /dir/filename /dir/filename
rm Delete file. rm /dir/filename /dir/filename
mv Move file. mv /dir/filename /dir/filename
mkdir Make a directory. mkdir /dirname
df Report file system disk space usage. df -h
dmesg Print or control the kernel ring buffer. dmesg
lspci Lists all PCI devices. lspci
lsusb Lists all USB devices. lsusb
lsmod Shows the status of modules in the Linux kernel. lsmod
cat Concatenate files and print on the standard output. cat /dir/logfile
grep Print lines of input matching a specified pattern. grep intel
apt-get Update installer. apt-get update, or apt-get upgrade
sosreport A utility that collects configuration and diagnostic information about your system. The utility needs to be installed first using the following command line: "sudo apt-get install sosreport". It is recommended you reboot your system after the install before first running the utility. sosreport
"cat" and "grep" together Use to list all the instances of a specific search item. cat /dir/logfile | grep intel (the output of this command would print to the default output source any instance of the string "intel")

For additional help troubleshooting Linux on your Dell computer, you can search the Knowledge Library at Dell's Support Website.


Back to Top





Article ID: SLN289410

Last Date Modified: 11/30/2016 08:07 AM


Rate this article

Accurate
Useful
Easy to understand
Was this article helpful?
Yes No
Send us feedback
Comments cannot contain these special characters: <>()\
Sorry, our feedback system is currently down. Please try again later.

Thank you for your feedback.