These things will get most everything, I imagine there are other things one just needs, or should, hack around and discover. Apropos is also quite interesting, which you may know already. Often you can find other interesting things to type, probably also covered above, by typing help or help, with more information about most programs or builtins coming with info or man. Similarly, many programs are (at least) at /Applications/Utilities, some interesting stuff is at /System/Library/CoreServices/Applications (as well as other things under the /System main directory.), and as well sometimes custom programs get put under the classic Unix locations like /usr/bin, usr/local/bin, /opt, and /sys/bin. It's also common in OSX that many programs can be executed from the shell, so many program names that you'll find in /Applications can also be called via a CLI from the shell. If Bash if your shell, it will spew out similar information for all commands or a single command if you press Tab Tab. You can use the open command in OSX for quite a few things, for example.Ĭompgen -c executes the command in a subshell environment, and its output is used as the possible completions, which is probably what you want. Termius is not only an SSH client as it offers a complete command-line solution that redefines the meaning of remote access for the network engineers and sysadmins. My experience is that it will not list everthing, like applications typcially ran in the GUI, which I will mention below. This blog considers everything about the SSH terminal for Mac, Windows, and Linux. So it is interesting that technically compgen is listing commands, aliases, and functions, as well as a few other things like builtins, variables, groups, jobs and service names. Terminal’s awesome, but boy, could you cause issues if you really tried.Like fd0 commented above, the best source for quickly listing most everything you can do in the Terminal, is by using the Bash builtin compgen.Ĭompgen interfaces with the "completion" function in Bash, so it is intended to keep a list of most everything you can do in the shell. bash_history” again.)Īnd finally, it wouldn’t be a command-line tip if I didn’t offer the usual disclaimers-be very careful of what you type, always copy and paste commands if you aren’t confident in your skills, blah de blah blah. (If the command above didn’t work, you may have navigated away from your user folder within Terminal, and if so, you can use the “cd ~” command before running “open. That should open your list of previously entered commands within your default text editor, and you can search through it at your leisure. You could just open the file containing your history and view it as text! Unsurprisingly, though, that file is hidden by default, so to access it, open a new Terminal window, type this command in, and press Return: open. If you want to add to existing text instead of replacing it, type “greater than” twice (“>”).įinally, there is one more method I’m going to suggest, and I think it’s the simplest of all. …means “run the ‘history’ command, and then create a new file on Melissa’s desktop called ‘history.txt’ with the results.” That little “greater than” symbol is handy for all sorts of stuff within Terminal, but be aware of its one big caveat: If there is already an existing file in your requested location with the same name, using the command above will replace it. So this example... history > /Users/melissa/Desktop/history.txt If you’re familiar with using the “greater than” (“>”) symbol in Terminal, that’s an easy way to make “history” easier to read-it’ll take the command and create a file you designate with the output. To do the former, simply type “history” in at the prompt, and you’ll get what you’re looking for. However, you could also just view your history in either the Terminal window or as a text file. There are quite a few ways you could go about this I mentioned one method a couple of years ago that’ll help you search through the history, which is useful if you at least know a keyword in the command you’re trying to find.
So if, for example, he’d used a “defaults write” command to alter how OS X looks or acts, he could find exactly what he did in his history to know how to reverse the changes. Last week, I had a very nice reader email me to ask a question about how to look through the commands he’d previously typed into Terminal.