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 1

Use ls with options -a (to include listing 'dot' files), -1 (to list filename on each line of output) and -t (to list in order of modification time). Pipe this output to head, with option -n 3 (to select the first three lines in the list):

ls -1at | head -n 3

Copyright © 2002 Mike Joy, Stephen Jarvis and Michael Luck