shell-novice
shell-novice copied to clipboard
Add Additional information for the "ls -l" command
In Section 2 Navigating Files and Directories Under "Exploring More ls Flags"
There is a question - "What does the command ls do when used with the -l option?" The solution states - "The -l option makes ls use a long listing format, showing not only the file/directory names but also additional information such as the file size and the time of its last modification."
Since the command returns file permission information as well as file size and modification date/time, I think the former should be noted
File permission is not covered in this module but it's good to give the user early exposure to this concept. Plus it will confuse them to see that info without a short explanation.
I found this explanation on file permission:
"The first character shows the file type. The next nine characters are showing the file permissions. The first three characters are for the user, the next three are for the group, and the last three are for others. • r - Permission to read the file. • w - Permission to write to the file. • x - Permission to execute the file."
Linuxize. Nov 7, 2020. Ls Command in Linux (List Files and Directories). Retrieved from https://linuxize.com/post/how-to-list-files-in-linux-using-the-ls-command/
Thanks for raising this issue. It's a bit tricky because currently the lesson kinda glosses over this information, albeit with a brief note:
Some of its output is about properties that we do not cover in this lesson (such as file permissions and ownership), but the rest should be useful nevertheless.
However to explain the long format there are lots of concepts which are difficult to do quickly but don't really need covering at all in this novice lesson:
- permissions
- read
- write
- execute
- number of hard links to the file
- hard vs soft links
- groups
- file ownership
I'd like input from others whether we should add any further information about the concepts we don't really want to cover.
I agree, file permissions, explaining groups, ownerships and symbolic links is a whole different topic to itself in this lesson. Including them in Navigating Files and Directories will only confuse the learners.
What I feel would be interesting to add here is including alias for the ls -l command. Introducing the learner to ll command will be a great addition to this topic because it simplifies the command's complexity of using the -l flag and will also introduce the users to the topic of aliasing in Unix.
When I was teaching this section, I was asked about the extra outputs of "$ls -l" and I briefly explained them. I think introducing them in detail will confuse the learners as mentioned by [gcapes]. Regarding [thummv] comment about introducing aliases, I agree it can be useful to have an extra section for this, but here, we are introducing [options] and [arguments] for commands and I think we should only focus on that instead of teaching them shortcuts :)
Introducing the learner to ll command will be a great addition to this topic because it simplifies the command's complexity of using the -l flag and will also introduce the users to the topic of aliasing in Unix.
I personally use the ll
command a lot! But I'm not sure it's appropriate to bring up in this lesson because:
- Requires introducing the
alias
concept - Requires introducing the
.bashrc
and/or.bash_profile
scripts and their purpose - Not all OS' come with the
ll
alias e.g. I believe some Mac OS' don't come with it.
ll
would surely be useful for the learner at some stage, but it could introduce a few questions at once. As @foadfarivar pointed out, teaching the main concepts and core tools is probably more important.
Regarding more information on the output of ls -l
:
I'd like input from others whether we should add any further information about the concepts we don't really want to cover.
I think it would be useful to for the learner to know what the columns are, just because there's no headings or anything. At least providing some meaning to the noise could reduce confusion. It could perhaps be accompanied by a note highlighting that the details would be out of scope for the lesson.