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?
lsin/etc/bash.bashrcfor 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 thelscommand; if this is happening under the hood on you without you knowing thenlsoutput can sometimes not make sense and be confusing (i.e. why is this happening)ls -1should 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 -1is 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:20lsis a bad idea, andls -1is 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:55lsis 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 lsorman lsifls --helpdoes not help – axxis Jul 20 '18 at 12:40