Ch. 16: Working with the Command-Line Interface
How would a xcopy command look?
"xcopy c:\Logs e:\Logs /s" (copies all files in the Logs directory from the c drive to the e drive)
What is the command-line interface?
(CLI) A simple text based user interface for an OS.
What is the robocopy command?
(Robust File Copy) Used to copy files and directories across networks.
What does the sfc command do?
(system file checker) scans, detects, and restores important windows system files, folders, and paths that have become corrupted.
What do the /f and r/ switches in chkdsk do?
/f attempts to fix file system related errors, while the /r switch attempt to find and fix bad sectors/clusters.
What is an example of a Linux/Mac OS X path?
/home/mike/Desktop
What do the /q switch and the /x switch in format do?
/q performs a quick format, and /x forces the volume to dismount.
What is the five step copy/move process?
1. Point the command prompt to the directory containing the files to be copied or moved. 2. Type copy or move (Windows), or cp or mv (Linux or Mac OS X) and a space. 3. Type the name(s) of the file(s) to be copied or moved (with or without wildcards) and a space. 4. Type the path of the new location for the file(s). 5. Press Enter.
What is a wildcard?
A character, usually (*) or (?), that replaces part of or an entire filename when looking for a specific type of file. ex: 'dir *.txt' or 'dir a*.*' also: in Linux, "ls s* -l" will bring up files starting with 's'.
What is the pipe command?
A command that uses the | symbol to send or "pipe" output from one command to another
What is the pwd command?
A command within Mac OS X and Linux that tells you where you are in the directory.
What is a subfolder?
A folder within a folder.
What is mounting?
A process where storage folders are mounted to a single folder on the root drive. Called " /mount" or " /media" in Linux and " /Volumes" in Mac OS X.
How does a command-line interface work?
A prompt is displayed. You type a command and press enter. The computer executes the command and displays a new prompt, meaning it's ready for new instructions.
What is a prompt?
A specific set of characters within the command-line interface.
What's the difference between an absolute path and a relative path?
Absolute paths type out the entire name of the directory, while Relative paths don't. pg 561
* edit * Both Mac OS X and Linux give you the ability to run the command line with what?
Advanced privileges called super user or root privileges. Run the commands Su and Sudo to accomplish this.
What does the dir /p command do?
Allows you to see files one page at a time.
What is the rd/rmdir command?
Deletes a directory (rd for Window, rmdir for Window/Mac OS X/Linux)
*edit* What is the difference between the Mac OS X/Linux prompts and the Windows?
First, they don't use Windows' drive letter concept, instead mounting storage as folders. Second, Linux shows the current logged-in user, system, and current directory. Third, Mac OS X and Linux use a forward slash (/) instead of a backwards (\)
What is the location of a file known as?
Path
What can you replace cmd.exe with in Window?
PowerShell
What are executable programs?
Programs that have been downloaded from somewhere else.
What is the gpresult command?
Provides a quick overview of all security policies applied to a single user or computer.
What key do you press to exit back to the prompt in Mac OS X/Linux?
Q
How do you switch drives in the command line for Ubuntu Linux?
Search in the "/mnt" folder for drives, and the "/media/<users name>" folder for removable media
Within Mac OS X, how do you switch drives in the command line?
Search in the /Volumes folder
What is the hostname command?
Shows the name of your computer.
What is the difference between the GUI and a Shell?
The OS can only have one GUI, but it can interface with different shells.
What is a root directory?
The folder at the root of the directory tree
What is the only time you can use a "/" in Windows command line?
When using a switch command. ex: /p
*edit* What's the difference between folder locations in Windows and folder locations in Mac OS X and Linux?
Windows uses the format "/home/<username>/folder", while Mac OS X and Linux show a tilde (~) as a stand-in for the users folder. ex: mike@server :~
What happens when you attempt to enter a command into the command prompt that requires elevated or administrative privileges?
You'll receive a UAC dialog box (windows needs your permission to continue).
What could you replace the bash with in Mac OS X and Linux?
Z shell (zsh), Korn shell (ksh), and C shell (csh).
What is the name of the default shell on the Mac OS X and Linux distros?
bash
What are the two types of executable files/programs within Mac OS X and Linux?
built-in and executable
*edit* Two or more files with the same name __________ exist in different folders, but two files in the same folder ___________have the same name.
can, cannot
*edit* Two subfolders under the same folder _________ have the same name, but two subfolders under different folders ___________ have the same name.
cannot, can
Windows and Mac OS X are not ______________, while Linux is.
case-sensitive
What is the name of the default Windows shell?
cmd.exe
What are the commands used to copy and move files in Windows?
copy and move
What is the copy and move command in Mac OS X/Linux?
cp (copy) and mv (move).
What command in Linux allows multiple files and subfolders within a folder to be copied to a new location?
cp -R
What information does the "dir" command list for folders?
creation date, creation time, <DIR>, and the folder name
What information does the "dir " command list for files?
creation date, time, file size in bytes, filename, and extension
What is the Windows command that shows the contents of the working directory?
dir
What does the "dir /?" command do?
lists all possible switches for the command
What is the "ls -l" command in Linux?
long list, gives detailed info about all files.
What Mac OS X/Linux command shows the contents of the working directory?
ls
What command pauses text in Mac OS X/Linux?
ls | more
What is the /mir switch?
mirror (used in robocopy)
What command is used to delete directories that contain files in Windows?
rd /s
What command is used to delete directories that contain files in Linux?
rm -r
What does the robocopy syntax look like?
robocopy [source] [destination] [options] /mir
How do you run a program in the command line for Windows?
search for the directory that holds the program and simply type its name.
What is the syntax for the sfc command?
sfc /scannow
What will typing "help" into the command prompt do?
shows a list of commands you may type.
How do you run a program in the command line for Linux?
type "./" in front of the executable file.
How do you look up a command in Windows?
type "[command name] /?" also known as help
How do you look up a command in Mac OS X/Linux?
type "man [command name]"
Within Windows, how do you switch to another drive in the command line?
type the drive letter followed by a colon. ex: c:
What does the "dir /w" command do?
uses wide list format (shows only file names, but arranged in five columns)
What is the rm command?
Deletes files in Mac OS X and Linux.
What is the del/erase command?
Deletes files in Windows.
What does the F1 function in windows do?
It brings back the previous command one letter at a time.
What are the benefits of the Command-line Interface (CLI)?
It doesn't take too much OS power, can allow you to work quicker than if using a GUI, and text commands take very little bandwidth when sent across the network.
What are the benefits of robocopy?
It fully replicates the directory structure on the destination system, deletes anything not part of the copy, can copy encrypted files, and if interrupted will continue from where it stopped.
What is the chkdsk command?
It scans, detects, and repairs file system issues and errors Uses the switches /f and /r
How do you open the Terminal in Mac OS X?
Launch it from the Utilities folder (within the Applications folder). You can also use Spotlight (command-spacebar), type terminal, and press enter.
What is a file extension?
Letters that follow a file name and identify the file type.
What does the "cd \" command do?
Return you to the root directory.
How do you run a command with elevated privileges?
Right-click a command-prompt shortcut and select "Run as administrator". If prompted for administrator password or credentials, enter what's needed.
How do you create a shortcut to a Windows command prompt with elevated priviliges?
Right-click on the desktop and select New | Shortcut. Type cmd for the location and click next. Name the shortcut and click finish.
*edit* What do su and sudo accomplish in the terminal?
Sudo runs a command as root, prompting for a password and then running the command. Su will prompt you for the root password, afterwards executing every command as root.
What is the r/ switch in the shutdown command?
Tell the computer to reboot
What is the /s switch in xcopy?
Tells xcopy to copy all sub-directories except for empty ones.
What is the /e switch in xcopy?
Tells xcopy to copy empty sub-directories.
What is the command-line interface in Mac OS X and Ubuntu Linux referred to?
Terminal (Linux also uses console and gnome-terminal)
What is a command prompt?
Text prompt for entering commands.
What is the working directory?
The folder that the command prompt is focused on.
What is a file association?
The program a file uses according to it's extension.
What is syntax?
The proper way to write a command
How do you access the command-line interface in Windows 8/8.1/10?
Type cmd into the search bar. The search charm will appear with the full command.
How do you access the command-line interface in Windows Vista and 7?
Type cmd into the start menu.
What is the best way to close the command-line interface (CLI)?
Type exit and press enter.
How do you close the command prompt?
Type exit.
What is the general way of opening the Terminal within Linux?
Use the finder or search function to type in "terminal".
What is the gpudate command?
Used to force a workstation to update to new group policies
What is the only command-line command that will warn you of deleting a file?
*.* (star-dot-star) Used to delete all files in a directory.
What is the xcopy command?
Allows multiple directories to be copied at one using extra switches.
What is the format command?
Allows you to format volumes from the command line. can use the switches /q and /x
What is the shutdown command?
Allows you to shut down or reboot a local or remote computer uses the r/ switch
What is the command-line interpreter? And what is it also known as?
Also known as the shell, it's the tool that interprets the input of the command line.
What is a switch?
An extra letter or number typed into the command-line to call up a modification. Also known as an option.
What are built-in programs?
Basic command-line commands such as ls, mkdir, and rm.
What is an example of a Windows path?
C:\Users\mike\Desktop
What does the "cd" command do?
Changes the focus to a different directory. To use, type "cd" followed by the desired directory.
What is the md/mkdir command?
Creates a new directory (md for Windows, mkdir for Windows/Mac OS X/Linux)
What does chkdsk need in order to run successfully?
Direct access to a drive. It must not be in use when you try to check it
What does the F3 function in windows do?
It brings back the entire command at once.