Main index

Introducing UNIX and Linux


Files

Overview
The UNIX directory hierarchy
Filesystems
Manipulating files
      Creating directories
      Creating files
      links
      'Dot' files
Protecting files
      Groups
      File access control
      Changing privileges
File contents
      Text files
      Comparing files
      Filtering files
      Non-text files
Printing files
File archives and file compression
Other relevant commands
Summary
Exercises

Answer to chapter 5 question 7

Use ls with option -l, and pipe the output to sort. Since the fifth field is the field which is to be used for sorting comparisons, argument +4 should be given to sort (the fields are counted starting from 0). The sort should be according to numerical order rather than lexical, so sort requires option -n also:

ls -l | sort -n +4

Copyright © 2002 Mike Joy, Stephen Jarvis and Michael Luck