Mac Terminal: Edit Text Document I‘m again trying to make a siri-shortcut which let you run applications on your Mac.

https://www.icloud.com/shortcuts/f74c9bd89f1a4e71a3e8f72da5cf5ab7

It's making a list of all your applications in a text document, but there is the text document self also in the list. Can I delete the name of the document in this list with a command and without using keyboard?
ls &gt; Applications.txt is going to list the Applications.txt file in the list.

Though I don't entirely understand all of your workflow, adding the -d flag should do the trick, by specifying *.app.

ls -d *.app &gt; Applications.txt


Just like your previous approach though, that won't catch .app files buried in subdirectories (like your Adobe Suite). You can modify find's maxdepth parameter for something like that:

find . -maxdepth 1 -type d -name "*.app" &gt; Applications.txt


If you wish to search within all subdirectories of the current one, simply omit the -maxdepth option altogether.

If you have a problem with the pathname being part of the output (e.g., you want Terminal.app not ./Utilities/Terminal.app), then try this instead:

cd /Applications
find * -type d -name "*.app" -exec basename "{}" \; &gt; Applications.txt


If you want to find any application anywhere on your Mac, try:

mdfind -interpret "kind:application"  # this is localized for your language


The mdfind command uses Spotlight's index, so it's fast, but (being an index) it may not always represent the exact, up-to-the-minute state of the filesystem. How to remove the pathname from the front is left as an exercise for the reader (hint: xargs -I{} basename "{}").