New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ls -F needs more explanation #644

Open
weisi-chen opened this Issue Oct 25, 2017 · 7 comments

Comments

Projects
None yet
8 participants
@weisi-chen

weisi-chen commented Oct 25, 2017

ls -F (more explanation on why use -F is needed)

@gcapes

This comment has been minimized.

Contributor

gcapes commented Oct 25, 2017

I'd say it's fine as it is. Have you seen this (from episode 2)?

ls prints the names of the files and directories in the current directory in alphabetical order, arranged neatly into columns. We can make its output more comprehensible by using the flag -F (also known as a switch or an option) , which tells ls to add a trailing / to the names of directories:

@colinmorris

This comment has been minimized.

Contributor

colinmorris commented Feb 1, 2018

One thing that might make this a little confusing is that, in the example shown in the lesson, the pwd contains only directories.

Applications/ Documents/    Library/      Music/        Public/
Desktop/      Downloads/    Movies/       Pictures/

If there were one or two files in there, it might make the usefulness of -F clearer (it lets you distinguish between directories and files at a glance):

Applications/ Documents/    Library/      mongoose.jpg    Music/    Public/ 
Desktop/      Downloads/    Movies/       Pictures/       Todo
@Lyndon18

This comment has been minimized.

Lyndon18 commented Mar 1, 2018

It may also be useful to introduce flags formally, before adding flags into the examples.

@loz-hurst

This comment has been minimized.

Contributor

loz-hurst commented Mar 21, 2018

Should it be clarified that '-F' is a general 'classify' flag? - i.e. it does not just add '/' to directories (which is the implication of the lesson text) but also adds characters to other 'special' files (e.g. '*' to executable, '@' to symlinks, '=' to sockets, '|' to pipes etc.).

I'm not suggesting introducing all these concepts, just describing '-F' as an option that classifies files rather than implying all it does is 'add / to directores' which could be mis-leading.

@raynamharris

This comment has been minimized.

raynamharris commented Apr 10, 2018

I agree. This came up during my maintainer on-boarding class. I learned that it is really a quite useful tool for folks who don't use color coding.

Also, I find the ls -F option quite useful option when combined with -a because it makes it more obvious that ./ and ../ refer to directories but agree with the folks above that it is unclear when the said directory contains only subdirectories.

@gshamov

This comment has been minimized.

gshamov commented May 1, 2018

These days, colour terminals show files, directories and links in colour. Many Linux distros actually alias ls to alias ls='ls --color=auto'

Isn't ls -F then a redundant option? (I have seen it used for first time in the lesson myself; and I am using command line for the last 20 years) Would it be more natural to introduce options to ls by using the options that are used most often (ls -la, ls -lrt)?

@loz-hurst

This comment has been minimized.

Contributor

loz-hurst commented May 2, 2018

These days, colour terminals show files, directories and links in colour. Many Linux distros actually alias ls to alias ls='ls --color=auto'

They're shown in colour if the non-default colour option is used. It really irritates me that several distributions alias things to include non-default options so the same tool (as in the same version of the same project) behaves differently. But, as we've already discussed, in another issue thread, we want to stay clear of any discussion of the nuances of different distributions. Quite how this all plays out with the other tools that have more significant differences between GNU and BSD implementations, I'm not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment