In my current directory, I execute the command:
ls -1
and it gives a list of the current directory contents.
In the same directory, I repeat the command: ls
and it gives me the same result, with perhaps a different formatted output.
Finally, I try to find out about the available commands by typing ls --help
and the output is:
usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]
It looks like the last option is 1
(#1). Can someone explain what the ls -1
does and how it's different to the standard ls
command?
ls
in/etc/bash.bashrc
for example, and also has an environment variable "LS_OPTIONS" and they use some options I do not care for so I manually comment out any aliasing of thels
command; if this is happening under the hood on you without you knowing thenls
output can sometimes not make sense and be confusing (i.e. why is this happening)ls -1
should simply output one column but only if some other option is not overriding or preventing it from happening – ron Jul 19 '18 at 14:03ls -1
is often used by shell scripts to ensure there is minimal information and one file per line to make processing file names easy. – Mark Stewart Jul 19 '18 at 14:20ls
is a bad idea, andls -1
is the default when the output isn’t a terminal (which is the case when the output is supposed to be processed in a script). – Stephen Kitt Jul 19 '18 at 17:55ls
is a bad idea, and you are right; forgot about that being the default when STDOUT is not a terminal. – Mark Stewart Jul 19 '18 at 19:10info ls
orman ls
ifls --help
does not help – axxis Jul 20 '18 at 12:40