I do not know what to use as the title for this question, but here is what I am looking for:
I find myself using the command below very often to find files within a subdirectory:
$ find ./ -type d -iname "*FILE*"
One way is to create a bash script with an argument and put it somewhere (e.g., /usr/bin
).
But on some systems which I may not access those folders or maybe can not change the path,
Is there a way to create an alias?
myfind
intofind ./ -type d -iname
, thusmyfind "*FILE*"
will becomefind ./ -type d -iname "*FILE*"
. So yes, this looks like an alias taking an argument, but it's not; the "argument" is just a piece of text that doesn't get replaced and remains as-is. If you mean another argument then no, because the argument would need to appear in the middle of the resulting string. – Kamil Maciorowski Dec 11 '23 at 14:16$HOME
directory (typically$HOME/bin
), and just add that to your$PATH
. – larsks Dec 11 '23 at 14:22alias my_find='find ./ -type d -iname "*FILE*"'
to your~/.bashrc
. – terdon Dec 11 '23 at 14:29