Score:0

Command to Locate a File with a Specific Name on SSH

cn flag
jjc

My goal is to write a command to locate a file called MABLE on my server. Then I need to craft this command to report no permission errors, but print out every other error.

Currently, I'm using

find / -name MABLE 

After that, I'm putting in

ls -d mable

This is not working. Any better way write the command?

guiverc avatar
cn flag
I'm confused; *MABLE* and *mable* are very different names, and a command searching for files is case-sensitive (so case matters!) unless you specifically tell it to ignore case (`-iname` for example). Why are you using MABLE then mable - they'll be two different files.
bac0n avatar
cn flag
if you intend to search for a file on the entire system, then `locate` is probably better siuted.
CrazyTux avatar
us flag
Does this answer your question? [Missing Downloads folder](https://askubuntu.com/questions/1348082/missing-downloads-folder)
Score:1
cn flag

You can use "process substitution" to pass the results of the find command to grep, in order to filter out the messages including : Permission denied as in:

find / -name MABLE 2> >(grep -v ': Permission denied')

2> captures the error output and redirects that to the grep command, to which that output appears as a file (an "unnamed pipe").

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.