Using a terminal in the beginning can be a daunting task. However the more you do, the more you’ll begin to think how you ever managed without it.
There are endless commands which you’ll find useful on a daily basis, here are some of my favourites.
1. Show/Hide hidden files
Show hidden files
defaults write com.apple.Finder AppleShowAllFiles YES
Hide hidden files
defaults write com.apple.Finder AppleShowAllFiles No
For this change to take place you must restart finder, this can be done by holding ‘alt’ on the keyboard then right clicking on the Finder icon then clicking ‘Relaunch’.
2. Creating aliases
Finding it hard to remember long commands? Well you can easily create aliases and name them what you like.
Open .bashrc for writing
sudo nano ~/.bashrc
Type an alias – for example
alias Show_Hidden_Files="defaults write com.apple.Finder AppleShowAllFiles YES
Save the file by pressing ctrl-x then ‘y’ then <enter>.
Reload you .bashrc file to enable your aliases
You will now have a command called ‘Show_Hidden_Files’ which will un-hide all of your systems hidden files and folders.
Simply replace username with your username on the server, replace ‘domain.com’ with your desired hostname and press <enter>. You will then be asked to enter your password and then you’re done.
Download a file
scp firstname.lastname@example.org:foo.txt /my/local/directory
Just like SSH you can connect to SCP using the same details then tell the command what you want to download, which in this case it’s ‘foo.txt’ and then tell it where you to download it too which in this case is ‘/my/local/directory’.
Upload a file
scp foo.txt email@example.com:/some/remote/directory
When uploading a file to a remote server, you put the name of the file you want to upload straight after ‘scp’. Then put the path of where you want to upload the file too at the end of the command.
5. PHP snippet testing
Open a PHP interactive shell
Once you have the interactive shell open you are able to write and test snippets of PHP code from inside your terminal.
6. Talking terminal
Making you terminal talk
say Hello World
This isn’t a particularly useful command but it is a bit of fun, its as simple as typing ‘say’ follow by what you want terminal to say, turn up you speakers and enjoy.0 Love This