home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 16.8 The ls -d Option Chapter 16
Where Did I Put That?
Next: 16.10 findcmd: Find a Command in Your Search Path
 

16.9 An Alias to List Recently Changed Files

Looking for a recently changed file? Not sure of the name? Trying to do this in a directory with lots of files? Try the lr alias:

alias lr "ls -lagFqt \!* | head"

The alias takes advantage of the -t option (16.2 ) to ls , so that recent files can float to the top of the listing. head (25.20 ) shows just the first ten lines.

A simple lr in my home directory gives me:

bermuda:home/dansmith :-) lr


total 1616
-rw-------  1 dansmith staff      445092 Oct  7 20:11 .mush256
-rw-r--r--  1 dansmith staff        1762 Oct  7 20:11 .history
drwxr-xr-x 30 dansmith staff        1024 Oct  7 12:59 text/
-rw-------  1 dansmith staff      201389 Oct  7 12:42 .record
drwxr-xr-x 31 dansmith staff        1024 Oct  4 09:41 src/
-rw-r--r--  1 dansmith staff        4284 Oct  4 09:02 .mushrc
   ...

You can also give a wildcarded pattern, in order to narrow the search. For example, here's the command to show me the dot files that have changed lately:

.??*
 




bermuda:home/dansmith :-) lr .??*


-rw-------  1 dansmith staff      445092 Oct  7 20:11 .mush256
-rw-r--r--  1 dansmith staff        1762 Oct  7 20:11 .history
-rw-------  1 dansmith staff      201389 Oct  7 12:42 .record
-rw-r--r--  1 dansmith staff        4284 Oct  4 09:02 .mushrc
   ...

- DS


Previous: 16.8 The ls -d Option UNIX Power Tools Next: 16.10 findcmd: Find a Command in Your Search Path
16.8 The ls -d Option Book Index 16.10 findcmd: Find a Command in Your Search Path

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System