Unable to find Applications folder in Mac's terminal - macos

I tried the following code unsuccessfully
find Applications | xargs -0 grep Applications
I also tried the following unsuccessfully
find Applications

Was it something instead like:
mdfind Applications | grep Applications
mdfind is a command line interface to Spotlight. Somehow, I doubt this is what you were looking for.
The following command will find the names of Mac apps you have installed somewhere under /Applications.
find /Applications -type d -name "*.app"
Your question as phrased is pretty hard to help with, since you are not stating what your overall intent is...

It's in /Applications.
Try
find /Applications

Related

using find utility to look for all .git/config files under a certain directory

I have a certain github repo that I used to test out netlify and vuepress. I somewhat lost track of where it is on the file system, so I was planning to use mdfind (I am on mac) or find to locate all the .git/config files and then grep for my github url.
But it seems surprisingly hard to convince find to look for config under the hidden .git directories.
I did find How do I search all hidden files that are in hidden folders using Terminal? and looking at it, it looks like the following would work:
find . -name '.*' \( -type d -exec find {} \; -prune -o -print \) | egrep '/.git/config'
but given that config is a highly specific file for git, I was hoping that there is a better suited find command that will do the trick. I have already given up on mdfind as it the linked question's accepted answer is skeptical about getting it to reliably find hidden files.
Note: not looking for answers based on the locate utility, or some GUI tool, this is strictly about getting find to do the work.
Use -path.
find . -path '*/.git/config'

How could I get the full path of a file with file name?

[ SOLUTION ]
Thanks to #oguzismail and #stylo I find the solution. In the find command I modified the 2>&1 for 2>/dev/null and deleted the grep command, but I found the problem that it retrieves me two different path (because Android studio it was generation two different apk with the same name in two different paths).
To only get the path of the apk I want, I add a "filter" for my find command so the solution is:
find / -path ./intermediates -prune -o -name app-ipd-debug.apk 2>/dev/null
with name of the folder ./intermediates and -prune -o I can get the path I wanted to.
I saw the solution in this post
[ PROBLEM ]
I am doing a shell script that build an android project, install apk and do some more configurations in the device like set owner device owner (is a kiosk mode app) and some more stuff.
Now I am trying to dynamically build the project and get the apk file to install in the device but it doesn't work correctly.
I try putting the full path as a variable in my shell script and this works installing the app using the command adb install:
adb install -t -r $APK_PATH
I have tried t get the APK_PATH with find command but it retrieves me a lot of output that I don't know how to handle it, the command is :
find / -name apk-file-name.apk
A lot of output with "Permission denied" and "Operation not permitted" is shown and in one line of those the apk path is shown (this is the one I don't know how to get it, only this result)
I try to filter the results using grep but it doesn't work
find / -name apk-file-name.apk 2>&1 | grep -v "Operation not permitted"
and
find / -name apk-file-name.apk 2>&1 | grep -v "Operation not permitted"|"Permission denied"
any help?
You can use the locate command to locate files in your file system.
if you haven't enabled it yet, you can do so by running the following command
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
you won't be able to use it for a few minutes since it will index everything and later on you can use locate file_name.apk to find the file you're looking for.

Find git repository on macOS

I would like to find the location of a Git repository I made on my mac. Is there a way to find, for exemple, albatrocity/git-version-control.markdown on macOS using the Terminal? I installed everything with default parameters. I guess it must be in the User directory but I don't find anything related to GitHub there.
When I find it, I would like to completely remove it to maker a "proper" install.
EDIT: sudo find / -name "parsing.py" -print
I used a file that I know the folder contained when Terminal showed me nothing with sudo find / -wholename "*albatrocity/git-version-control.markdown"
You can use find's -wholename option to find a file based on its name and folder:
find <directory> -wholename "*albatrocity/git-version-control.markdown"
Example, if you want to search in the /Users/ directory:
find /Users/ -wholename "*albatrocity/git-version-control.markdown"
If you have locate on mac, and a regularly running updatedb, locate might be much faster:
locate albatrocity | grep git-version-control.markdown
It uses a hashtable to fast access filenames, but can be out of date, if the database isn't updated regularly or the file is too young (typically less than one day old).
If this is without success, then I would go for a full search with find, but maybe restrict it to a possible, narrowed path.

Where is the cupsctl terminal executable on MacOSX?

I've looked everywhere, and can't seem to find cupsctl anywhere. I assume it's a lot like echo or sh, it's just an executable with a PATH variable sat somewhere on the system. In order for me to call an NSTask from an Obj-C app I'm working on, I need to know where it is.
Use the UNIX find command to search your entire disk starting at the root
e.g. find / -name 'cupsctl'
Shouldn't actually take all that long assuming an average sized SSD. A couple of seconds on my Mac
$ sudo find / -name 'cupsctl' 2> /dev/null
/usr/sbin/cupsctl
or, as it's OS X, if you have spotlight indexes you could use mdfind
mdfind -name 'cupsctl'
which returns instantly with a few results, most of which are Safari history for this page :-)

Fix permissions for website directory mac osx 10.9

I have apparently messed up the permissions of my development environment and can no longer get the web site i'm working on to come up with localhost. There are a lot of files to fix and I do not want to have to try to fix them all manually through finder. Is there a way to fix them all at one time? I'm sure there is a command pompt I could use but I'm not that familliar with comman line.
I am on a Mac running OSX 10.9
Help please
This is an wasy one to fix, especially for wordpress permissions.
Open up a terminal (/Applications/utilities/terminal.app). You would then change directory to where you keep your development sites.
cd /path/to/where/you/keep/your/Site
Then issue the following two commands in you site's directory
find . -type d -print0 | xargs -0 chmod 755
find . -type f -print0 | xargs -0 chmod 644
This will recursively set permissions to what apache expects.

Resources