Useful command line tools for Macintosh OS X.
- ls -alh; Lists a directory with a: all and that includes invisibles, l: long listing, h: human readable.
- pwd; Print working directory, the directory you are in.
- cd; Change directory, cd / takes you to the root, cd .. takes you up one directory, can also use a full path or drag a directory/file onto the Terminal window.
- . (one dot); executes the command in the current location.
- .. (two dots); goes up one level or results in a cp or mv occurring in the above directory.
- * (asterisk); executes the command on everything in the directory it's pointing to.
- tab; auto completes command and files or folders in a directory.
- cat; opens a text file for reading, can be used to append a text file to the end of another using the >> redirect.
- mkdir; maked a directory at the current location, -p switch will also create the intermediate folders if they don't already exist.
- cp; will copy items from one location to another resulting in the items being in both places.
- mv; will move items from one location to another resulting in the items being only in the place to which they are moved.
- rm; removes the items listed. They are deleted immediately without confirmation.
- rmdir; deletes a folder but it must be empty.
- rm and rmdir with -R; this will delete items recursively in a folder.
- which; followed by a list of commands will tell you which directory they are in, usually bin or sbin.
- sudo; super user temporarily.
- su; substitute user to some other user;