Solved

find command

Posted on 2002-03-13
3
163 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
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

856 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