- To: slug@xxxxxxxxxxx
- Subject: Re: [SLUG] useful bash tricks thread
- From: Gavin Carr <gavin@xxxxxxxxxxxxxxxxx>
- Date: Mon, 9 Feb 2009 08:37:06 +1100
- Organisation: Open Fusion
- User-agent: Mutt/1.5.17 (2007-11-01)
On Fri, Feb 06, 2009 at 09:06:25PM +1100, Tony Sceats wrote:
> It's been a while since there's been a thread like this, so I thought it
> would be fun :)
>
> so, have you got any?
I'm fond of the -t flag to ls, which orders by mtime desc. I have
these defined in my .bashrc:
lead() {
ls -lt $* | head -20
}
which is combination ls+head, giving you back the 20 most recently
modified items in your current (or given) directory; and:
alias l1='ls -t | head -1'
which gives you back the filename of the most recently modified
object. I use this all the time with `` e.g.
# Create an invoice
invoice companyX
# Check it (the newest file) in evince
evince `l1`
Cheers,
Gavin