The output of ls - Ubuntu
This is a discussion on The output of ls - Ubuntu ; I'm sure it has been covered, but various google attempts are not giving
me what I need to know.
The output from the ls command is churning my mind, specifically the fact
that some entries are different colours (I'm guessing ...
-
The output of ls
I'm sure it has been covered, but various google attempts are not giving
me what I need to know.
The output from the ls command is churning my mind, specifically the fact
that some entries are different colours (I'm guessing directories etc),
some are highlighted in a block and some end with an asterisk *
Anyone shed a little light on this - I know I should know, but I don't.
--
Dog walks down the road. Gust of wind. Dog inside out.
I've replaced my 'old joke' signature because a better man than me told
me to ;-)
-
Re: The output of ls
A J Hawke wrote:
> I'm sure it has been covered, but various google attempts are not giving
> me what I need to know.
> The output from the ls command is churning my mind, specifically the fact
> that some entries are different colours (I'm guessing directories etc),
> some are highlighted in a block and some end with an asterisk *
> Anyone shed a little light on this - I know I should know, but I don't.
# permissions etc.
ls -l
# file types
file *
# where the coloring comes from
alias | grep -w ls
man ls
HTH,
Niklaus
-
Re: The output of ls
Niklaus Kuehnis wrote:
> A J Hawke wrote:
>> I'm sure it has been covered, but various google attempts are not giving
>> me what I need to know.
>
>> The output from the ls command is churning my mind, specifically the fact
>> that some entries are different colours (I'm guessing directories etc),
>> some are highlighted in a block and some end with an asterisk *
>
>> Anyone shed a little light on this - I know I should know, but I don't.
>
> # permissions etc.
> ls -l
>
> # file types
> file *
>
> # where the coloring comes from
> alias | grep -w ls
> man ls
>
> HTH,
> Niklaus
Related question...
ls > directory_list; kate directory_list
Why are there control characters embedded into the newer shell output?
Apart from manually taking them out, is there a solution which will
remove them?
Later
Mike
-
Re: The output of ls
The Wizard of Oz wrote:
> Related question...
> ls > directory_list; kate directory_list
> Why are there control characters embedded into the newer shell output?
> Apart from manually taking them out, is there a solution which will
> remove them?
I can't confirm this for Ubuntu 8.04.1, using less or nano for
output.
ls > dirlist; less dirlist; nano dirlist
--
Niklaus
-
Re: The output of ls
On Fri, 11 Jul 2008 10:09:43 GMT, The Wizard of Oz wrote:
>
> Related question...
>
> ls > directory_list; kate directory_list
>
> Why are there control characters embedded into the newer shell output?
Hmm, I installed kate, tried your commands and did not see any control
characters.
alias ls has --color auto
> Apart from manually taking them out, is there a solution which will
> remove them?
man ls
or try /bin/ls > directory_list; kate directory_list
-
Re: The output of ls
On Fri, 11 Jul 2008 09:10:17 +0000, Niklaus Kuehnis wrote:
> A J Hawke wrote:
>> I'm sure it has been covered, but various google attempts are not
>> giving me what I need to know.
>
>> The output from the ls command is churning my mind, specifically the
>> fact that some entries are different colours (I'm guessing directories
>> etc), some are highlighted in a block and some end with an asterisk *
>
>> Anyone shed a little light on this - I know I should know, but I don't.
>
> # permissions etc.
> ls -l
>
> # file types
> file *
>
> # where the coloring comes from
> alias | grep -w ls
> man ls
>
> HTH,
> Niklaus
Thank you Niklas, that helped a bit (never new about file *)
There are still a couple that are confusing me.
These two (although you can't see it here) have their text reversed:
-rw-r--r-- 1 root root 165 2008-01-28 17:13 resolv.conf.rpmnew
-rw-r--r-- 1 root root 151 2008-07-11 07:37 resolv.conf.save
The YELLOW ones (which again you cant see here) end in '*':
-rwxrwxr-x 1 root root 66 2008-07-10 13:41 mcc.conf*
Directories end with a '/':
drwxr-xr-x 2 root root 4.0K 2008-03-26 20:42 kerberos/
and earlier I had some that ended with an '@', but I can't find any now.
What I have noticed is when I ssh into a Mand box, I get
the characters on the end. When I view similar files on my Ubuntu box I
don't see them. I am wondering if they are there as an extra marker in
case there is no colour running on the terminal viewing. The * marking a
file, the / a directory and the @ something else? It's the reversed text
that is getting me :-/
Incidentally, I've noticed a number of old swapfiles ending with '~'. I'm
guessing it must be safe to delete them, but I'm a little concerned how
the shell is going to interpret the tilde '~' mark.
--
Dog walks down the road. Gust of wind. Dog inside out.
I've replaced my 'old joke' signature because a better man than me told
me to ;-)
-
Re: The output of ls
A J Hawke wrote:
> On Fri, 11 Jul 2008 09:10:17 +0000, Niklaus Kuehnis wrote:
> > A J Hawke wrote:
> >> I'm sure it has been covered, but various google attempts are not
> >> giving me what I need to know.
> >
> >> The output from the ls command is churning my mind, specifically the
> >> fact that some entries are different colours (I'm guessing directories
> >> etc), some are highlighted in a block and some end with an asterisk *
> >
> >> Anyone shed a little light on this - I know I should know, but I don't.
> >
> > # permissions etc.
> > ls -l
> >
> > # file types
> > file *
> >
> > # where the coloring comes from
> > alias | grep -w ls
> > man ls
> >
> > HTH,
> > Niklaus
> Thank you Niklas, that helped a bit (never new about file *)
> There are still a couple that are confusing me.
> These two (although you can't see it here) have their text reversed:
> -rw-r--r-- 1 root root 165 2008-01-28 17:13 resolv.conf.rpmnew
> -rw-r--r-- 1 root root 151 2008-07-11 07:37 resolv.conf.save
Frankly, I don't know. What does file say?
> The YELLOW ones (which again you cant see here) end in '*':
> -rwxrwxr-x 1 root root 66 2008-07-10 13:41 mcc.conf*
Executable files: scripts or binaries.
> Directories end with a '/':
> drwxr-xr-x 2 root root 4.0K 2008-03-26 20:42 kerberos/
> and earlier I had some that ended with an '@',
A link. See /etc/rc2.d e.g.
> but I can't find any now.
> What I have noticed is when I ssh into a Mand box, I get
> the characters on the end. When I view similar files on my Ubuntu box I
> don't see them. I am wondering if they are there as an extra marker in
> case there is no colour running on the terminal viewing. The * marking a
> file, the / a directory and the @ something else? It's the reversed text
> that is getting me :-/
It all depends on your alias for ls:
ls --color
for colors
ls --classify
for appending an indicator like *@/
> Incidentally, I've noticed a number of old swapfiles ending with '~'. I'm
> guessing it must be safe to delete them, but I'm a little concerned how
> the shell is going to interpret the tilde '~' mark.
I'm not sure but it looks like the ~ is interpreted as a normal
letter in this case.
--
Niklaus
-
Re: The output of ls
On Fri, 11 Jul 2008 11:26:49 +0000, Niklaus Kuehnis wrote:
> A J Hawke wrote:
>> On Fri, 11 Jul 2008 09:10:17 +0000, Niklaus Kuehnis wrote:
>
>> > A J Hawke wrote:
>> >> I'm sure it has been covered, but various google attempts are not
>> >> giving me what I need to know.
>> >
>> >> The output from the ls command is churning my mind, specifically the
>> >> fact that some entries are different colours (I'm guessing
>> >> directories etc), some are highlighted in a block and some end with
>> >> an asterisk *
>> >
>> >> Anyone shed a little light on this - I know I should know, but I
>> >> don't.
>> >
>> > # permissions etc.
>> > ls -l
>> >
>> > # file types
>> > file *
>> >
>> > # where the coloring comes from
>> > alias | grep -w ls
>> > man ls
>> >
>> > HTH,
>> > Niklaus
>
>> Thank you Niklas, that helped a bit (never new about file *) There are
>> still a couple that are confusing me.
>
>> These two (although you can't see it here) have their text reversed:
>
>> -rw-r--r-- 1 root root 165 2008-01-28 17:13 resolv.conf.rpmnew
>> -rw-r--r-- 1 root root 151 2008-07-11 07:37 resolv.conf.save
>
> Frankly, I don't know. What does file say?
>
>> The YELLOW ones (which again you cant see here) end in '*': -rwxrwxr-x
>> 1 root root 66 2008-07-10 13:41 mcc.conf*
>
> Executable files: scripts or binaries.
>
>> Directories end with a '/':
>> drwxr-xr-x 2 root root 4.0K 2008-03-26 20:42 kerberos/
>
>> and earlier I had some that ended with an '@',
>
> A link. See /etc/rc2.d e.g.
>
>> but I can't find any now.
>> What I have noticed is when I ssh into a Mand box, I get
>> the characters on the end. When I view similar files on my Ubuntu box I
>> don't see them. I am wondering if they are there as an extra marker in
>> case there is no colour running on the terminal viewing. The * marking
>> a file, the / a directory and the @ something else? It's the reversed
>> text that is getting me :-/
>
> It all depends on your alias for ls:
> ls --color
> for colors
> ls --classify
> for appending an indicator like *@/
>
>> Incidentally, I've noticed a number of old swapfiles ending with '~'.
>> I'm guessing it must be safe to delete them, but I'm a little concerned
>> how the shell is going to interpret the tilde '~' mark.
>
> I'm not sure but it looks like the ~ is interpreted as a normal letter
> in this case.
Thanks Niklaus, with your response and a look at /etc/DIR_COLORS it now
makes sense. It appears that ls --classify runs when I am logged in to
another machine via SSH.
It's one of those funny things you ignore until you sit and think about
it ;-)
--
Dog walks down the road. Gust of wind. Dog inside out.
I've replaced my 'old joke' signature because a better man than me told
me to ;-)
-
Re: The output of ls
A J Hawke wrote:
>
> Thanks Niklaus, with your response and a look at /etc/DIR_COLORS it now
> makes sense. It appears that ls --classify runs when I am logged in to
> another machine via SSH.
You're very welcome.
--
Niklaus
-
Re: The output of ls
On Fri, 11 Jul 2008 12:08:05 +0000, Niklaus Kuehnis wrote:
> A J Hawke wrote:
>>
>> Thanks Niklaus, with your response and a look at /etc/DIR_COLORS it now
>> makes sense. It appears that ls --classify runs when I am logged in to
>> another machine via SSH.
>
> You're very welcome.
That is, the /DIR_COLORS on the remote mandrakedriva machine - I've not
found the equivalent on Ubuntu yet, but it will be there somewhere :-)
--
Dog walks down the road. Gust of wind. Dog inside out.
I've replaced my 'old joke' signature because a better man than me told
me to ;-)
-
Re: The output of ls
A J Hawke wrote:
> On Fri, 11 Jul 2008 12:08:05 +0000, Niklaus Kuehnis wrote:
> > A J Hawke wrote:
> >>
> >> Thanks Niklaus, with your response and a look at /etc/DIR_COLORS it now
> >> makes sense. It appears that ls --classify runs when I am logged in to
> >> another machine via SSH.
> >
> > You're very welcome.
> That is, the /DIR_COLORS on the remote mandrakedriva machine - I've not
> found the equivalent on Ubuntu yet, but it will be there somewhere :-)
Me neither, actually. But there are /usr/bin/dircolors and $LS_COLORS
(which seems to be empty here).
I don't use colors because I feel it'd take forever to set them up.
;-)
--
Niklaus
-
Re: The output of ls
On Fri, 11 Jul 2008 12:18:57 +0000, Niklaus Kuehnis wrote:
> A J Hawke wrote:
>> On Fri, 11 Jul 2008 12:08:05 +0000, Niklaus Kuehnis wrote:
>
>> > A J Hawke wrote:
>> >>
>> >> Thanks Niklaus, with your response and a look at /etc/DIR_COLORS it
>> >> now makes sense. It appears that ls --classify runs when I am logged
>> >> in to another machine via SSH.
>> >
>> > You're very welcome.
>
>> That is, the /DIR_COLORS on the remote mandrakedriva machine - I've not
>> found the equivalent on Ubuntu yet, but it will be there somewhere :-)
>
> Me neither, actually. But there are /usr/bin/dircolors and $LS_COLORS
> (which seems to be empty here).
>
> I don't use colors because I feel it'd take forever to set them up. ;-)
seems this is how you do it;
http://ubuntuforums.org/showthread.php?t=41538
--
Dog walks down the road. Gust of wind. Dog inside out.
I've replaced my 'old joke' signature because a better man than me told
me to ;-)
-
Re: The output of ls
* The Wizard of Oz peremptorily fired off this memo:
> ls > directory_list; kate directory_list
>
> Why are there control characters embedded into the newer shell output?
> Apart from manually taking them out, is there a solution which will
> remove them?
ls --color=never
By the way, the colors can be modified (and new colored filetypes added)
in /etc/DIR_COLORS.
I use white characters on a blue background to mark Microsoft formats,
for example.
--
Where's the man could ease a heart like a satin gown?
-- Dorothy Parker, "The Satin Dress"
-
Re: The output of ls
On Fri, 11 Jul 2008 14:46:46 -0400, Linonut wrote:
> * The Wizard of Oz peremptorily fired off this memo:
>
>> ls > directory_list; kate directory_list
>>
>> Why are there control characters embedded into the newer shell
output?
>> Apart from manually taking them out, is there a solution which will
>> remove them?
>
> ls --color=never
>
> By the way, the colors can be modified (and new colored filetypes added)
> in /etc/DIR_COLORS.
>
> I use white characters on a blue background to mark Microsoft formats,
> for example.
Ubuntu does not seem to have /etc/DIR_COLORS by default - it gets the
colour information from elsewhere. Following the link above resolves
that.
--
Dog walks down the road. Gust of wind. Dog inside out.
I've replaced my 'old joke' signature because a better man than me told
me to ;-)
-
Re: The output of ls
On 2008-07-11, A J Hawke wrote:
> I'm sure it has been covered, but various google attempts are not giving
> me what I need to know.
>
> The output from the ls command is churning my mind, specifically the fact
> that some entries are different colours (I'm guessing directories etc),
> some are highlighted in a block and some end with an asterisk *
>
> Anyone shed a little light on this - I know I should know, but I don't.
>
This might shed a bit of light:
alias ls
and try running /bin/ls instead of ls.
--
-
Re: The output of ls
On 2008-07-11, The Wizard of Oz wrote:
> Niklaus Kuehnis wrote:
>> A J Hawke wrote:
>>> I'm sure it has been covered, but various google attempts are not giving
>>> me what I need to know.
>>
>>> The output from the ls command is churning my mind, specifically the fact
>>> that some entries are different colours (I'm guessing directories etc),
>>> some are highlighted in a block and some end with an asterisk *
>>
>>> Anyone shed a little light on this - I know I should know, but I don't.
>>
>> # permissions etc.
>> ls -l
>>
>> # file types
>> file *
>>
>> # where the coloring comes from
>> alias | grep -w ls
>> man ls
>>
>> HTH,
>> Niklaus
>
> Related question...
>
> ls > directory_list; kate directory_list
>
> Why are there control characters embedded into the newer shell output?
> Apart from manually taking them out, is there a solution which will
> remove them?
The obvious possibility is that the names of some of your files have
control characters; other than that, I would not be able to explain
this [1], unless your ls is not what you think it is - if you suspect
that, try:
/bin/ls
If that does the same thing, check that it is a valid ls and not, e.g.,
placed there by a root kit. If you don't know how to check, ask here.
[1] I don't believe the "alias ls" options (color, etc.) should take effect
if the output is redirected.
--
-
Re: The output of ls
Niklaus Kuehnis wrote:
> The Wizard of Oz wrote:
>> Related question...
>
>> ls > directory_list; kate directory_list
>
>> Why are there control characters embedded into the newer shell output?
>> Apart from manually taking them out, is there a solution which will
>> remove them?
>
> I can't confirm this for Ubuntu 8.04.1, using less or nano for
> output.
>
> ls > dirlist; less dirlist; nano dirlist
>
Actually nano won't show control characters.
For those who recommended /bin/ls... It worked. It seems the old ls if
redirected to a file removed control characters associated with some
options but the new one doesn't. Accessing it directly avoids any alias
set up elsewhere and therefore doesn't include the control characters.
Later
Mike
-
Re: The output of ls
Jim Cochrane wrote:
> [1] I don't believe the "alias ls" options (color, etc.) should take effect
> if the output is redirected.
I believe they should:
$ ls --color | less
ESC[01;32mbunzip2ESC[0m*
ESC[01;32mbzcatESC[0m*
ESC[01;36mbzcmpESC[0m@
ESC[01;32mbzdiffESC[0m*
ESC[01;36mbzegrepESC[0m@
$ ls | less
bash*
bunzip2*
bzcat*
bzcmp@
bzdiff*
bzegrep@
--
Niklaus
-
Re: The output of ls
The Wizard of Oz wrote:
>
> For those who recommended /bin/ls... It worked. It seems the old ls if
> redirected to a file removed control characters associated with some
> options but the new one doesn't. Accessing it directly avoids any alias
> set up elsewhere and therefore doesn't include the control characters.
Also try \ls
(seems to call /bin/ls, too)
--
Niklaus
-
Re: The output of ls
Niklaus Kuehnis wrote:
> The Wizard of Oz wrote:
>> For those who recommended /bin/ls... It worked. It seems the old ls if
>> redirected to a file removed control characters associated with some
>> options but the new one doesn't. Accessing it directly avoids any alias
>> set up elsewhere and therefore doesn't include the control characters.
>
> Also try \ls
> (seems to call /bin/ls, too)
>
Confirmed.
Later
Mike