Skip to main content

All Questions

Tagged with
0 votes
1 answer
1k views

Creating an alias for the find command in Linux

I have created the following alias in my .bashrc file: alias find='find . -type f -name' This obviates the need to type . -type f -name every time I do a file search. However, I still have to enclose ...
Edman's user avatar
  • 512
1 vote
2 answers
255 views

Aliasing grep in find's -exec option

I have these aliases in my ~/.bashrc alias grep='grep --color=auto -H' alias fgrep='fgrep --color=auto -H' alias egrep='egrep --color=auto -H' but they have no effect when I run find ... -exec grep .....
Enlico's user avatar
  • 1,677
-1 votes
2 answers
384 views

alias the find function and use it with sudo [duplicate]

I'm having trouble creating an alias so I can run find in "silent mode" (without all the Permission denied messages). my bash skills are pretty bad so I'm not sure how to fix this here's my alias in ~...
ChumiestBucket's user avatar
2 votes
2 answers
297 views

find - how do i make an alias to do something like (find . -iname '*$1*')?

I have a findn function: findn () { find . -iname "*$1*" } Using this function has one downside that I cannot use -print0 | xargs -0 command (I am using mac) following findn filename to extend ...
Teddy C's user avatar
  • 457
0 votes
2 answers
1k views

find exec does not work with command aliases?

I'm trying to do a find with a -exec of a command aliased in my .bash_profile on macOS. The find command shows find: [alias cmd]: No such file or directory when I use find ./ -iname *.doc -exec ...
wesinat0r's user avatar
1 vote
2 answers
285 views

How do I update this recursive directory file search for input and name outputs to handle the below case

I am updating a script that recursively goes through a directory and ocrs the pdf and updates the pdf. In its simple version, it works. ocrmypdf -l vie --deskew --clean --force-ocr --sidecar ...
pleasemarkdarkly's user avatar
0 votes
1 answer
158 views

How can I improve below alias?

I want to run less -F command on latest updated log file of one binary (which creates logs with names which start with xtest*) which is in logs directory. I was able to create below alias in csh, but ...
BreakBadSP's user avatar
0 votes
1 answer
312 views

Always exclude path in find command

I have a directory whose contents should never be found by find, so I aliased find like this: alias find='find -not -path "*.sync*"' the issue is that find now complains that operators are not ...
xeruf's user avatar
  • 571
3 votes
1 answer
3k views

Odd alias "find . -name '*\!{*}*' -ls" in Unix Power Tools

From Unix Power Tools 3rd Edition page 175: Article 9.27 shows a way to match directories in the middle of a path. Here's a simpler "find file" alias that can come in very handy: alias ff &...
Wildcard's user avatar
  • 36.7k
3 votes
2 answers
440 views

How to alias part of expression for find?

I prefer regular expressions with -regex over the shell pattern syntax of -name. I also want to use the posix-egrep type, so I'd like to do something like alias find="find -regextype posix-egrep" ...
labyrinth's user avatar
  • 743
1 vote
2 answers
634 views

find command throws errors when inside function

I can run the following command in bash without any errors: $ find /d/Code/Web/Development/Source/ \( -name '*.cs' -o -name '*.cshtml' \) -exec grep -IH UserProfileModel {} \; I wrote a function in ....
Big McLargeHuge's user avatar
2 votes
1 answer
899 views

Error creating an alias for the find command [duplicate]

Possible Duplicate: How to pass parameter to alias? I am trying to shorten the find command, but getting an error: $ alias f='find . -name $1 -print' $ f JobConf.java find: paths must precede ...
Praveen Sripati's user avatar
1 vote
3 answers
2k views

A problem with find and grep

I have defined the following alias in ~/.bashrc: alias fg='find . -name $1 | xargs grep --color $2' in order to write fg "*.txt" " my_text " and find all file that have extension .txt and ...
Narek's user avatar
  • 127