Section 2 Lession 14: Use Terminal More Efficiently Flashcards
Key Points
To open a file or directory, use the open command.
The open command works with both absolute and relative file paths.
open ~/Desktop/100.txt will open the target file with the default app defined by the system or user.
The -a option specifies an application to use when opening a file.
open -a Safari https://jamf.com will launch Safari and redirect to jamf.com.
Up and Down Arrow keys (↑ and ↓) cycle through previously executed commands.
Left and Right Arrow keys (← and →) move the cursor one character at a time.
Option-Left Arrow (←) moves the cursor backward one word.
Option-Right Arrow (→) moves the cursor forward one word.
Control-A moves the cursor to the beginning of the command.
Control-E moves the cursor to the end of the command.
Press and hold the Option key and click to reposition the cursor.
Press Tab to complete a directory or file name or to display a list of available directory or file name completions.
Drag a file or directory from Finder into Terminal to populate its absolute file path.
Space characters and other special characters require a preceding escape character to be properly treated as part of a file name or directory.
A backslash () is the escape character in zshell.
open Jamf\ Pro\ Administrator's\ Guide.pdf opens the file titled Jamf Pro Administrator’s Guide.pdf.
Space characters and special characters contained within double quotation marks do not require a preceding escape character.
open “Jamf Pro Administrator’s Guide.pdf” also opens the file Jamf Pro Administrator’s Guide.pdf.
To abort a running command, press Control-C.
To execute a command as root, or a super user, precede the command with sudo.
sudo mkdir /Library/Scripts/Jamf uses admin privileges to create a folder called Jamf in the Scripts directory of the root Library.
To execute the most recently run command again, use !!
Sudo can be added to rerun a command with root privileges: sudo !!
https://youtu.be/ZiApWeEzWyc