Last active
June 7, 2016 04:18
-
-
Save conleec/4a7d03f408d876407af1338733544892 to your computer and use it in GitHub Desktop.
Misc Notes on Mac Command Line Usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Navigating in the Terminal
Command Structure
command options argumentsCommand is ALWAYS a single word
Options usually a single dash followed by a letter
or two dashes followed by a keyword
Multiple options can be specified seperately or smashed together like so:
You can have multiple commands on a line, separated by a semi-colon.
Unix Manual Pages
Lynda Tutorial Link
man commandwill jump to the manual page.spacebar will go to the next page
f/b will go forward or backward
q will quit, once the end of the document (or manual) is reached
Unix Filesystem
cd ~will take us to our home directorcd ..will step us out to our parent directorycd -toggles between current and most recent directory
## Unix File Naming - maximum 255 characters - use A-Z, a-z, 0-9, period, underscore, hyphen - case sensitive (Mac OS differs) - if you use spaces - \ escape before spaces, when referencing **or** - quotes around name with spaces - better to use underscore than spaces - best practice is to use filename extensions ## Creating Filestouch <filename>will update access time if file exists, otherwise it will create the file.nanois a built-in Unix text editor.Reading Files
cat <filename>concatenates files, but will display a single filemore <filename>displays page at a time, but can't go backless <filename>displays page by page and allows user to page forward and backward.headdisplays from head of a filetaildisplays from end of fileMaking Directories
mkdir <dir_name>Moving and Renaming Files
mvused to move and rename filesMV Options
Copying Files
cpis COPYmvforced overwrite is the DEFAULT. BEWARERemoving Files
rmandrmdirare the two options for removing files and directories respectivelyrmremoves files onlyrm -Rremoves recursively. WARNING!!rmdironly removes empty directoriesSearching for Files and Folders
find path expressionWildcard expressions