newer: Print the Name of the Newest File (Unix Power Tools, 3rd Edition)
8.15. newer: Print the Name of the Newest File
Here's a quick alias
that figures out which file in a group is the newest:
-d Section 8.5
alias newer "ls -dt \!* | head -1"
If your system doesn't have a head ( Section 12.12) command, use sed 1q
instead.
For example, let's say that you have two files named
plan.v1 and plan.v2. If
you're like me, you (often) edit the wrong version
by mistake -- and then, a few hours later, can't
remember what you did. You can use this alias to figure out which
file you changed most recently:
% newer plan.v*
plan.v1
I could also have used command
substitution (Section 28.14) to handle this
in one step:
% emacs `newer plan.*`
-- ML
8.14. Listing Files by Age and Size8.16. oldlinks: Find Unconnected Symbolic Links
Copyright © 2003 O'Reilly & Associates. All rights reserved.
Wyszukiwarka
Podobne podstrony:
ch08ch08ch08ch08ch08ch08ch08CH08ch08ch08 (17)ch08ch08ch08ch08ch08ch08CH08więcej podobnych podstron