I'd like to run a command called "showfiles" which would run the command "defaults write com.apple.finder AppleShowAllFiles TRUE" and "killall Finder" How do I go about doing this?
I'm not sure why the && option @gahooa suggested wouldn't work, but there is yet another option: create a shell function:
showfiles() {
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
}
There are a couple ways of doing this...
Option 1:
Put a script in your ~/bin directory
echo "defaults write com.apple.finder AppleShowAllFiles TRUE" > ~/bin/showfiles
echo "killall Finder" >> ~/bin/showfiles
chmod +x ~/bin/showfiles
Option 2:
Create an alias with AND to join the commands together:
alias showfiles='defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder'
Note: this will only run the second command if the first is successful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With