Commands For Mac are one of the most useful and powerful point as for an Operating system. Not all users are used with UNIX CLI, so here is an easy guide for you. We have more extensive list of UNIX commands in this website. But all together we are avoiding it even to link, because this guide on Commands For Mac is for Learning the Command Line Interface.
Commands For Mac and OS X 10.8.x
On your Mac, if you open the Applications folder (or open the Launchpad) from Finder, you will find a folder named Utilities. In that Utilities folder, there is an application named Terminal. If you double click to launch it, it will open the command line tool for OS X 10.8.x. This is the basic application from where you can run the commands for Mac.
There was an application named iTerm for Mac. However, officially there is no support for Mac anymore. But, there are helpful peoples who have continued the development and iTerm2 is available for free. The reason to use iTerm2 instead of default Terminal is customization with syntax highlighting, fixing some points and iTerm2 looks nice, easy to use. This process itself a guide – Here is that guide to Customize iTerm2 with Color Schemes, Syntax Highlighting. There is another important guide for fixing the commands to our usual commands after you have updated your Mac to 10.8.x or higher – Fixing UNIX Commands After OSX 10.8 Updates. However you can omit these two steps or do later if you want. Terminal will work fine for the most new users. Here is where Terminal is located :
Some precaution for using command line :
- Never use any commands, specially bigger ones if you do not know what it can be.
- Many shortcodes, like rm for example; has a different meaning that it may look like. Never run commands on guess.
Commands For Mac : Get Started
When we open any command line application on Mac, by default it open the user folder. This is safer if you do not know what the commas are or learning the commands for Mac, for example reading this guide.
We have shown how to go to root in Mac, but you need not to use it without any real purpose. When you have opened the terminal, after it gets ready, if you type pwd and hit the Enter/Return key from the keyboard, it will show the path. You can right click on the Finder icon dock, Click Go to Folder link, it will open a dialog box, where you can paste this url to see the files visually.
So, pwd is the first part.
List the Folders and Files
ls list the command for listing the files and folders. The other attributes or extension of this command are -l and -a. So the command for -a will be :
Commands for directory and File management
cd – changes to the required directory. Example can be – cd Desktop
mkdir – This command, mkdir Folder-Name creates a folder.
rm – Be careful to use the command. rm stands for remove. rm deletes a file or folder.
.. – double dot command takes you to one level up.
mv command move a file or folder. cp copies a file or folder.
brew install – Installs a package or software, like brew install <package-name>
These are very basic commands. Most of these commands will work on Linux too.