Return to site

Look for a file in mac terminal

broken image
broken image

…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.

broken image

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.

broken image

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.