On Wed, Oct 03, 2018 at 12:01:02PM +, Virgo Pärna wrote:
> On Thu, 27 Sep 2018 09:14:00 -0400, Greg Wooledge wrote:
> > But also note that using ls -l gives a completely wrong answer.
> >
> > wooledg:~$ mkdir /tmp/x && cd "$_"
> > wooledg:/tmp/x$ touch $'this\nis\none\nfile'
> > wooledg:/tmp/x
On Thu, 27 Sep 2018 09:14:00 -0400, Greg Wooledge wrote:
> But also note that using ls -l gives a completely wrong answer.
>
> wooledg:~$ mkdir /tmp/x && cd "$_"
> wooledg:/tmp/x$ touch $'this\nis\none\nfile'
> wooledg:/tmp/x$ ls -l | wc -l
> 5
>
What about 'ls -1b | wc -l'?
--
Virgo Pä
On 29/09/18 12:21 AM, Greg Wooledge wrote:
> On Fri, Sep 28, 2018 at 09:06:59AM +0200, Ionel Mugurel Ciobîcă wrote:
>> On 28-09-2018, at 17h 52'07", Richard Hector wrote about "Re: question about
>> ls"
>>> Eww. Tab completion also gets screwed u
On Fri, Sep 28, 2018 at 09:06:59AM +0200, Ionel Mugurel Ciobîcă wrote:
> On 28-09-2018, at 17h 52'07", Richard Hector wrote about "Re: question about
> ls"
> > Eww. Tab completion also gets screwed up by this:
> >
> > richard@zircon:~/test$ rm
>
On Fri, Sep 28, 2018 at 08:58:05AM +0200, to...@tuxteam.de wrote:
ls should be considered a user interface, not an API.
One should strive to minimize these differences, though. This is, of
course, just my opinion, but you can pry... (you know the rest ;-)
Sure you can--you use find. There are
On 28-09-2018, at 17h 52'07", Richard Hector wrote about "Re: question about ls"
>
> Eww. Tab completion also gets screwed up by this:
>
> richard@zircon:~/test$ rm
> file isone this
>
> .. but you can't actually complete from any of thos
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Thu, Sep 27, 2018 at 11:03:29AM -0400, Michael Stone wrote:
[...]
> ls should be considered a user interface, not an API.
One should strive to minimize these differences, though. This is, of
course, just my opinion, but you can pry... (you know t
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Thu, Sep 27, 2018 at 09:59:58AM -0400, Greg Wooledge wrote:
> On Thu, Sep 27, 2018 at 08:53:28AM -0500, David Wright wrote:
> > On Thu 27 Sep 2018 at 07:55:56 (-0500), Kent West wrote:
> > > westk@westkbox:/opt$ ls -la | wc
> > > 7 56
On 28/09/18 1:14 AM, Greg Wooledge wrote:
> On Thu, Sep 27, 2018 at 07:55:56AM -0500, Kent West wrote:
>> But also note the difference when using the letter "l" vs the numeral "1":
>>
>> westk@westkbox:/opt$ ls -la | wc
>> 7 56 321
>> westk@westkbox:/opt$ ls -1a | wc
>> 6 6
On Thu, Sep 27, 2018 at 10:57:56AM -0400, Gene Heskett wrote:
> On Thursday 27 September 2018 08:31:27 Greg Wooledge wrote:
>
> > On Tue, Sep 25, 2018 at 10:27:03PM +, Long Wind wrote:
> > > can ls show number of items in a folder?Thanks!
> >
> > https://mywiki.wooledge.org/BashFAQ/004
>
> An
On Thu, Sep 27, 2018 at 09:59:58AM -0400, Greg Wooledge wrote:
All of the above give the wrong answers when filenames contain newlines.
Any solution that involves printing the filenames to a stream and then
trying to parse that stream to guess how many filenames are in the stream
is a non-starter
On Thursday 27 September 2018 08:31:27 Greg Wooledge wrote:
> On Tue, Sep 25, 2018 at 10:27:03PM +, Long Wind wrote:
> > can ls show number of items in a folder?Thanks!
>
> https://mywiki.wooledge.org/BashFAQ/004
And finally, an "ls -l|wc -l" from the cli gives the answer to the
question ask
On Thu 27 Sep 2018 at 09:59:58 (-0400), Greg Wooledge wrote:
> On Thu, Sep 27, 2018 at 08:53:28AM -0500, David Wright wrote:
> > On Thu 27 Sep 2018 at 07:55:56 (-0500), Kent West wrote:
> > > westk@westkbox:/opt$ ls -la | wc
> > > 7 56 321
> > > westk@westkbox:/opt$ ls -1a | wc
> > >
On Thu, Sep 27, 2018 at 08:53:28AM -0500, David Wright wrote:
> On Thu 27 Sep 2018 at 07:55:56 (-0500), Kent West wrote:
> > westk@westkbox:/opt$ ls -la | wc
> > 7 56 321
> > westk@westkbox:/opt$ ls -1a | wc
> > 6 6 54
>
> But do use 1A, not 1a, if you want to know ho
On Thu 27 Sep 2018 at 07:55:56 (-0500), Kent West wrote:
> On Tue, Sep 25, 2018 at 6:14 PM Ben Caradoc-Davies wrote:
>
> > On 26/09/2018 10:55, Long Wind wrote:
> > > sorry! you're right.
> > > after checking ls manual, i find ls has option -1
> >
> > Note also that ls will behave like it has the
On Thu, Sep 27, 2018 at 07:55:56AM -0500, Kent West wrote:
> But also note the difference when using the letter "l" vs the numeral "1":
>
> westk@westkbox:/opt$ ls -la | wc
> 7 56 321
> westk@westkbox:/opt$ ls -1a | wc
> 6 6 54
But also note that using ls -l gives a
On Tue, Sep 25, 2018 at 6:14 PM Ben Caradoc-Davies wrote:
> On 26/09/2018 10:55, Long Wind wrote:
> > sorry! you're right.
> > after checking ls manual, i find ls has option -1
>
> Note also that ls will behave like it has the "-1" option if its output
> is piped to another command, even without
On Tue, Sep 25, 2018 at 10:27:03PM +, Long Wind wrote:
> can ls show number of items in a folder?Thanks!
https://mywiki.wooledge.org/BashFAQ/004
On 26/09/2018 10:55, Long Wind wrote:
sorry! you're right.
after checking ls manual, i find ls has option -1
Note also that ls will behave like it has the "-1" option if its output
is piped to another command, even without this option. I like to use the
"-1" option even in this case because i
On 26/09/2018 10:27, Long Wind wrote:
can ls show number of items in a folder?Thanks!
I use:
ls -1 | wc -l
To include items whose names start with ".", add the "a" or "A" argument
to ls ("man ls" for details).
For more advanced searches (recursive or filtering on file type), I use
find.
20 matches
Mail list logo