Chapter 15: Working in Command-Line Flashcards

(218 cards)

1
Q

Which is not a command-line environment?

Shell
CMD
Desktop
PowerShell

A

Desktop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which choice increases the permissions a command is run with?

  • Precede the command with sudo
  • Run bash shell in root mode
  • Put sudo at the end of a command line
  • Precede the command with man
A

Precede the command with sudo. Preceding a command with sudo runs the command with the permissions of another user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In both Linux and Windows, which command will change the working directory from one folder to another?

cmd

/

\

cd

A

cd. you can change the working directory in both Linux and Windows with the cd (change directory) command.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which command displays a list of files and directories in Windows?

A

dir is the windows command to list files and directories.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which command is a folder-management utility in the Linux command environment?

A

The “mkdir” command makes directories in Linux.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which switch should be added to the rmdir command in order to delete a directory and its subdirectories?

A

“rmdir -r” removes directories and subdirectories in Linux.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which is not a valid Linux or Windows command to erase files?

rm

del

mv

cp

A

cp is the Linux command to copy files.

del is the windows command to delete files.

rm is the Linux command to delete files.

mv is the Linux command to copy files then delete the originals

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which command will delete all files with the extension .jpg but no other files?

del jpg.*
del jpg*
del *.jpg
del *jpg

A

del *.jpg deletes files with any name as long as the extension is exactly .jpg.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which command finds and fixes file table problems on a Windows computer?

A

chkdsk (also called error checking) finds and fixes problems with file tables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

If sfc finds errors, what should a technician do?

A

Run dism. best practice if sfc finds errors is to run dism to repair critical Windows files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which of these is a bit-by-bit copy command?

xcopy
dd
robocopy
cp

A

dd is a bit-by-bit command. The other commands are all file and directory copy commands

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which command causes /dev/sdb to be overwritten with zeroes?

dd if=/dev/zero of=/dev/sdb

dd if=/dev/sdb of=/dev/zero

dd if=/dev/sda of=/dev/sdb

dd if=/dev/sdb of=~/backup.img

A

dd if=/dev/zero of=/dev/sdb is the standard method to overwrite the output file (of) with zeros.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which Windows command shows running processes and their PIDs?

A

tasklist is the windows command that shows active processes and PIDs.

taskkill kills active processes.

ps is the Linux command to show active processes.

gpresult shows active policies on a windows computer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which apt-get option gets a list of the current version of all installed software?

A

apt-get update collects version information (and any avaliable updates) for all installed software.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which command has replaced apt-get?

A

apt-get has been replaced by apt (though apt-get still works).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

To take ownership of a Linux file, which command should you use?

A

chown changes a file’s owner (and the group).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which symbol in a Bash scripts indicates the rest of the line is a comment?

A

is the comment symbol in bash.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is the extension of a Visual Basic file?

A

.vbs Visual basic files have the .vbs extension.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Which is not an interpreted language?

A

C is a compiled language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Interpreted Languages include ____________.

A

Javascipt, python, and visual basic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

CLI

A

Command Line Interface. Conceptually old, but as up to date as everything else. cmd in search bar will bring up command prompt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Windows Power Shell

A

Alternative to command prompt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Bash Shell

A

Linux version of command line interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

CLI Command Windows:

“dir”

A

