?
Solved

find command

Posted on 2002-03-13
3
Medium Priority
?
169 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 800 total points
ID: 6860621
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
ID: 6861289
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
ID: 6863028
Thanks to both of you
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month15 days, 14 hours left to enroll

850 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