I use the following command to find large files for me to consider
deleting, compressing or offloading when I come near my quota:
ls -pal `find ~/ -size +300000c` | sort -r +3
It works like a champ, giving me a list of my files over 300K, sorted
largest to smallest. (Actually, I sometimes also pipe into more or
head to just get a further subset, but that's not material to the rest
of this post.)
I would like to set this up as an alias to, for example, a name like
"findbig". I've tried the following:
alias findbig "ls -pal `find ~/ -size +300000c` | sort -r +3"
Unfortunately, but obviously in retrospect, this executes the find at
the time I set the alias, so when I try to use my "findbig" alias, it
selects the files that were over 300K at the time I set the alias, not
at the time I execute the findbig.
(it looks something like "ls -pal path1 path2 path3 | sort -r +3")
Okay, so the backticks need to be escaped, right? Well, I tried this:
alias findbig "ls -pal \`find ~/ -size +300000c\` | sort -r +3"
Now, the alias amounts to:
ls -pal \ | sort -r +3
This has me completely confused.
I thought I might have to escape the backslash itself, but that didn't
help any. When I added 2 backslashes, one before each of the
backslashes already there, I just get:
ls -pal \\ | sort -r +3
and adding further backslashed act correspondingly.
My question is: how the heck do I specify a backticked command in an
A related question is, would it matter if I put the alias
specification in a .login or .cshrc file or a file that's sourced at
login time? (I typically include my aliases in a .alias file that is
sourced from my .cshrc)
The man page is not particularly helpful. It says
def is a list of words
that may contain escaped history-substitution metasyntax.
I realize I have to do some escaping here, but how is my mystery.
I'm running tcsh 6.06.00.
Of course, if someone has a simple way to list the names and sizes of
one's largest files without backticking, I'd be happy to use that.
But I'm still interested in why the backticking approach isn't