Find command not working as expected in centOS - linux

I am using CentOS Linux release 7.0.1406 on virtual box. I am trying to find the files using find command.
this find command is not giving any response:
find . -name "orm.properties"
My current working directory is /eserver6. File orm.properties is present in /eserver6/share/system/config/cluster, but find command is not able to find the file.
I have tried other combinations like
find . -name "orm.*"
find . -name 'orm*'
this is finding few files staring with orm but not all the files present inside the current working directory.

The command line looks correct and it should find the file. Some reasons why it might fail:
You don't have permission to enter one of the folders in the path to /eserver6/share/system/config/cluster.
You made a typo
The file system is remote and the remote file system behaves oddly
There is a simlink somewhere in the path. By default, find doesn't follow symlinks to avoid recursive loops. Use find /eserver6 -L ... to tell find to look at the target of the link and follow it if it's a folder.
The command
find /eserver6 -name "orm.properties"
should definitely find the file, no matter where you are. If it doesn't, look at -D debugoptions in the manpage. You probably want -D stat to see at which files find looks and what it sees.

If your user have entry into sudoers file then its ok and you can run
sudo find / -name "orm.properties"
or else ask your admin to give an entry in sudoers file of your user and run the same command then it will work.

Related

Need a linux command to search a particular file in all directories

I need to search for a particular file name "i2need.txt" in all directories.
I tried this:
find * -type f
But I am getting all the files present in the directories.
I need only the i2need.txt file. Can anyone please help me in this.
If I'm understanding this question correctly you should just be able to start the search at the root directory /:
find / -name <filename>
Of course you'll likely get a lot of permission-related errors but the files' paths you have access to should be on stdout.
You can also filter out the errors with 2> /dev/null (redirecting it to /dev/null, effectively dropping it).
Alternately
locate i2need.txt
You might need to do this first
sudo updatedb

How to find a file in linux from terminal window

Actually i want to search a file which is located some where in the system. Im having debian linux and i need to search using terminal.
Use the find command, for example
find . -name "foo.*"
to search for all files named foo.* in the current directory.
Here is the manual page documentation.

Installing a bash program on mac

Hi all I am trying to install a bash program called objconv which converts object files between different architectures on my macbook air. I have so far followed the instructions but when I successfully install the script file and attempt to the command for the program terminal gives me the error -bash: objconv: command not found I have tried everything I know to fix it but nothing has worked. I also installed homebrew using instructions on a thread on this website. I currently have version 4.3.___ installed. I have my bash directory set to this /usr/local/bin/bash
as per the homebrew instructions stated and I have stated in the top of the build.sh file like: #!/usr/local/bin/bash.
This is the download to the objconv file which as the instructions:
http://www.agner.org/optimize/objconv.zip
Here is the pdf file with the instructions please refer to page 4:
http://www.agner.org/optimize/objconv-instructions.pdf
I don't know the objconv tool, but it seems as though bash simply cannot find it wherever you have installed it. That means your PATH is probably wrong because that tells bash where programs are to be found.
So, first, you need to find objconv, and I am guessing you are unsure where it is. Let's try looking in /usr/local like this
find /usr/local -name objconv -type f
and if that doesn't work, broaden your search to the whole of /usr like this
find /usr -name objconv -type f
and if that doesn't work, try searching your entire Mac, like this, which will be slower
sudo find / -name objconv -type f 2> /dev/null
The outpt of the above search(es) will be like
/usr/local/bin/bash/objconv
which would mean that the objconv program is in the directory /usr/local/bin/bash.
If you now want to run it, you can either type
/usr/local/bin/bash/objconv [something] ... <something>
or, if that is too long-winded, edit your bash profile in $HOME/.profile and change the line that sets the PATH so it looks like:
export PATH=WhereverObjconvLives:$PATH
Then activate the new PATH using:
source $HOME/.profile

Where can I find .curlrc file on UBUNTU?

Where can i find the .curlrc file? I have tried $HOME/ and echo $CURL_HOME gives me a blank line. I have also tried find . -name ".curlrc" in $HOME. No results.
Please help
updatedb && locate curlrc
make sure you run this command as root
or you could...
nano ~/.curlrc
This is where it should be.
I do believe by default though, there is no curlrc file. You might have to create your own
Try,
find / -name .curlrc
this will output all .curlrc files and you can choose whichever is required.

How to find a particular folder through terminal in fedora

Presently i am using linux(Fedora 15) and i ma trying to search a folder in the entire file system like with below command
find / -name "apache-tomcat*"
The execution of the above command is taking more and more time that a user cant wait and results are some thing like below
[root#user fedrik]# find / -name "apache-tomcat*"
find: `/proc/6236/task/6236/ns/net': No such file or directory
find: `/proc/6236/task/6236/ns/uts': No such file or directory
find: `/proc/6236/task/6236/ns/ipc': No such file or directory
find: `/proc/6236/ns/net': No such file or directory
find: `/proc/6236/ns/uts': No such file or directory
find: `/proc/6236/ns/ipc': No such file or directory
find: `/proc/6462/task/6462/ns/net': No such file or directory
.................
.................
But as i have mentioned it is taking long time to process and sometimes it is been strucked, so can anyone please let me know on how to search a particular folder by name with a command from linux terminal that will be very fast and should search in the entire file system like above i used '/'
Edit
Actually my intention is to search the folder something like apache-tomcat-7.0.37 in the entire filesystem,
for example there may be many folders like apache-tomcat-6.0.45, apache-tomcat-5.1.7, apache-tomcat-5.0.37........... on different locations on filesystem
So as we can observe only the last part(which is numerical part) is changing and the entire folder name is same, so is there a way to search for these kind of folders irrespective of the last numerical part , like by using regular expression or somethingl ike that.
Finally my intention is to find the folders of the format apache-tomcat-xxxxxxx on the entire file system, because if we search for just apache-tomcat we will get hundreds of results and even thousands too sometimes which is difficult to analyze and search from them
?
Try this:
locate apache-tomcat
It uses a database (updated by the hilariously-named updatedb, which you can run with sudo updatedb to refresh the search index).
locate apache-tomcat | grep -E '^apache-tomcat-[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'
or just use [0-9] instead of [[:digit:]]. That's probably more readable. Or
locate apache-tomcat | perl -ne 'print if /^apache-tomcat-\d+\.\d+\.\d+$/'
Whatever you do, you definitely want to use locate instead of find, as it will be much faster.

Resources