Jump to content


ls* Commands Are Even More Useful Than You May Have Thought


  • Please log in to reply
9 replies to this topic

#1 OFFLINE   securitybreach

securitybreach

    CLI Phreak

  • Forum Admins
  • 12,867 posts

Posted 19 August 2012 - 09:35 PM

Quote

Everything is a file under Linux and ls* and friends can help you to dig out more information from the system than you originally thought. These Linux tips may come in handy when you need to find out information quickly without going through /proc or sysfs.
#1: lsscsi

See list SCSI devices (or hosts) and their attributes under Linux operating systems:
$ lsscsi -g
Sample outputs:

[0:0:0:0] disk Adaptec  RAID1-A   V1.0  /dev/sda   /dev/sg0
[0:1:0:0] disk SEAGATE  ST373455SS    0006  - /dev/sg1
[0:1:1:0] disk SEAGATE  ST373455SS    0006  - /dev/sg2
[1:0:0:0] cd/dvd  TEAC DV-28E-R 1.8A  /dev/sr0   /dev/sg3

#2: lsblk

Use this command to list block devices
# lsblk
Sample outputs:

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda   8:0 1  68.3G  0 disk
├─sda1   8:1 1   716M  0 part /boot
├─sda2   8:2 1 8G  0 part [SWAP]
└─sda3   8:3 1  59.6G  0 part /
sr0 11:0 1  1024M  0 rom

To see file system type:
# lsblk -f
Sample outputs:

NAME   FSTYPE LABEL MOUNTPOINT
sda
├─sda1 ext2 /boot
├─sda2 swap [SWAP]
└─sda3 ext4 /
sr0

#3: lsb_release

Use this command to see Linux distribution-specific information, enter:
# lsb_release
# lsb_release -a
Sample outputs:

LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 5.8 (Final)
Release: 5.8
Codename: Final................


http://www.cyberciti...mands-examples/
Posted ImagePosted Image
Posted Image π
Comhack.com/CNI Radio/Linux User #363317/G+/Configs

"Do you begin to see, then, what kind of world we are creating? It is the exact opposite of the stupid hedonistic Utopias that the old reformers imagined. A world of fear and treachery and torment, a world of trampling and being trampled upon, a world which will grow not less but more merciless as it refines itself. Progress in our world will be progress toward more pain." -George Orwell, 1984

#2 OFFLINE   ichase

ichase

    Chasing the Penguin

  • Forum MVP
  • 1,588 posts

Posted 19 August 2012 - 11:03 PM

Great post Josh.  Bookmarked to my Linux Tutorial folder.  :thumbsup:
Ian Chase

Try Parted Magic The must have tool for any linux user's tool box.  (Contains Gparted, wifi support, Clonezilla, SuperGrubDisk/2, plop bootloader and more!!!)
Arch Linux Environment Setup How-To Learn how to not only install Arch Linux but learn more about the inner workings of Linux
"I know that you believe you understand what you think I said, but I'm not sure you realize that what you heard is not what i meant."
- Robert McCloskey
Registered Linux User:  526317 10/22/2010
Posted Image  Posted Image  Posted Image Posted Image

#3 OFFLINE   securitybreach

securitybreach

    CLI Phreak

  • Forum Admins
  • 12,867 posts

Posted 19 August 2012 - 11:07 PM

View Postichase, on 19 August 2012 - 11:03 PM, said:

Great post Josh.  Bookmarked to my Linux Tutorial folder.  :thumbsup:

:thumbsup:
Posted ImagePosted Image
Posted Image π
Comhack.com/CNI Radio/Linux User #363317/G+/Configs

"Do you begin to see, then, what kind of world we are creating? It is the exact opposite of the stupid hedonistic Utopias that the old reformers imagined. A world of fear and treachery and torment, a world of trampling and being trampled upon, a world which will grow not less but more merciless as it refines itself. Progress in our world will be progress toward more pain." -George Orwell, 1984

#4 OFFLINE   V.T. Eric Layton

V.T. Eric Layton

    Nocturnal Slacker

  • Forum Admins
  • 14,863 posts

Posted 19 August 2012 - 11:26 PM

COOL! And useful, too. :)

Posted Image Posted Image Posted Image


#5 OFFLINE   securitybreach

securitybreach

    CLI Phreak

  • Forum Admins
  • 12,867 posts

Posted 19 August 2012 - 11:53 PM

View PostV.T. Eric Layton, on 19 August 2012 - 11:26 PM, said:

COOL! And useful, too. :)

Indeed B)
Posted ImagePosted Image
Posted Image π
Comhack.com/CNI Radio/Linux User #363317/G+/Configs

