PDA

View Full Version : ls; more than just for listing files


mongre26
27th February 2004, 03:26 AM
Everyone who has used Linux or Unix for a while will be fairly familiary with the ls(1) command.

Since ls is pretty much synonomous with list it seems developers have taken the idea of an "ls" command to be used to list other information about the system.

lspci (8) shows a list of the pci devices and their names (if available).

Eg.

# /sbin/lspci
00:00.0 Host bridge: Intel Corp. E7205 Memory Controller Hub (rev 03)
00:01.0 PCI bridge: Intel Corp. E7000 Series Processor to AGP Controller (rev 03)
00:1d.0 USB Controller: Intel Corp. 82801DB USB (Hub #1) (rev 02)
00:1d.1 USB Controller: Intel Corp. 82801DB USB (Hub #2) (rev 02)
00:1d.2 USB Controller: Intel Corp. 82801DB USB (Hub #3) (rev 02)
00:1d.7 USB Controller: Intel Corp. 82801DB USB2 (rev 02)
00:1e.0 PCI bridge: Intel Corp. 82801BA/CA/DB/EB PCI Bridge (rev 82)
00:1f.0 ISA bridge: Intel Corp. 82801DB LPC Interface Controller (rev 02)
00:1f.1 IDE interface: Intel Corp. 82801DB Ultra ATA Storage Controller (rev 02)
00:1f.5 Multimedia audio controller: Intel Corp. 82801DB AC'97 Audio Controller (rev 02)
01:00.0 VGA compatible controller: nVidia Corporation NV18 [GeForce4 MX 440 AGP 8x] (rev a2)
02:03.0 FireWire (IEEE 1394): Texas Instruments TSB43AB22/A IEEE-1394a-2000 Controller (PHY/Link)
02:04.0 RAID bus controller: CMD Technology Inc Silicon Image SiI 3112 SATARaid Controller (rev 01)
02:05.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5702 Gigabit Ethernet (rev 02)

--

lsraid(8) displays information about a software raid device (md)

# lsraid -p
[dev 9, 0] /dev/md0 E331D06E.A0EA7AB5.0699B4B5.AA7F4DCA online
[dev 8, 1] /dev/sda1 E331D06E.A0EA7AB5.0699B4B5.AA7F4DCA good
[dev 8, 17] /dev/sdb1 E331D06E.A0EA7AB5.0699B4B5.AA7F4DCA good

[dev 9, 2] /dev/md2 471674C0.46E98336.648DAABC.4754B2C5 online
[dev 8, 3] /dev/sda3 471674C0.46E98336.648DAABC.4754B2C5 good
[dev 8, 19] /dev/sdb3 471674C0.46E98336.648DAABC.4754B2C5 good

[dev 9, 1] /dev/md1 92649849.DF1EAF8D.DD2C7041.568CB1FF online
[dev 8, 4] /dev/sda4 92649849.DF1EAF8D.DD2C7041.568CB1FF good
[dev 8, 20] /dev/sdb4 92649849.DF1EAF8D.DD2C7041.568CB1FF good

--

lsmod(8) List out the currently loaded kernel modules

# /sbin/lsmod
Module Size Used by Tainted: P
iptable_filter 2444 0 (autoclean) (unused)
loop 12184 3 (autoclean)
nls_iso8859-1 3516 1 (autoclean)
nls_cp437 5148 0 (autoclean)
vfat 12716 0 (autoclean)
fat 39352 0 (autoclean) [vfat]
ipt_LOG 4344 0 (autoclean)
ipt_limit 1688 0 (autoclean)
ide-cd 34560 0 (autoclean)
cdrom 35008 0 (autoclean) [ide-cd]
i810_audio 28872 3 (autoclean)
ac97_codec 16940 0 (autoclean) [i810_audio]
soundcore 7044 2 (autoclean) [i810_audio]
nvidia 1765632 11 (autoclean)
ip_tables 15776 3 [iptable_filter ipt_LOG ipt_limit]
parport_pc 18884 1 (autoclean)
lp 8772 0 (autoclean)
parport 39072 1 (autoclean) [parport_pc lp]
autofs 12500 0 (autoclean) (unused)
tg3 56808 1
microcode 4736 0 (autoclean)
floppy 58268 0 (autoclean)
sg 36396 0 (autoclean)
sd_mod 13452 0 (autoclean)
usb-storage 71296 0
scsi_mod 113704 3 [sg sd_mod usb-storage]
ohci1394 29544 0 (unused)
ieee1394 208164 0 [ohci1394]
keybdev 2656 0 (unused)
mousedev 5432 1
hid 23972 0 (unused)
input 6208 0 [keybdev mousedev hid]
ehci-hcd 20488 0 (unused)
usb-uhci 27180 0 (unused)
usbcore 82560 1 [usb-storage hid ehci-hcd usb-uhci]
ext3 74148 2
jbd 55560 2 [ext3]

--

lsusb(8) Display information about USB buses


# /sbin/lsusb
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 002 Device 002: ID 05ac:9101 Apple Computer, Inc.
Bus 002 Device 003: ID 05ac:9118 Apple Computer, Inc.
Bus 002 Device 004: ID 05ac:1002 Apple Computer, Inc. Apple Extended Keyboard Hub [Mitsumi]
Bus 002 Device 007: ID 05ac:0204 Apple Computer, Inc.
Bus 002 Device 008: ID 067b:2515 Prolific Technology, Inc.
Bus 002 Device 009: ID 067b:2517 Prolific Technology, Inc.
Bus 002 Device 005: ID 045e:0040 Microsoft Corp. Wheel Mouse Optical
Bus 002 Device 006: ID 05ac:9218 Apple Computer, Inc.
Bus 001 Device 001: ID 0000:0000


Note: All of the above commands are on Fedora Core 1.

Note: There are also additional "ls" commands, type "ls" the hit tab twice in bash as root to get a list.

Bana
27th February 2004, 05:58 AM
Good Work mongre26! I didn't know any of that, if only I had earlier... :p

mhelios
27th February 2004, 06:18 AM
Thank you for your article mongre26. I hope you don't mind, I went through and added a few tags for readability enhancements.

mongre26
27th February 2004, 09:56 PM
I do not mind the edits at all, I will almost certainly use them in the future myself. :)

Ug
27th February 2004, 10:20 PM
Thanks for that info. ;)

Aileu - Tijucas - Gudur Travel Photos