Chapter 15: Working With The Command Line Interface - CompTIA A+ Certification All-in-One Exam Guide, Tenth Edition Flashcards
List three reasons the command-line is popular.
- If you know what you are doing, you can do most jobs more quickly using the command line than with a graphical user interface.
- The command-line interface doesn’t take much operating system firepower, so it’s a natural choice for jobs where you don’t need a full-blown GUI for an OS.
- Text commands are easily added to scripts, enabling you to perform complex tasks automatically.
Define a prompt
A character or message provided by an operating system or program to indicate it is ready to accept input.
Define a shell.
Tool that interprets command-line input, also known as a command-line interpreter.
What is a command?
A request, typed from a terminal or embedded in a file, to perform an operation or to execute a particular program.
What is bash?
Default command shell on macOS and most Linux distros.
How do access the CLI?
You can access the CLI through the Start menu or the Start screen’s Search bar. Type cmd from the Start screen then press enter when the Search option appears with the full command.
How do you close the CLI?
You can either click the Close box in the upper-right corner of the screen or type “exit” and press ENTER.
When will you be prompted “Windows needs your permission to continue.”
Whenever you attempt to enter a Windows command prompt command that requires elevated or administrative privileges.
You can manually run a command with elevated privileges by right-clicking on a command prompt shortcut and selecting “Run as an administrator” or if Windows prompts for an admin password or credentials, enter whatever is needed.
How do you create a shortcut to run the CLI with admin privileges?
- Right-click desktop and create a new shortcut.
- Enter cmd as the location and the name of the shortcut.
- Right-click the shortcut, select properties > Advanced > check “Run as Administrator.
- Click OK.
MacOS and Linux are based off of what operating system?
UNIX
What is Terminal?
A command-line tool available in macOS and various Linux distros.
What is the name of the CLI in Ubuntu Linux?
Terminal.
Just like in macOS.
Name two other CLI emulators for Linux distros.
Konsole Terminal
GNOME Terminal
How do you launch the Terminal in macOS?
- Launch the Terminal app from the Utilities folder (located in the Applications folder).
- Activate Spotlight (COMMAND-SPACEBAR), type terminal, and press ENTER.
Why is Spotlight so great on macOS?
It is a great search tool because it indexes your drives, not just your file names, but content.
This means you can search for specific files, but also apps, email messages, music, contacts and even flight information!
How do you open a terminal emulator in Linux (generally)?
Every Linux distro has some form of finder or search function on the desktop that works similarly to the search tools in macOS or Windows. Find this tool and type terminal and press ENTER to start the program. This will bring up the terminal window.
Define Linux command “su.”
Older Linux command for gaining root access.
Define Linux command “sudo.”
Linux command for gaining root access.
How do you run the CLI with advanced privileges, called “super user” or “root privileges.”
Whenever you need to run a command as root, type sudo followed by the desired command. (the system will prompt for a password and then run the command).
If the system doesn’t have sudo, it should have su. You will typically type su at the prompt and press ENTER; you will then be prompted for the root password. (When you have successfully entered the password, the prompt will change (usually changing the character at the end from a $ to a #) and every command you enter from then on will be executed as root.
How do you stop working as root?
Type “exit” and press ENTER while you are working in root. You will then return to the normal prompt.
Many Linux systems disable the root account for safety, rendering the ___ command inoperable. The ___ command enables users to do root things without having their root password.
- Su
2. Sudo
Define the working directory.
The current directory used by command-line commands unless they explicitly specify a target file or directory. The prompt usually indicates the working directory.
The command prompt focuses on a specific folder, the working directory, usually indicated by the prompt. What is an example of focus in Windows?
If you a prompt that looks like this line, you know that the focus is on the root directory of the C: drive.
C: >
How is the working directory naming protocol different in macOS and Linux as opposed to Windows? Name three ways.
- macOS and Linux don’t use the lettering concepts of drives like windows, as all forms of storage are mounted simply as folders.
- Linux prompts show the currently logged-on user and system as well as the current directory.
- MacOS and Linux use a forward slash (/) instead of a backslash ().
How would the prompt display user mike is on the “server” system and is on the home directory in macOS or Linux?
mike@server:/home$
How would the prompt look in Windows, if the focus was on the \Diploma\APLUS\ folder of the C: drive?
C:\Diploma\APLUS>
The trick of using a command line is first to focus the prompt on the ____ and ____ where you want to work.
Drive, folder
How do you close the Terminal?
At the prompt, type exit and press ENTER.