2

I hope this is the right place to ask this question. So basically, I'm currently combing through some of the more commonly used Terminal commands, and I find it really hard to remember the short form flags vs. the long form flags.

For example,

ls -a

is much harder to remember for me than

ls --all

Obviously, this is trivial to remember for one flag, but given the number of programs executable through the shell and the available flags for each program, it becomes really, really hard to commit these to memory.

However, when I search through the man pages, for example,

man ls

The docs don't show the long form flags. For example, this is what I get

-1      (The numeric digit ``one''.)  Force output to be one entry per
             line.  This is the default when output is not to a terminal.

-A      List all entries except for . and ...  Always set for the super-
             user.

-a      Include directory entries whose names begin with a dot (.).

I'm looking for something like this webpage:

http://manpages.ubuntu.com/manpages/xenial/en/man1/ls.1.html

-a, --all
          do not ignore entries starting with .

-A, --almost-all
          do not list implied . and ..

--author
          with -l, print the author of each file

but accessible offline.

I'm using MacOS, and running man through Terminal - are there any alternative manuals that do show the long form flags? I'd really appreciate it if someone could point me in the right direction.

Thanks!

1 Answer 1

1

The tool in general is man.

Ubuntu ls implementation is different than the one of macOS. If ls --all works for you but the man page in your OS doesn't list long options, then it will be wise to treat them as undocumented features that may stop working or change their meaning in the future.

Note that POSIX specifies only short options for ls. Preferring them over their long equivalents (if any) makes your "ls skill" more portable.

When checking if ls --all really works, do not confuse it with ls -all. The latter should be equivalent to ls -a -l -l, i.e. ls -a -l; it uses short options only and it will work in any POSIX-compliant system.

1
  • I see - thank you for your answer. I think I'll consult the pages with the long form flags when learning, but use short flags during implementation, while keeping in mind what you said - that these MacOS ≠ Ubuntu and short forms are preferred. I checked and ls --all didn't work in Terminal. :) Nov 6, 2017 at 14:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .