Skip to content

Instantly share code, notes, and snippets.

@landon9720
Created June 14, 2012 21:07
Show Gist options
  • Save landon9720/2932955 to your computer and use it in GitHub Desktop.
Save landon9720/2932955 to your computer and use it in GitHub Desktop.
the most recent file in the current directory is ...
#!/bin/bash
ls -lrt | awk '{ f=$NF }; END{ print f }'
@aji
Copy link

aji commented Jun 14, 2012

why not just ls -t | head -1

@landon9720
Copy link
Author

This alias works well, too:

alias lastf="ls -lrt | awk '{ f=$NF }; END{ print f }'"

@landon9720
Copy link
Author

That's awesome! Thanks. How did you find this?

@aji
Copy link

aji commented Jun 14, 2012

It was a public gist and was under the "All Gists" list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment