On Github Snugug / Intro-Command-Line
Open /Applications/Utilities/Terminal
Keep in Dock for easy access.
Optionally, download and use iTerm 2
Search applications for Terminal
Keep in Launcher, if you have one, for easy access
Download Console 2
Extract Console.exe
Add Console.exe shortcut to Desktop
Open Console.exe, go to Edit->Settings and set the shell to PowerShell (C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe)
Set the Startup dir to your User directory
Restart Console.exe
man {command}: Opens manual page for command. Move up/down with arrow keys, press q to quit
ls: List all non-hidden files/folders
ls -a: List all files/folders
ls -l: Details list of available files/folders
Can be combined with -a
pwd: Displays your current path.
cd: Changes directory to entered directory (case sensitive)
Folders with spaces in name need to escape space: foo\ bar
.: Starts at the current directory
..: Steps back a directory
~: Start at your user directory
mkdir {folder-name}: Makes a folder.
Folders with spaces in name need to escape space: foo\ bar
rmdir {folder-name}: Removes an empty directory
touch {file-name} (Windows: New-Item {file-name} -type file: Will check to see if a file exists and, if it doesn't, create it
echo "{content}" >: Will write content to a file
cat: Will preview content in a file
mv: Moves a file. Can rename while moving by changing file extension
rm: Deletes file (does not move to trash, cannot undo)
rm -r: Deletes a not-empty directory (does not move to trash, cannot undo)
Opens a file or folder. Opening . will open the current directory
find {file-name} (Windows: Get-ChildItem {file-name}: Finds files and folders. Use -type for specific types and -name for the name of files on non-Windows systems.
grep "{search-term}" (Windows: select-string .\*.* -pattern "{search-term}": Find content inside of files. Use -n for line numbers, -r to search recursively
clear
|: Pipe. Generic way of passing the results from one command to another
Slides available at
http://snugug.github.io/Intro-Command-Line