Lesson 4: Use the Command Line Flashcards
• Describe when the command-line interface is useful. • Use man (manual) pages to find more information about commands. • Manipulate files in the command-line interface.
What are some advantages of using the command-line interface?
The command-line interface provides these advantages:
- 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 user or root, using
sudo
- The ability to automate repetitive tasks using scripting
- The ability to remotely administer multiple, even thousands, of Mac computers simultaneously using Apple Remote Desktop
- The documentation found in
man
pages provides an explanation of command usage and references to other related commands
What are the four parts of a command string?
The four parts of a command string are as follows:
Example: ls -lah ~/ > ~/Desktop/homeDirectoryList.txt
-
Command name
-
ls
to “list directory contents”
-
-
Command options
-
-l
to “List in long format” -
-a
to “Include directory entries whose names begin with a dot (.)” -
-h
to “When used with the -l option, use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte in order to reduce the number of digits to three or less using base 2 for sizes.”
-
-
Arguments
-
~/
the current user’s home directory is the target of action
-
-
Extras
-
> ~/Desktop/homeDirectoryList.txt
redirect the output of thels
command to a new file on the user’s Desktop called “homeDirectoryList.txt.”
-
Which terminal command should you use to perform the following tasks?
- Print working directory
- List
- Change directory
- Indicate parent directory
- Indicate current user home folder
- Create a folder
- Run the command with root account access
- Clear the Terminal screen
- Use the Spotlight index to find a file
Use these commands to perform the following tasks:
- Print working directory:
pwd
- List:
ls
- Change directory:
cd
- Indicate parent directory:
..
- Indicate current user home folder:
~
- Create a folder:
mkdir
- Run the command with root account access:
sudo
- Clear the Terminal screen:
clear
or press <kbd>Control-L</kbd> - You can search for files with the Spotlight index using
mdfind
Which key should you use if you want to automatically complete filenames, pathnames, and command names?
You should use the <kbd>Tab</kbd> key to automatically complete filenames, pathnames, and command names.
What is the new default shell interpreter in macOS Big Sur?
The Z shell (zsh
) is now the default shell in macOS Big Sur, but the bash shell is still available.