"Do you begin to see, then, what kind of world we are creating? It is the exact opposite of the stupid hedonistic Utopias that the old reformers imagined. A world of fear and treachery and torment, a world of trampling and being trampled upon, a world which will grow not less but more merciless as it refines itself. Progress in our world will be progress toward more pain." -George Orwell, 1984

#6 OFFLINE   LilBambi

LilBambi

    Australisches Googler

  • Forum Admins
  • 16,494 posts

Posted 20 August 2012 - 08:50 AM

'ls' is such an understated command! Many will never do more than 'ls' and so much more is possible.
Posted Image
BambisMusings Blog :: Fran's Computer Services Blog :: MyPassionIsBooks Blog :: 5BuckReview :: CNIRadio
"The Net interprets censorship as damage and routes around it." ~John Gilmore (Time Magazine, Dec 6, 1993)

#7 OFFLINE   sunrat

sunrat

    Discussion Deity

  • Forum Moderators
  • 3,581 posts

Posted 20 August 2012 - 09:41 AM

Handy list, including a few I didn't know.
Here's a really useful one I just learned: lspci -k will show which kernel modules are loaded for each piece of hardware.
roger@brain:~$ lspci -k
00:00.0 Host bridge: Intel Corporation 4 Series Chipset DRAM Controller (rev 03)
		Subsystem: Giga-byte Technology GA-EP45-DS5/GA-EG45M-DS2H Motherboard
00:01.0 PCI bridge: Intel Corporation 4 Series Chipset PCI Express Root Port (rev 03)
		Kernel driver in use: pcieport
00:1a.0 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #4
		Subsystem: Giga-byte Technology GA-EP45-DS5/GA-EG45M-DS2H Motherboard
		Kernel driver in use: uhci_hcd...................
.....................................
01:00.0 VGA compatible controller: NVIDIA Corporation GF114 [GeForce GTX 560 Ti] (rev a1)
		Subsystem: ASUSTeK Computer Inc. Device 83bf
		Kernel driver in use: nvidia
03:00.0 SATA controller: JMicron Technology Corp. JMB363 SATA/IDE Controller (rev 02)
		Subsystem: Giga-byte Technology GA-EP45-DS5 Motherboard
		Kernel driver in use: ahci
05:01.0 Multimedia audio controller: VIA Technologies Inc. ICE1712 [Envy24] PCI Multi-Channel I/O Controller (rev 02)
		Subsystem: VIA Technologies Inc. M-Audio Delta Audiophile 2496
		Kernel driver in use: snd_ice1712
05:07.0 FireWire (IEEE 1394): Texas Instruments TSB43AB23 IEEE-1394a-2000 Controller (PHY/Link)
		Subsystem: Giga-byte Technology GA-EP45-DS5/GA-EG45M-DS2H Motherboard
		Kernel driver in use: firewire_ohci

registered Linux user number 324659  || The importance of Reading The *Fine* Manual! :D
Posted ImagePosted ImagePosted Image  
Today's subliminal thought is:

#8 OFFLINE   LilBambi

LilBambi

    Australisches Googler

  • Forum Admins
  • 16,494 posts

Posted 20 August 2012 - 08:46 PM

I knew that one! But only because my Jim showed it to me many moons ago now.
Posted Image
BambisMusings Blog :: Fran's Computer Services Blog :: MyPassionIsBooks Blog :: 5BuckReview :: CNIRadio
"The Net interprets censorship as damage and routes around it." ~John Gilmore (Time Magazine, Dec 6, 1993)

#9 OFFLINE   Temmu

Temmu

    The Assimilator

  • Forum MVP
  • 9,805 posts

Posted 21 August 2012 - 01:06 AM

wow. who knew?
very good securitybreach & sunrat.
Posted Image

#10 OFFLINE   securitybreach

securitybreach

    CLI Phreak

  • Forum Admins
  • 12,867 posts

Posted 21 August 2012 - 01:32 AM

View PostTemmu, on 21 August 2012 - 01:06 AM, said:

wow. who knew?
very good securitybreach & sunrat.

Thanks, I learned a few things too B)
Posted ImagePosted Image
Posted Image π
Comhack.com/CNI Radio/Linux User #363317/G+/Configs

"Do you begin to see, then, what kind of world we are creating? It is the exact opposite of the stupid hedonistic Utopias that the old reformers imagined. A world of fear and treachery and torment, a world of trampling and being trampled upon, a world which will grow not less but more merciless as it refines itself. Progress in our world will be progress toward more pain." -George Orwell, 1984




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users