Re: Taming the "lsblk" command

2019-01-10 Thread Michael Stone

On Wed, Jan 09, 2019 at 06:45:22PM -0600, David Wright wrote:

So, looking at the OP, is the order of sdc a temporary state of
affairs, produced by adding partitions to sdc while sde is plugged in
and blocking the sequence? (I've never seen one letter split.)



Or is it quite normal when you reach fifteen partitions? I can
understand that the devices seem to be assigned in blocks of sixteen,
but I slightly surprised that they would be assigned in a broken
sequence when they all present at boot time.


Historically the device numbers were assigned statically:
  8 block   SCSI disk devices (0-15)
  0 = /dev/sda  First SCSI disk whole disk
 16 = /dev/sdb  Second SCSI disk whole disk
 32 = /dev/sdc  Third SCSI disk whole disk
...
240 = /dev/sdp  Sixteenth SCSI disk whole disk

There was a 15 partition limit. Now you can get more, but they're 
assigned dynamically, outside of the historic scheme.



And surely sr0, sitting there in the middle, has a completely
different major number from sdX.


Because scsi cdroms are a completely different device type than scsi 
disks.




Re: Taming the "lsblk" command

2019-01-09 Thread David Wright
On Wed 09 Jan 2019 at 16:36:16 (-0500), Michael Stone wrote:
> On Wed, Jan 09, 2019 at 12:45:02PM -0600, David Wright wrote:
> > But returning to lsblk, I can't figure out why the OP's lsblk -l
> > appears in such an odd order. Does it differ from that given by
> > lsblk with no arguments?
> > 
> > I've checked the unsorted order of my /sys/dev/block, which is
> > essentially random, as is the order of block devices in the output
> > of mount, yet lsblk gives me a nice sorted lists:
> 
> Without -x it's sorting in device major:minor order, which happens to
> be alphabetical in your install purely by chance.

So, looking at the OP, is the order of sdc a temporary state of
affairs, produced by adding partitions to sdc while sde is plugged in
and blocking the sequence? (I've never seen one letter split.)

Or is it quite normal when you reach fifteen partitions? I can
understand that the devices seem to be assigned in blocks of sixteen,
but I slightly surprised that they would be assigned in a broken
sequence when they all present at boot time.

And surely sr0, sitting there in the middle, has a completely
different major number from sdX.

OP's report:

However when I do
 > lsblk -l -o name,label
I get
 > sdc14 good-fvwm
 > sdc15 tst_mysql
 > sde
 > sde1  debian-2-go
 > sr0
 > sdc16 tst_mariadb
 > sdc17 dummy
 > sdc18 target

Cheers,
David.



Re: Taming the "lsblk" command

2019-01-09 Thread Michael Stone

On Wed, Jan 09, 2019 at 12:45:02PM -0600, David Wright wrote:

But returning to lsblk, I can't figure out why the OP's lsblk -l
appears in such an odd order. Does it differ from that given by
lsblk with no arguments?

I've checked the unsorted order of my /sys/dev/block, which is
essentially random, as is the order of block devices in the output
of mount, yet lsblk gives me a nice sorted lists:


Without -x it's sorting in device major:minor order, which happens to be 
alphabetical in your install purely by chance.




Re: Taming the "lsblk" command

2019-01-09 Thread David Wright
On Wed 09 Jan 2019 at 16:13:19 (+), mick crane wrote:
> On 2019-01-09 14:14, David Wright wrote:
> > On Wed 09 Jan 2019 at 13:54:45 (+), Curt wrote:
> > > On 2019-01-09, rhkra...@gmail.com  wrote:
> > > > On Wednesday, January 09, 2019 03:01:42 AM Richard Hector wrote:
> > > >> On 9/01/19 6:04 PM, Jude DaShiell wrote:
> > > >> > lsblk -l -o name,label | sort | script
> > > >>
> > > >> lsblk -ln -o name,label |sort | 

Re: Taming the "lsblk" command

2019-01-09 Thread Curt
On 2019-01-09, Richard Owlett  wrote:
> On 01/09/2019 08:14 AM, David Wright wrote:
>> On Wed 09 Jan 2019 at 13:54:45 (+), Curt wrote:
>>> On 2019-01-09, rhkra...@gmail.com  wrote:
 On Wednesday, January 09, 2019 03:01:42 AM Richard Hector wrote:
> On 9/01/19 6:04 PM, Jude DaShiell wrote:
>> lsblk -l -o name,label | sort | script
>
> lsblk -ln -o name,label |sort | 

Re: Taming the "lsblk" command

2019-01-09 Thread mick crane

On 2019-01-09 14:14, David Wright wrote:

On Wed 09 Jan 2019 at 13:54:45 (+), Curt wrote:

On 2019-01-09, rhkra...@gmail.com  wrote:
> On Wednesday, January 09, 2019 03:01:42 AM Richard Hector wrote:
>> On 9/01/19 6:04 PM, Jude DaShiell wrote:
>> > lsblk -l -o name,label | sort | script
>>
>> lsblk -ln -o name,label |sort | 

Re: Taming the "lsblk" command

2019-01-09 Thread Richard Owlett

On 01/09/2019 08:14 AM, David Wright wrote:

On Wed 09 Jan 2019 at 13:54:45 (+), Curt wrote:

On 2019-01-09, rhkra...@gmail.com  wrote:

On Wednesday, January 09, 2019 03:01:42 AM Richard Hector wrote:

On 9/01/19 6:04 PM, Jude DaShiell wrote:

lsblk -l -o name,label | sort | script


lsblk -ln -o name,label |sort | 

Re: Taming the "lsblk" command

2019-01-09 Thread David Wright
On Wed 09 Jan 2019 at 07:51:31 (-0500), Felix Miata wrote:
> Jude DaShiell composed on 2019-01-09 06:48 (UTC-0500):
> 
> > Felix Miata wrote:
> 
> >> Jude DaShiell composed on 2019-01-09 00:04 (UTC-0500):
> 
> >>> lsblk -l -o name,label | sort | script
> 
> >> I tried exactly that on Buster multiple times, and always get the 
> >> following:
> 
> >> root@gb250:~# NAME  LABEL
> >> bash: NAME: command not found
> >> root@gb250:~# sda
> >> bash: sda: command not found
> >> root@gb250:~# sda10 k25p10deb10
> >> bash: sda10: command not found
> >> root@gb250:~# sda11 k25p11deb10fat
> >> bash: sda11: command not found
> ...
> >> root@gb250:~# sda8  k25p08s150
> >> bash: sda8: command not found
> >> root@gb250:~# sda9  k25p09s151
> >> bash: sda9: command not found
> >> root@gb250:~# sr0
> >> bash: sr0: command not found
> >> root@gb250:~# exit
> 
> > That can happen if bash doesn't find sort in its default binary
> > directory.  Could be pointing bash directly at sort will clear the
> > command not found error out of the output.
> 
> # cat /etc/debian_version
> buster/sid
> # which sort
> /usr/bin/sort
> # which script
> /usr/bin/script
> 
> Same result from:
> 
>   lsblk -l -o name,label | /usr/bin/sort | /usr/bin/script

You've attempted to run a shell using the output of lsblk as a series
of commands for it to execute.

Cheers,
David.



Re: Taming the "lsblk" command

2019-01-09 Thread David Wright
On Wed 09 Jan 2019 at 13:54:45 (+), Curt wrote:
> On 2019-01-09, rhkra...@gmail.com  wrote:
> > On Wednesday, January 09, 2019 03:01:42 AM Richard Hector wrote:
> >> On 9/01/19 6:04 PM, Jude DaShiell wrote:
> >> > lsblk -l -o name,label | sort | script
> >> 
> >> lsblk -ln -o name,label |sort | 

Re: Taming the "lsblk" command

2019-01-09 Thread Curt
On 2019-01-09, rhkra...@gmail.com  wrote:
> On Wednesday, January 09, 2019 03:01:42 AM Richard Hector wrote:
>> On 9/01/19 6:04 PM, Jude DaShiell wrote:
>> > lsblk -l -o name,label | sort | script
>> 
>> lsblk -ln -o name,label |sort | 

Re: Taming the "lsblk" command

2019-01-09 Thread rhkramer
On Wednesday, January 09, 2019 03:01:42 AM Richard Hector wrote:
> On 9/01/19 6:04 PM, Jude DaShiell wrote:
> > lsblk -l -o name,label | sort | script
> 
> lsblk -ln -o name,label |sort | 

Re: Taming the "lsblk" command

2019-01-09 Thread Felix Miata
Jude DaShiell composed on 2019-01-09 06:48 (UTC-0500):

> Felix Miata wrote:

>> Jude DaShiell composed on 2019-01-09 00:04 (UTC-0500):

>>> lsblk -l -o name,label | sort | script

>> I tried exactly that on Buster multiple times, and always get the following:

>> root@gb250:~# NAME  LABEL
>> bash: NAME: command not found
>> root@gb250:~# sda
>> bash: sda: command not found
>> root@gb250:~# sda10 k25p10deb10
>> bash: sda10: command not found
>> root@gb250:~# sda11 k25p11deb10fat
>> bash: sda11: command not found
...
>> root@gb250:~# sda8  k25p08s150
>> bash: sda8: command not found
>> root@gb250:~# sda9  k25p09s151
>> bash: sda9: command not found
>> root@gb250:~# sr0
>> bash: sr0: command not found
>> root@gb250:~# exit

> That can happen if bash doesn't find sort in its default binary
> directory.  Could be pointing bash directly at sort will clear the
> command not found error out of the output.

# cat /etc/debian_version
buster/sid
# which sort
/usr/bin/sort
# which script
/usr/bin/script

Same result from:

lsblk -l -o name,label | /usr/bin/sort | /usr/bin/script
-- 
Evolution as taught in public schools is religion, not science.

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/



Re: Taming the "lsblk" command

2019-01-09 Thread Jude DaShiell
On Wed, 9 Jan 2019, Felix Miata wrote:

> Date: Wed, 9 Jan 2019 01:47:24
> From: Felix Miata 
> To: debian-user@lists.debian.org
> Subject: Re: Taming the "lsblk" command
> Resent-Date: Wed,  9 Jan 2019 06:47:41 + (UTC)
> Resent-From: debian-user@lists.debian.org
>
> Jude DaShiell composed on 2019-01-09 00:04 (UTC-0500):
>
> > lsblk -l -o name,label | sort | script
>
> I tried exactly that on Buster multiple times, and always get the following:
>
> root@gb250:~# NAME  LABEL
> bash: NAME: command not found
> root@gb250:~# sda
> bash: sda: command not found
> root@gb250:~# sda10 k25p10deb10
> bash: sda10: command not found
> root@gb250:~# sda11 k25p11deb10fat
> bash: sda11: command not found
> root@gb250:~# sda12 k25p12Ubionic
> bash: sda12: command not found
> root@gb250:~# sda13
> bash: sda13: command not found
> root@gb250:~# sda14
> bash: sda14: command not found
> root@gb250:~# sda15
> bash: sda15: command not found
> root@gb250:~# sda16
> bash: sda16: command not found
> root@gb250:~# sda1  K25P01ESP
> bash: sda1: command not found
> root@gb250:~# sda2  k25p02swap
> bash: sda2: command not found
> root@gb250:~# sda3  k25p03res
> bash: sda3: command not found
> root@gb250:~# sda4  k25p04usrlcl
> bash: sda4: command not found
> root@gb250:~# sda5  k25p05home
> bash: sda5: command not found
> root@gb250:~# sda6  k25p06pub
> bash: sda6: command not found
> root@gb250:~# sda7  k25p07stw
> bash: sda7: command not found
> root@gb250:~# sda8  k25p08s150
> bash: sda8: command not found
> root@gb250:~# sda9  k25p09s151
> bash: sda9: command not found
> root@gb250:~# sr0
> bash: sr0: command not found
> root@gb250:~# exit
>
That can happen if bash doesn't find sort in its default binary
directory.  Could be pointing bash directly at sort will clear the
command not found error out of the output.

-- 



Re: Taming the "lsblk" command

2019-01-09 Thread Richard Hector
On 9/01/19 6:04 PM, Jude DaShiell wrote:
> lsblk -l -o name,label | sort | script

lsblk -ln -o name,label |sort | 

Re: Taming the "lsblk" command

2019-01-08 Thread Bob McGowan

On 1/8/19 10:47 PM, Felix Miata wrote:

Jude DaShiell composed on 2019-01-09 00:04 (UTC-0500):


lsblk -l -o name,label | sort | script

I tried exactly that on Buster multiple times, and always get the following:

root@gb250:~# NAME  LABEL
bash: NAME: command not found
root@gb250:~# sda
bash: sda: command not found
root@gb250:~# sda10 k25p10deb10
bash: sda10: command not found
root@gb250:~# sda11 k25p11deb10fat
bash: sda11: command not found
root@gb250:~# sda12 k25p12Ubionic
bash: sda12: command not found
root@gb250:~# sda13
bash: sda13: command not found
root@gb250:~# sda14
bash: sda14: command not found
root@gb250:~# sda15
bash: sda15: command not found
root@gb250:~# sda16
bash: sda16: command not found
root@gb250:~# sda1  K25P01ESP
bash: sda1: command not found
root@gb250:~# sda2  k25p02swap
bash: sda2: command not found
root@gb250:~# sda3  k25p03res
bash: sda3: command not found
root@gb250:~# sda4  k25p04usrlcl
bash: sda4: command not found
root@gb250:~# sda5  k25p05home
bash: sda5: command not found
root@gb250:~# sda6  k25p06pub
bash: sda6: command not found
root@gb250:~# sda7  k25p07stw
bash: sda7: command not found
root@gb250:~# sda8  k25p08s150
bash: sda8: command not found
root@gb250:~# sda9  k25p09s151
bash: sda9: command not found
root@gb250:~# sr0
bash: sr0: command not found
root@gb250:~# exit


What was the content of the script you piped to?  Its design would 
possibly explain this.


Bob



Re: Taming the "lsblk" command

2019-01-08 Thread Felix Miata
Jude DaShiell composed on 2019-01-09 00:04 (UTC-0500):

> lsblk -l -o name,label | sort | script

I tried exactly that on Buster multiple times, and always get the following:

root@gb250:~# NAME  LABEL
bash: NAME: command not found
root@gb250:~# sda
bash: sda: command not found
root@gb250:~# sda10 k25p10deb10
bash: sda10: command not found
root@gb250:~# sda11 k25p11deb10fat
bash: sda11: command not found
root@gb250:~# sda12 k25p12Ubionic
bash: sda12: command not found
root@gb250:~# sda13
bash: sda13: command not found
root@gb250:~# sda14
bash: sda14: command not found
root@gb250:~# sda15
bash: sda15: command not found
root@gb250:~# sda16
bash: sda16: command not found
root@gb250:~# sda1  K25P01ESP
bash: sda1: command not found
root@gb250:~# sda2  k25p02swap
bash: sda2: command not found
root@gb250:~# sda3  k25p03res
bash: sda3: command not found
root@gb250:~# sda4  k25p04usrlcl
bash: sda4: command not found
root@gb250:~# sda5  k25p05home
bash: sda5: command not found
root@gb250:~# sda6  k25p06pub
bash: sda6: command not found
root@gb250:~# sda7  k25p07stw
bash: sda7: command not found
root@gb250:~# sda8  k25p08s150
bash: sda8: command not found
root@gb250:~# sda9  k25p09s151
bash: sda9: command not found
root@gb250:~# sr0
bash: sr0: command not found
root@gb250:~# exit
-- 
Evolution as taught in public schools is religion, not science.

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/



Re: Taming the "lsblk" command

2019-01-08 Thread Richard Owlett

DUH ;/
I was so focused on lsblk demonstrating with its graphical output that 
it COULD do what I wanted that I didn't think about an external sort,

Thank you



On 01/08/2019 11:04 PM, Jude DaShiell wrote:

lsblk -l -o name,label | sort | script
On Tue, 8 Jan 2019, Richard Owlett
wrote:


Date: Tue, 8 Jan 2019 15:56:39
From: Richard Owlett 
To: debian-user 
Subject: Taming the "lsblk" command
Resent-Date: Tue,  8 Jan 2019 20:57:05 + (UTC)
Resent-From: debian-user@lists.debian.org

When I do
  >lsblk -o name,label
I get a nice graphical result in _STRICT_  *ALPHA_NUMERIC* order.

However when I do > lsblk -l -o name,label
I get > sdc14 good-fvwm
  > sdc15 tst_mysql
  > sde
  > sde1  debian-2-go
  > sr0
  > sdc16 tst_mariadb
  > sdc17 dummy
  > sdc18 target

I wish to feed the output of "lsblk -l -o name,label" to a script which
*DEPENDS* on input being in strict alpha-numeric order.

How?
TIA












Re: Taming the "lsblk" command

2019-01-08 Thread Jude DaShiell
lsblk -l -o name,label | sort | script
On Tue, 8 Jan 2019, Richard Owlett
wrote:

> Date: Tue, 8 Jan 2019 15:56:39
> From: Richard Owlett 
> To: debian-user 
> Subject: Taming the "lsblk" command
> Resent-Date: Tue,  8 Jan 2019 20:57:05 + (UTC)
> Resent-From: debian-user@lists.debian.org
>
> When I do
>  >lsblk -o name,label
> I get a nice graphical result in _STRICT_  *ALPHA_NUMERIC* order.
>
> However when I do > lsblk -l -o name,label
> I get > sdc14 good-fvwm
>  > sdc15 tst_mysql
>  > sde
>  > sde1  debian-2-go
>  > sr0
>  > sdc16 tst_mariadb
>  > sdc17 dummy
>  > sdc18 target
>
> I wish to feed the output of "lsblk -l -o name,label" to a script which
> *DEPENDS* on input being in strict alpha-numeric order.
>
> How?
> TIA
>
>
>
>
>

-- 



Re: Taming the "lsblk" command

2019-01-08 Thread Reco
Hi.

On Tue, Jan 08, 2019 at 02:56:39PM -0600, Richard Owlett wrote:
> I wish to feed the output of "lsblk -l -o name,label" to a script which 
> *DEPENDS* on input being in strict alpha-numeric order.
> 
> How?

lsblk(8):

lsblk -l -x name -o name,label

Reco



Taming the "lsblk" command

2019-01-08 Thread Richard Owlett

When I do
 >lsblk -o name,label
I get a nice graphical result in _STRICT_  *ALPHA_NUMERIC* order.

However when I do > lsblk -l -o name,label
I get > sdc14 good-fvwm
 > sdc15 tst_mysql
 > sde
 > sde1  debian-2-go
 > sr0
 > sdc16 tst_mariadb
 > sdc17 dummy
 > sdc18 target

I wish to feed the output of "lsblk -l -o name,label" to a script which 
*DEPENDS* on input being in strict alpha-numeric order.


How?
TIA