Siirry pääsisältöön
  • Tee tilauksia nopeasti ja helposti
  • Tarkastele tilauksia ja seuraa lähetyksen tilaa
  • Luo tuoteluettelo ja käytä sitä

Introduction to Basic Troubleshooting Terminal Commands in Ubuntu Linux

Yhteenveto: The following article provides an introduction about basic troubleshooting commands in Terminal for Ubuntu Linux.

Tämä artikkeli koskee tuotetta Tämä artikkeli ei koske tuotetta Tämä artikkeli ei liity tiettyyn tuotteeseen. Tässä artikkelissa ei yksilöidä kaikkia tuoteversioita.

Oireet

Table of Contents:

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

Introduction

 

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

The most common ways of opening a Terminal window in Ubuntu Linux are:

  • Use the desktop search function to look for terminal, command, or prompt and it brings up the Terminal window as a search result.
  • If you use the menus to locate it, most versions of Linux put it in the same location as the other application launchers.
  • The following keyboard shortcut works across most Ubuntu revisions, and the other types of Linux. Press the CTRL + Alt + T keys down simultaneously.

See the following article if you are looking for a tutorial on general terminal commands:

See the following reference article if you were after a list of the most common commands:

Syy

Examples of basic troubleshooting commands within Terminal and how to use them

 

This list provides basic Terminal commands within Ubuntu Linux. It gives examples of how they can be used to help troubleshoot specific issues with your computer.

  • 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. It 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:~$

  • 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 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$

  • The command lspci lists all devices that are found on the Peripheral Component Interconnect (PCI) bus:

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

    Using the lspci command with the additional commands of cat and grep helps to isolate specific PCI devices, as with 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$

  • 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 drivers or mods are loaded in the kernel, you can use the cat and grep command. When used with lsmod to search for specific mod files, you can see 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$

  • Use the command lsusb to list all the USB devices that are 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 with 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$

  • 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 lists 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$

Tarkkuus

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

 

The following table lists the more basic commands that are used within Linux for troubleshooting purposes. It gives the function and syntax for each:

Command Function Syntax
sudo Used before a command to run as root or an administrator. sudo apt-get update
ls Same as dir; lists the current directory. ls-ll
cp Copy the file. cp /dir/filename /dir/filename
rm Delete the file. rm /dir/filename /dir/filename
mv Move the file. mv /dir/filename /dir/filename
mkdir Make a directory. mkdir /dirname
df Report the disk space usage of the file system. df -h
dmesg Print or control the kernel ring buffer. dmesg
lspci List all the PCI devices. lspci
lsusb List all the USB devices. lsusb
lsmod Show the status of the modules in the Linux kernel. lsmod
cat Concatenate files and print on the standard output. cat /dir/logfile
grep Print lines of the input matching a specified pattern. grep intel
apt-get Update the installer. apt-get update, or apt-get upgrade
sosreport A utility that collects configuration and diagnostic information about your computer. The utility must be installed first using the following command line: "sudo apt-get install sosreport." It is recommended you reboot your computer 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 your Dell computer, you can contact us from Dell's Support Website.

Artikkelin ominaisuudet
Artikkelin numero: 000123974
Artikkelin tyyppi: Solution
Viimeksi muutettu: 17 marrask. 2023
Versio:  7
Etsi vastauksia kysymyksiisi muilta Dell-käyttäjiltä
Tukipalvelut
Tarkista, kuuluuko laitteesi tukipalveluiden piiriin.