shows date and time file created, how big, and file name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
CLI Command Windows: "dir /p"
Shows all files/folders one page at a time
26
Switch (Command Line)
A switch in the command line refers to a modifier that will change how the command behaves.
27
CLI Command Windows: "dir /?" or "help dir"
Shows helpful guide on what dir command can do as well as available switches.
28
CLI Command Windows: "cls"
clear screen. removes all the text currently displayed in command prompt window.
29
CLI Command Linux: "sudo"
Command that lets you perform commands as admin.
30
CLI Command Linux: "sudo ls"
Linux version of dir in windows. shows date and time file created, how big, and file name.
31
CLI Command Linux: "su"
Allows for a one-time admin login so you don't have to type sudo everytime. Best practice is to not do this and use sudo everytime.
32
CLI Command Linux: "clear"
Linux equivalent of cls. clear screen. removes all the text currently displayed in command prompt window.
33
CLI Command Linux: "ls -l"
shows more info on folders/files. permissions, date time, etc.
34
CLI Command Linux: "Man" + command you're interested in
Pulls up quick guide for command
35
CLI Command Windows: "cd \"
Move to root directory. dir shows core files for operating systems, crticial files. cd stands for change directory.
36
CLI Command Windows: "cd \timmy"
moves you to the folder named timmy.
37
CLI Command Windows: "."
Shows you what directory you're in.
38
CLI Command Windows: ".."
Shows the folder above where you are.
39
CLI Command Windows: "cd .."
Moves to the folder above where you are.
40
CLI Command Windows: "cd \windows"
Move to windows folder
41
CLI Command Windows: "cd \temp
Move into the temp folder.
42
CLI Command Windows: "D:"
will move you to the D drive. Don't use cd to move between drives
43
CLI Command Linux: "ls"
Shows folders directories
44
Does capitalization matter when using Linux?
Yes, Linux allows you to name a file "Mike" "MikE" and so forth and have those files be different files.
45
Does capitalization matter when using Windows?
Yes, Windows does not allow two files to exist in the same folder if they share a name regardless of capitalization.
46
CLI Command Linux: "cd Desktop/"
Move to desktop
47
CLI Command Linux: "cd ~"
Move to home directory
48
CLI Command Linux: "cd /"
Puts you in the root directory.
49
CLI Command Linux: "pwd"
Shows you what directory you are in.
50
CLI Command Windows: "md mike"
Creates a new directory in your current directory and names it mike.
51
CLI Command Windows: "rd mike"
Removes folder named mike. Cannot delete directories with "rd" command in windows unless it is empty.
52
CLI Command Windows: "rd /s"
Delete directory and it's contents
53
CLI Command Linux: "mkdir mike"
Makes a folder in current directory.
54
CLI Command Linux: "rmdir mike/"
Removes mike folder
55
CLI Command Linux: "del mike1.jpg"
delete the file named mike1.jpg
56
Wild card
Allows you to substitute an exact file name with * to hit more than one file
57
CLI Command Linux: "del *.txt"
Deletes all files with the extension ".txt"
58
CLI Command Linux: "del *.*"
Will delete all files, will be prompted if you are sure you want to do this
58
CLI Command Windows: "copy fred.txt K:"
Makes a copy of fred.txt and puts copy into k drive
59
CLI Command Windows: "copy *.jpg K:"
Makes a copy of all .jpg files and puts them into k drive.
60
CLI Command Linux: "rm mike1.odt"
Deletes file named mike1.odt
61
CLI Command Linux: "cp"
Copies a file, folder
62
CLI Command Linux: "mr"
Moves a file, folder
63
CLI Command Linux: "cp m* Gather"
Make copy of all files starting with m and put copies in Gather folder
64
CLI Command Windows: "format E: /fs:NTFS"
convert drive E from current file system to NTFS file system
65
CLI Command Windows: "format E: /fs:NTFS /q"
Quick format drive E from current file system to NTFS file system
66
CLI Command Windows: "chkdsk"
Check disk, looks at file table and skips over bad blocks and says you're good.
67
CLI Command Windows: "chkdsk /f"
Check blocks and fix them if there are bad blocks
68
SFC & DISM
System file checker (SFC) and deployment image servicing & management (DISM). Takes a look at your backup copies of critical system files and compares them to the working ones.
69
CLI Command Windows: "sfc /scannow"
Looking at critical system files and comparing them to backups stored. will overwrite any it finds that are bad.
70
CLI Command Windows: "sfc /verifyonly"
Looking at critical system files and comparing them to backups stored. does not overwrite files it finds that are bad.
71
CLI Command Windows: "dism /online /cleanup-image /restorehealth"
Very long processes up to 20+ minutes. checks microsoft (/online) to compare your files to the ones from microsoft (/cleanup-image) and then replaces any bad files it finds with the source files from microsoft (/restorehealth). Always run sfc /scan before dism and then after dism run sfc /scan
72
diskpart>
shows in the command line when you enter disk partitioning mode. Be very careful and know what you are doing. Can loose data in this mode.
73
CLI Command Windows: "diskpart"
Command that changes your directory to "diskpart>" prompts you for orders and provides a list of orders.
74
CLI Command Windows: "diskpart>select disk 1"
You're now modifying disk 1
75
CLI Command Windows: "diskpart>create partition primary"
creates a primary partition on the selected disk.
76
CLI Command Windows: "diskpart>select partition 1"
You are now modifying partition 1. adding "letter=X" will make the partition's drive letter X
77
CLI Command Windows: "format FS=NTFS quick"
quick format partition to NTFS.
78
CLI Command Windows: "xcopy"
used for copying files/directories. contains additional features to verify files as copy works.
79
CLI Command Windows: "xcopy C:\backup K:"
Makes a copy of C:\backup and puts it in k drive.
80
xcopy C:\backup K: /s
Makes a copy of C:\backup as well as any subdirectories and puts it in k drive.
81
xcopy C:\backup K: /v
Makes a copy of C:\backup , verifies each copy as it is being copied, and puts it in K drive
82
xcopy C:\backup K: /h
Makes a copy of C:\backup excluding any hidden files and puts it in k drive.
83
CLI Command Windows: "robocopy"
identical to x copy, but has more verification & speed. It is all network aware meaning it can copy drives across a network as if it were any other drive.
84
CLI Command Windows: "robocopy D:\vms server\vmbackup"
Copy D:\vms and put it into the \vmbackup folder on the server.
85
CLI Command Linux: "dd"
bit-by-bit copier. best when copying entire partitions. have to know the partition name.
86
CLI Command Linux: "dd if=dev/sda of=dev/sdb"
if -> input file/device sda->refers to the entire first disk of a system of->output file/disk sdb->refers to the second disk in a system The command creates an exact copy of /dev/sda on /dev/sdb
87
CLI Command Linux: "dd if=dev/sda2 of=~/backup.img"
Takes everything in sda1 (first partition on the first disk in the system) and make a bit-by-bit image file of the data for back up.
88
CLI Command Linux: "dd if=dev/zero of=dev/sdb"
zero in the source name will wipe destination partition to all 0s empty.
89
CLI Command Windows: "icacls"
change NTFS permissions from command line.
90
CLI Command Windows: "icacls timmy /grant Mike :F"
"timmy" - folder being modified "Mike" - User having their permissions changed "F" - level of permission. Change Mike's permissions to F for folder Timmy.
91
CLI Command Linux: "chmod"
Linux change folder permissions. 7 refers to read write and execute permission. read has a value of 4. write has a value of 2. execute has a value of 1.
92
CLI Command Linux: "chmod 777 fred"
gives user/group/other full permissions to fred file.
93
CLI Command Linux: "chmod 664 fred"
Gives user/group read and write permissions. Gives other only read permissions.
94
CLI Command Linux: "chown"
Change owner of designated file.
95
CLI Command Linux: "sudo chown timmy fred"
give ownership of file named fred to user timmy
96
CLI Command Linux: "sudo passwd"
Change your password. Prompted to enter new password
97
CLI Command Windows: "shutdown"
shuts down PC from command line.
98
CLI Command Windows: "shutdown /s"
begins shutdown process immediately.
99
CLI Command Windows: "shutdown /r"
Restarts the computer.
100
CLI Command Windows: "tasklist"
shows all processes running on a system
101
CLI Command Windows: "taskkill"
will stop the named process
102
CLI Command Windows: "taskkill /PID 2704"
kill the process with process ID 2704.
103
CLI Command Windows: "gpupdate"
ask domain controller if any group policies have changed.
104
CLI Command Windows: "gpresult /r"
shows results of gpupdate. "applied group policy objects" <- look for this in output.
105
su
Linux acronym for super user/switch user/ substitute user
106
CLI Command Linux: "su"
Command is used to switch to different user account and stay in the same shell session.
107
John$
John is a standard/non-root user. This is denoted by his "$" next to his username
108
Penny#
Penny is a super/root user. This is denoted by her "#" next to her name.
109
CLI Command Linux: "sudo su"
Switches user level to that of a root or super user.
110
CLI Command Linux: "sudo su John"
Switches to the John user account.
111
CLI Command Linux: "cp fileA fileD"
copy file A to make file D
112
CLI Command Linux: "mv fileA /home/"
move fileA to the home directory
113
CLI Command Linux: "rm fileA"
remove or delete fileA
114
CLI Command Linux: "ls"
lists contents of current directory
115
CLI Command Linux: chmod "-" modifier function, "+" modifier function. "=" modifier function
chmod (change mode) modifies set permission on file or directory. - will remove permissions. + will add permissions. = will change permission to whatever is specified.
116
CLI Command Linux: "chmod u=rw file*"
change user permissions on every file in current directory to read and write only.
117
grep
Group Regular Expression Print, searches for things
118
CLI Command Linux: "grep tetsom /etc/passwd"
will search for the string tetsom in the /etc/passwd file and print any matching lines.
119
CLI Command Linux: "find"
Searches for things. Locate files & other objects. can find files containing values
120
CLI Command Linux: "sudo find ../ -name "brant" "
-name option tells the find command that we are looking for a file name, and the "/" tells the find command that we want to start at the root. file name searching for is brant
121
CLI Command Linux: "find /usr -type f -name "mike*" "
find – Searches for files and directories in a directory hierarchy. /usr – The starting directory for the search. -type f – Restricts results to regular files (not directories, symlinks, etc.). -name "mike*" – Matches file names starting with mike (case-sensitive). The * is a wildcard meaning “zero or more characters.”
122
CLI Command Linux: "fsck"
file system consistency check. checks and repairs errors in the file system. Used when there is a boot failure or corrupt file.
123
CLI Command Linux: "fsck -n"
check file system without unmounting the file system
124
CLI Command Linux: "unmount"
if you want to unmount file system.
125
CLI Command Linux: "sudo unmount /dev/sda"
Unmount the device associate with dev/sda
126
CLI Command Linux: "sudo mount /dev/sdb1/ mnt/media"
"mount /dev/sdb1/" - mount the file system associated with sdb1 "mnt/medi" - the location you want to be after mounting.
127
Linux: Packages
packages are a collection of related commands, configuration files, and information about any dependencies needed to use its contents
128
Linux: Package management
Package managemet is the process of installing, updating, and removing software packages
129
Linux: Debian based systems
Caly Linux / unbuntu
130
Linux: apt
Advanced package tool -> used by debian based systems such as caly linux and unbuntu
131
Red Hat Package Management Tools
Red hat uses yum (yellowdog updater modified) & dnf (dandified YUM)
132
Linux: Dependency
When one piece of software requires other pieces of software
133
CLI Command Linux: "apt update"
builds a list of package updates available in Linux repositories
134
CLI Command Linux: "apt upgrade"
applies revisions and fixes to installed packages
135
CLI Command Linux: "apt list"
shows the available/installed, and upgradable packages on system
136
CLI Command Linux: "apt show"
gives you details about package dependencies, size, and more
137
CLI Command Linux: "apt remove"
remove package from a linux system. need package name
138
CLI Command Linux: "dnf update"
installs any available package updates
139
CLI Command Linux: "dnf install"
followed by package name installs the named package
140
CLI Command Linux: "dnf remove"
remove unused or unnecessary packages
141
CLI Command Linux: "dnf list"
list all installed packages and those avalibale
142
CLI Command Linux: "ip command"
provides detailed information on the local and wide area network
143
CLI Command Linux: "ping command"
packet internet grouper - test reachability of domain name or IP address.
144
Linux: curl
client url. transfer data or files from a server using Ftp or Https
145
Linux: dig
domain information grouper - displays DNS records for a domain.
146
Linux: trace route
shows routers, hops, and transmission time between target and your local host
147
Linux: mtr
my trace route - displays real time network performance
148
Information commands
display information about linux systems
149
Linux: uname
unit name -> shows information about Linux OS and hardware including the kernal name version and architecture
150
Linux: uname -a
gives you an overview of system information.
151
Linux: lscpu
shows detailed information about cpu. model, core, threads, vendor, and cache size.
152
Linux: ps
processor status -> shows active processes, process ID, terminal, CPU Time, more.
153
Linux: ps -a
shows processes associated with the terminal
154
Linux: top
Table of processes - shows you a real time view of running/sleeping/stored processes
155
Linux: df
Disk Free - shows you avaliable storage on file system
156
Linux: du
Disk usage - reports amount of disk space being used by files/directories.
157
Linux: man [specify command]
lets you asses details about commands and utilities
158
Linux: Nano
user friendly text editor. Creating, editing, configs and scripts. cntrl + o - save. cntrl + x - exit
159
Linux: cab
concatenated. shows contents of a file or directory
160
Linux: /etc directory
stores system config files necessary to OS function
161
Linux: systemd
set of components that manage administration of Linux os
162
Linux: systemd -> PID:1
first program to start when linux boots, managaes all processes.
163
Linux: Journald
manages system event logging
164
Linux: logind
manages user logins
165
Linux: netowrkd
manages network capabilities
166
Linux: timedatectl
manages system date and time functions
167
Linux: hostname ctl
manages the system host name
168
Linux: locald
manages local settings
169
Linux: machined
tracks containers and virtual machines
170
Linux: Linux Kernel
platform which programs, scripts, and sources run. consists of five systems.
171
Linux: Five systems belonging to Linux Kernel
Process scheduler, memory management unit, virtual file system, networking unit, inter-process communication unit.
172
Linux: Bootloader
software or firmware that loads linux into memory.
173
GNU GRUB
Grand unified boot loader. most common boot loader found in Linux systems
174
Linux: Root account
highest privilege user. can do almost anything. User ID 0
175
Scripting
using commands to automate an otherwise tedious process.
176
batch file
a text file composed in a text editor, notepad. type in series of commands as if you were inputting commands to command line. uses ".bat" extension
177
"set" command
shows you environment variables
178
Environment variables
certain phrases that point to certain things or places that work for anything on operating system.
179
powershells
uses similar commands to command prompt, but uses more powerful features. uses ".ps1" extension.
180
cmdlet
commands used by powershell to access features
181
ISE
Integrated Scripting Environment - color codes script as you write it to notify of errors, in powershell
182
Bash shell
Linux version of powershell. uses extension ".sh"
183
Bash Shell: "#"
Anything following the # is considered a message and won't be seen as active script.
184
Bash Shell: Echo
Tells the Bash Shell to put something on the screen.
185
Interpreted languages
refers to coding languages that can be used across multiple OS as long as the OS has an interpreter
186
.exe extension
used for executable files.
187
Executable Files
preset list of commands designed to talk to windows and CPU.
188
Compiled code
converting source code from text file into an .exe file. Programmers write source code and put that code into a compiler and get .exe files.
189
Interpretive programming lanugages
Visual Basic (.vbs), Python (.py) and java script (.js)
190
Interpreter
Exists in all operating systems. feed visual basic, python, or java script code into an interpreter and it can spit out the appropriate .exe for OS.
191
.vbs
Extension for visual basic. Pretty specific to windows. Uses "." to add comments
192
DIM
variables, values that can change based on how we manipulate them.
193
.py
Extension for Python. know for being easy to read/make variables. Linux.
194
Web application
where you are going when you visit a website in browser
195
.js
Extension for java script. The tool house when writing client side sites.
196
Client-Side Application
web server sends code to individual web browser and run the code on the client.
197
Server-Side Application
server runs program, generates static http page, and sends it to the user.
198
.bat
Extension for batch files. text file with sequence of operating system CLI commands.
199
.ps1
Extension for powershell. Sequence of powershell scripting language statements. can automate routine system administration tasks, perform configuration, manage system resources, and more.
200
Visual Basic
uses the .vbs extension. automate and manage windows systems. retires in 2027.
201
Bash Shell Script
uses the extension .sh - series of commands. read and execute serially by bash shell permeameters
202
Java Script
uses the extension .js - scripting language that is used to create features on webpage
203
Python Script
uses the extension .py - scripting language used for web development, data science, machine learning, automation, and software development. interpreted line by line.
204
Script uses: basic automation
perform repetitive task without human interaction.
205
Script uses: Restarting a machine
a script can calculate whether a machine needs to be shut down or restarted based on time of last restart.
206
Script uses: Storage utilization
task scheduling, data extraction and storage
207
Script uses: Remapping Network Drives
You can use netuse command in a script to connect a windows PC to a shared resource, assign a drive letter, and map a path name
208
Script uses: Installation of Applications
script can install multiple applications
208
Script uses: Installation of Applications (download)
Download installers for the applications you want to install. List them in script to install on after another.
209
Script uses: Automated Backups
can script backup generation with criteria not available in traditional back up resources
209
Script uses: Installation of Applications (Reiterate)
List applications that need to be installed then reiterate command for each application in script.
210
Script uses: Initiate Updates
A script can schedule & automate installation/update processes across network on multiple machines
211
Script uses: Gather information or Data
A script can consolidate commands to gather information on a machine.
212
Downside of Scripts: Security Risks
Some scripts can be compromised.
213
Downside of Scripts: Limited portability
Scripts might not work on different OS or even different versions of same OS
214
Downside of Scripts: complexity
As a script evolves and grows it becomes harder to perform maintenance on.
215
Downside of Scripts: Unintended Results
Unintended changes in OS settings, data, or installation of programs you didn't intend to install.