ls command refuses to use multi-column

Joined
Aug 6, 2011
Messages
7
Reaction score
0
Points
1
Hey all,

New here. Was trying to add colors to my ls output, and went about doing the following:

cd ~/
vim .bash_profile (new file, didn't exist)
Code:
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx

alias ls='ls -F"
source ~/.bash_profile

Seemed to work well, except the output was a single entry per line - not what I was hoping for.

Ofcourse I then resulted in removing the alias line and re-running the source thing. This simply removed the cool extras that -F adds to the output of ls.

I then decided to create a new user on my mac, and then did the exact same as above except without the alias part - worked great, multi-column output with colors.

Now my main account seems stuffed, and I really don't want to resort to "migrating" or using iTerm2 as a "I failed" solution.

Any help would be truly appreciated. I'm sure its a profile setting I can override, or re-apply the original default.

BTW: ls -C does not work either on my main account.

Running MAC OS X Leopard 10.5.8

Many thanks
Doug
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
all -F does it show a / after a directory name. Column printing for ls is default, so ls and ls -C should be identical in a terminal window. What are you trying to accomplish, and what's going on now? Please post an example
 
OP
D
Joined
Aug 6, 2011
Messages
7
Reaction score
0
Points
1
Seems this issue is only related to my home directory (~/) as other directories correctly display a multi-column output. Note pictures attached:

Picture1: My ~/.bash_profile

Picture2: executing ls in my home directory (~/)

Picture3: executing ls in another directory

As you can see in Picture2, the output is single line - not sure if this is a bug?

If there is no "fix" for this home directory issue, then not to bothered by it. When I posted the request, I hadn't tested ls in other directories.

Picture 2.png

Picture 3.png
 

Attachments

  • Picture 1.png
    Picture 1.png
    21.2 KB · Views: 24
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
Ok, I have a couple questions for you.

1) was the behavior as expected before modifying your bash_profile?
2) have you reloaded your profile since changing it?
3) was the test in another directory in another terminal session, perhaps started after the test in ~/ ?
 
OP
D
Joined
Aug 6, 2011
Messages
7
Reaction score
0
Points
1
1) Yup, before I modified (created) bash_profile, my home directory (~/) would always output to multi-column when issuing ls command
2) I've rebooted my MAC, still the same.
3) nope, tests where done in the same terminal, same tab, same session. Additionally, if I issue an 'ls -C' or 'ls -x' even, the output is still single entry per line in my home directory
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
Very interesting. I've never seen that behavior. Let me to test on my wifes macbook, she's running Lion.. I'm not.
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
Ok, it's almost like you have an alias somewhere to ls as ls -C1, which will give you the identical output you're experiencing. Why this would be ONLY in the home directory, I have no idea.

Maybe do grep 'ls -C1' .* in your home and see if that returns anything?
 
OP
D
Joined
Aug 6, 2011
Messages
7
Reaction score
0
Points
1
only thing that seems to return is .viminfo, which has

Code:
.viminfo:	alias ls='ls'

And nothing in /etc

Tried doing a grep for "ls", "ls -", "ls -C1" as well as "ls -1"
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
and which ls returns with /bin/ls I'm assuming?

Odd, not something I've seen on my systems. I'll have to putz with it, unfortunately I've got a hard stop in a bit as we've got a family outing this evening :)
 
OP
D
Joined
Aug 6, 2011
Messages
7
Reaction score
0
Points
1
when using /bin/ls in ~/, the same result, single entry per line, however, any other directory - no problem ;-)

Very strange issue indeed - have a feeling that
Code:
alias ls='ls -F'
is the culprit, but just no idea how to resolve.

No problem - its bed time for me anyway.
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
Hash it out for now, then . ./.bash_profile

see if that does it :)
 
OP
D
Joined
Aug 6, 2011
Messages
7
Reaction score
0
Points
1
Wish it were that easy. I have since deleted the alias line and then run . .bash_history, still the same result.
 
Joined
Aug 20, 2011
Messages
1
Reaction score
0
Points
1
I was having the same problem this morning, and did a search for an answer and ended up here... but while messing with it found out what was causing the problem... and from there you can decide how to fix it.

Pretty much this is what has caused this for me... in my home folder, there were a couple of saved URL's that had long TITLEs. The span on these, and other files, being very wide, made it so that when I did a multi column listing, it wasn't able to list more than one column because the long titles took up the span of available space. I figured this out by stretching the terminal window across the screen and doing the ls -aFG command. I noticed that there were some long items. I went into my home directory and took care of those long file names, and then going back to terminal, I was able to do the command, and then was able to achieve the desired results :D.

I think this is why it was working for you in other directories, because you're probably not saving long file named items there?

This is my first post to the forums, and I just signed up because I thought that this might be the answer to your problems :)

Either way... Hello forums!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top