Can you help me find this shell script?
May 5, 2014 9:27 PM   Subscribe

Several years ago, I created a shell script (or Bash or I don't know what) that establishes a secure shell proxy connection to my home router when I type a short command into Mac OS X's Terminal. Now, I need to edit that script, but I can't find it for the life of me. I've tried searching on likely names looking at both visible and invisible files. I've tried searching for content that I know must be part of the script, but nothing comes up. Rather that executing a command, is there a way to open it in a text editor or display the actual script if I don't know the location of the file on my computer? Is there any other way I could go about finding this? Is there a location that whatever guide I was following would have suggested I save this script? I tried looking in usr/bin but nothing in there seems likely.
posted by willnot to Computers & Internet (6 answers total) 2 users marked this as a favorite
If it is short, it could be an alias - 'alias' from the command line should list it
posted by azlondon at 9:35 PM on May 5

Shell scripts are text files. If you're using OS X, text file contents are usually indexed, which means you can click on the Spotlight menu item and search on a keyword that would be inside the file. A hostname might be a good, relatively unique part of any text file on your computer, and therefore might make a good search keyword.
posted by Blazecock Pileon at 9:37 PM on May 5

It was an alias. Thank you.
posted by willnot at 9:37 PM on May 5

Just for future reference, to find a location of a script (or any executable), you can use the "which" command. Eg: "which ls" tells me that it's found in "/bin/ls", and "which ack" yields "/Users/vasi/bin/ack". You can see the different places it's looking for scripts by typing "echo $PATH", they're listed separated by colons.

If you're using the bash shell, which is the default on OS X, there's an even more useful command, "type -a". If you have multiple scripts with the same name (in different paths), it will show all of them. It will also find aliases.
posted by vasi at 10:02 PM on May 5

If you're looking for where the alias is defined, it's probably in one of the following text files:
posted by ryanrs at 1:34 AM on May 6 [1 favorite]

If it's OS X, just open Spotlight (Command-space bar) and start typing some fragments of the commands.
posted by wenestvedt at 6:33 AM on May 6

« Older I think my son, who is on an A...   |  I'm looking for "hiking b... Newer »

You are not logged in, either login or create an account to post comments