Intro to the Command Line – Getting Started – Getting Help

Intro to the Command Line – Getting Started – Getting Help

0 0


Introduction to the Command Line

On Github Snugug / Intro-Command-Line

Intro to the Command Line

Who Am I?

Getting Started


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

Getting Help


man {command}: Opens manual page for command. Move up/down with arrow keys, press q to quit

Looking Around

Listing What's Visible

ls: List all non-hidden files/folders

Listing Everything

ls -a: List all files/folders

Listing With Details

ls -l: Details list of available files/folders

Can be combined with -a

Moving Around

Current Path

pwd: Displays your current path.

Changing Directory

cd: Changes directory to entered directory (case sensitive)

Folders with spaces in name need to escape space: foo\ bar

Current Directory

.: Starts at the current directory

Moving Backward

..: Steps back a directory

User Directory

~: Start at your user directory

Files and Folders

Creating Folders

mkdir {folder-name}: Makes a folder.

Folders with spaces in name need to escape space: foo\ bar

Removing Empty Folders

rmdir {folder-name}: Removes an empty directory

Creating Files

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

Reading and Writing To Files

echo "{content}" >: Will write content to a file

cat: Will preview content in a file

Moving and Renaming Files

mv: Moves a file. Can rename while moving by changing file extension

Removing Files

rm: Deletes file (does not move to trash, cannot undo)

Removing Full Folders

rm -r: Deletes a not-empty directory (does not move to trash, cannot undo)

Opening Files and Folders

  • OS X: open {file-or-folder}
  • Linux: nautilus {file-or-folder}
  • Windows: ii {file-or-folder}

Opens a file or folder. Opening . will open the current directory


Finding Files and Folders

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.

Finding Content

grep "{search-term}" (Windows: select-string .\*.* -pattern "{search-term}": Find content inside of files. Use -n for line numbers, -r to search recursively


Combining Searches

|: Pipe. Generic way of passing the results from one command to another

Thank You

Slides available at