Solved

find command

Posted on 2002-03-13
3
161 Views
Last Modified: 2013-12-15
I want to configure my linux account so that the command  'fnd argument' is equivalent to:           'find / -name argument 2> /dev/null'    I know I should put it in .bashrc as an alias or a user-defined function, but I'm having a hard time making it work.  Does anybody know the proper syntax for doing this?  
0
Comment
Question by:alphaomega232
3 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 200 total points
Comment Utility
Try:

fnd () { find / -name $1 2>/dev/null; }

To have the command available each time you log in you'll want to include that function in your .bashrc file.
0
 
LVL 2

Expert Comment

by:fremsley
Comment Utility
Or, if you don't want to blow up your environment with
too many functions, you may create a script 'find' e.g. in
$HOME/bin like:

  #!/bin/sh
  /usr/bin/find / -name $1 2>/dev/null

and make that directory being the first one in your PATH --
at the end of $HOME/.bashrc

  export PATH=$HOME/bin:$PATH

Hope it helps
0
 

Author Comment

by:alphaomega232
Comment Utility
Thanks to both of you
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Currently, there is not an RPM package available under the RHEL/Fedora/CentOS distributions that gives you a quick and easy way to allow PHP to interface with Oracle. As a result, I have included a set of instructions on how to do this with minimal …
Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now