Chapter 15: Working with the Command Line Interface (A+ Study Notes)
A+
Study Notebook
You can find my complete study notes in Google Docs format below: https://docs.google.com/document/d/1zcKLWfsns1tqzmXtVRJbcd9NqfaEcjifgIo-oJIbEgc/edit?usp=sharing
References:
M. MEYERS, 2019. CompTIA A+ All-in-One Exam Guide. 10th ed.
Chapter 15: Working with the Command Line Interface
Command-Line
Interpreter
= Shell
Windows `Command` vs macOS/Linux `bash` (e.g. Unix based `Terminal`)
macOS/Linux
shell types:
Z shell (zsh)
Korn shell (ksh)
C shell (csh)
Etc.
Windows
alternative:
PowerShell
“Run
as administrator” (Windows) vs `su /sudo` (macOS/ Linux)
“/”
forward
slash on macOS/Linux
“\”
backslash
on Windows
- Command Line Interpreter (CLI)
- `hostname` (Windows/Mac/Linux)
- `dir` (windows) vs `ls` (mac)
- `dir /p` vs `ls | more` (pauses in between when searching large directories: hit spacebar/ enter to go to the next page)
- `ls -l` (macOS / Linux - display long listing & permissions about all files)
- `cd`
- `cd ..` (to go back)
- `cd ~` (Linux / Mac - automatically puts you back into home directory)
- `pwd` (Linux/Mac - show current directory)
- `md` (Windows - create directory) or `mkdir` (Windows/Mac/ Linux - create new folder)
- `rmdir /` (delete folder)
- `rd /s` (Windows - delete folder) or `del` (delete file)
- `rm -r` (Mac/Linux - delete folder)
- `copy filename location` (Windows)
- `cp` | `mv` (Mac/Linux - copy | move )
- `xcopy` (Window - can work with multiple directories)
- `robocopy` (Windows - Robust File copy - fully replicates the structure of the destination system and deleting anything on that system that wasn’t part of copy)
- `/mir` - copy source and make the destination mirror it
- Copy even if admin didn’t give you access to
that file
- `chkdsk` (check disk)
- `chkdsk -f` (check disk on boot and attempt to fix file system-related errors)
- `chkdsk -r` (locate and repair bad sectors)
- `gpupdate` (Windows - force workstation to update to new policies)
- `gpresult` (Windows - quick overview of all security policies)
- `sfc /scannow` (system file checker) - repair critical windows files
- `dism` (windows) (helps fix Windows Corruption Errors)
- `diskpart` (windows)
- `format` | `quickformat`
- `ifconfig` (View and change the settings for your network connections)
• eth0, eth1, en0, en1, and so on: wired
Ethernet NICs
• wlan0, wlan1, and so on: wireless 802.11
NICs
• lo: loopback
· `Ifconfig eth0 down`(to Disable a NIC on
eth0)
· `ifconfig wlan0
192.168.4.15` (temporarily change IP of wlan NIC to e.g.: 192.168.4.15)
· `iwconfig` (get
wifi NIC info)
· `sudo iwconfig wlan0
essid “AnotherSSID”` (change network SSID)
· `ps` (process
running)
· `ps aux`
A = processes for all users
U = shows process owner
X = process not attached to a terminal
• USER: Who is running this process
• PID: The process ID number assigned to
the process
• %CPU: What percentage of CPU power this
process is using
• %MEM: What percentage of memory this
process is using
• VSZ: Total paged memory in kilobytes
• RSS: Total physical memory in kilobytes
• TTY: The terminal that is taking the
process’s output
• STAT: S = waiting, R = running, l =
multithreaded, + = foreground process
• START: When the process was started
• TIME: Length of time process has been
running
• COMMAND: Name of the executable that
created this process
· `ps | less`
· `ps | more`
· `kill processnumber`
(to kill a process)
· `grep` (to filter
stuff)
· `apt-get/ APT`(Advanced
Packaging Tool) vs `RPM` (Red Hat Package Manager)
· `sudo apt-get update`
(to update all package index)
· `sudo apt-get install
appname` (to install apps)
· `sudo apt-get upgrade
appname` (to update the app)
· `sudo apt-get upgrade`
(update all apps on the system)
· `vi`
· `vi newfile` (create new
text file)
· Command mode (default) vs insert
mode (click `i` to get into it)
· `ZZ` (to save and
quit)
· `dd` (create
exact bit-by-bit image of any form of block storage)
· `dd if=path
of=destinationpath` (to create a copy)
· `dd if=/dev/urandom
of=/dev/sdb` (Wiping a disk)
· /dev/urandom - random number
generator on Linux
· `passwd` (change
password)
· `icacls fodlername
/grant username` (Windows - to grant file/folder permissions to another
user)
· `chmod` (Linux/
macOS) - change permissions
· `chown` (Linux
/macOS) - change ownership
- Scripting
- Common scripting languages:
- .bat - batch file
- PowerShell (.ps1)
- Shell script (.sh)
- Python (.py)
- JavaScript (.js)
- VisualBasic Script (.vbs)
- Variables, Integers, Strings
- Conditional (if/else)
- Loops (for/while)
`cows
= 0
while
cows < 4;
print (“moo”)
cows = cows + 1`
Loop until 4 is reached.
·
Comments
·
Environmental
Variables - system wide variables

Comments
Post a Comment