Use the Command Line Interface Flashcards
What are the 6 advantages of using the command-line interface (CLI)?
- Additional administrative and troubleshooting options
- More access to the file system
- A remote login using the Secure Shell (SSH) protocol.
- Any administrator can run commands as the system administrator (root) using “sudo”
- The ability to automate repetitive tasks using scripting by applying CLI syntax to a command-line script
- The ability to remotely administer multiple, even thousdans, of Macs computers simultaneously using Apple Remote Desktop (ARD)
What is a shell in regards to the CLI
A program that creates an interface to command a computer operating system.
What is the default shell used in macOS Monterey for the CLI?
Z Shell (zsh)
What are the 4 ways you can access the CLI?
- Terminal application
- Start Mac in macOS Recovery mode to open Terminal from the Utilities menu
- Start Mac up in Single User Mode
- SSH Remote login
What are the 5 components of this terminal command prompt:
john@Johns-Macbook-Pro ~ %
- Current user account
- The @ symbol
- The name of the Mac you’re using
- Your location in the file system
- A special character that provides a hint about which shell you’re using
What is the special symbol that macOS Monterey uses in the Z shell? What is the symbol you would see if you were using the bash shell from macOS Catalina or previous versions by default?
Z Shell: % (percentage symbol)
bash shell: $ (dollar sign symbol)
What are the four parts of a command string?
- Command name
- Command options
- Arguments
- Extras
What is the command name?
A command that just needs their name to execute, for example: “ls” to display a list.
What does the “options” part of the command string do?
Options add conditions, limits, or other modifiers to the command. Options start with two dashes to distinguish them from arguments.
What does the “arguments” part of the command string do?
This is the recipient of the command, often specified as a file or folder path.
What does the “extras” part of the command string do?
Redirected output, or the commands as needed. They can enhance the capabilities of a command.
What are Manual (man) Pages?
Manual pages include detailed information about commands and references to other commands.
How do you access and navigate Manual (man) Pages
Type “man” followed by the name of the command.
To Navigate: use the up and down arrow keys to scroll, use the space bar to move down on screen at a time, enter a forward slash then a keyword, then press Return to search through a man page, and to exit the man page, type “q”
What are the 5 main elements of a man page?
- Name (Commands name)
- Synopsis (formal description of how to run command)
- Description (more detailed description of the function of the command)
- Examples (show intended use and options. Not always present)
- See Also (shows similar commands)
What are the 10 other additional elements that may be included in a man page?
- Options
- Exit Status
- Return Value
- Environment
- Bugs
- Files
- Author
- Reporting Bugs
- History
- Copyright
True or False: The command line is not case-sensitive and doesn’t require you to use full filenames with filename extensions.
False
What is a path, or pathname?
Represents a file or folder’s location in the file system
What are the two types of pathnames?
- Absolute paths
2. Relative paths
What is an absolute path and what does it start with?
A full descriptions of an item location, starting from the root of the system volume.
Starts with a forward slash to indicate the beginning of the file system.
What is a relative path?
They are partial descriptions of an item location that are based on where you’re currently working in the file system.
Terminal Command for: print working directory
pwd
Terminal Command for: list
ls
Terminal Command for: change directory
cd
Terminal Command for: indicate parent folder
. . (double periods)
Terminal Command for: indicate the current user’s home folder
~ (tilde)
Terminal Command for: create a folder
mkdir
Terminal Command for: run the command with root account access
sudo
Terminal Command for: clear the terminal screen
clear OR press “Control + L”
Terminal Command for: search for files with the spotlight index
mdfind
Terminal Command for: copy items from once place to another
cp (copy)
Terminal Command for: update the medication date of a specified item
touch
Terminal Command for: move items from one place to another
mv (move)
Terminal Command for: permanently delete items
rm (remove)
Terminal Command for: permanently delete folders
rmdir (remove directory)
Terminal Command for: substitute user identity or super user
“su” followed by the user you want to switch to
Which key should you use if you want to automatically complete filenames, pathnames, and command names?
The tab key