Week 1: Intro/Navigating the System
What are the 7 steps of shell command execution?
1) Read input 2) Break input into words/operators 3) Parse tokens into commands 4) Do shell expansions 5) Do redirections 6) Execute command 7) (Optional) Wait for command to complete, collect exit status
What are the 2 main themes of this course?
1) basic operating system navigation, such as creating files, navigating, and moving files, and 2) file and text manipulation, such as copy-pasting.
What are the two CLIs available in Windows? Which is one better and why?
1) command.exe, or the Command Prompt, 2) powershell.exe, or PowerShell. PowerShell is better because it can do everything cmd can do AND more.
What is a shell?
A macro processor that executes commands. A macro processor = a program where text and symbols are expanded to create larger expressions.
What is a subshell in bash?
A mini-shell environment, often created by using parentheses, in which variables are nixed at the end of it.
What is a parameter, and what is a variable?
A parameter is an entity that stores values. A variable is a parameter denoted by a name.
What is the command line interpreter in Linux called?
A shell.
What is Nano in Linux?
A text editor in pretty much all Linux distros. Use the command "nano filename" to edit. The caret means to use CTRL. Not the actual caret key.
What is a flag in linux?
A way to specify different options for a command.
What are the two types of paths?
Absolute and relative.
What is the previous versions tab?
Allows us to revert to an earlier version of a file.
What is the more command?
Allows us to see the file a few pieces at a time (usually the size of your shell), and you can see more when clicking the enter or space keys. The q key allows you to go back to the shell.
What does CTRL+R do in PowerShell? And Bash too?
Allows you to search for previous commands.
What is a coprocessor in bash?
An asynchronous process with a two-way pipe to the shell.
How can you hide a file in Linux?
Appending a . to it.
Which direction of slash does Windows use for its subdirectories? What about Linux?
Backslashes; Linux uses forward slashes.
What direction do slashes go in file names?
Backwards for Windows; forwards for Linux.
What language do you use to interact with the Linux shell (command line)?
Bash.
What is the less command in Bash? What are some of the keys associated with it?
Basically the same thing as MORE in Windows, just with more functionality. Some keys: up and down, page up and page down, g - which moves to the beginning of a file, G - moves to the end of a file, /word_search - allows you to search for a word or a phrase, q which allows you to quit
How can you see what options are available for a command in Linux?
By adding the --help flag.
What is the root directory of C:?
C:\
What does the clear command do?
Cleans your shell/screen. Does not delete history.
How do we show hidden files?
Click View and check Hidden Items.
What is the cat command?
Concatenate. It shows us the contents of a file in a shell.
What is /proc?
Contains information about currently running processes.
What is the cp command?
Copying a file. Needs a file name and the path of where we want the copy to go.
What does echo woof > dog.txt do in PowerShell?
Creates a file name dog.txt and writes "woof" in it.
How do you search for a word in multiple files using Notepad++?
Ctrl+Shift+F to open Find in Files. Set directory to whatever you want, but USER HOME might be good for searching everything.
What does the /bin directory contain?
Executables that exist for booting and repairing the system.
What does GNU Parallel allow you to do?
Execute multiple commands in parallel.
What is the recycle bin for?
For deleted files. If it gets emptied, you can never get the contents back!
What is /var?
For system logs and other dynamically updating files.
What is the -Force parameter?
Forces the shell to take care of and remove the file.
What are the 2 ways to navigate in a Windows OS?
GUI and CLI.
What is the Windows version of man ls?
Get-Help ls
What is cd ~?
Gets us to our USER home directory.
What does cd ..\Desktop do?
Goes up a directory then into Desktop (if it exists there)
What is the man (manual) command in Linux?
It allows you to get information on other commands -- showing manual, or man pages.
What is /?
It gives us more information on the cmd.exe commands, and it must FOLLOW the command instead of the other way around (dir /?)
What is quoting in bash?
It is removing the special meaning of characters/words from the shell. Disables special treatment.
What is the -l flag for ls? What are the columns of its output?
It shows more information about the files, and makes the directory more readable. Leftmost column: File permissions. Next: number of links a file has. Next: File owner and group file belongs to. Next: File size. Next: Timestamp of last modification: Last: File/directory name.
What is the head/tail command in Linux?
It shows you the first little bit of a file -- 10 lines by default. In the case of tail, the last 10 lines.
What is Get-Alias ls in PowerShell?
It tells us what ls is actually an alias for in PowerShell.
What is your prompt in Windows PowerShell?
It tells you what directory you're currently in. It's the text right before where you enter in your command.
What is the -Filter parameter in PowerShell ls?
It will filter the results for file names that match a pattern. Helps us search for something in a directory, like ls -Filter *.exe
What is -verbose flag?
It will output one line for each file being copied.
What is /usr?
It's meant for user installed software.
What does a single dot in front of a directory name mean (i.e. .\Downloads\)?
Just means the current directory.
What does ls stand for?
List directory [aka list directory command, but don't worry about that too much]
How do you protect safe files?
Mark them as system file. Or restrict user permissions.
What is a pipeline in bash?
Multiple sequential commands, in which the output of each is piped to the next's input
What are cmd.exe commands?
Old commands from MSDOS. They can still be used.
What is an absolute path?
One that starts from the main directory.
What is /home?
Personal directory for users. Stores documents, pictures, etc.
What does the -Full parameter do when passed to Get-Help ls?
Provides more explanation and examples on how to use ls
How can we have spaces in file names when using mkdir? In PowerShell? How about Bash?
Put the name in quotes, or using ` for escaping characters (in PowerShell) or \ (in Bash).
What is -r for cp in Linux?
Recursive copy.
How do we see information about a file?
Right click and choose Properties.
How do we add a new directory in Windows?
Right click, New, Folder. OR, in the CLI, use mkdir fileName.
How do you copy files in Windows?
Right click, copy, paste. Or use hotkeys (shortcuts).
How to change the default application that opens files?
Right-click and go to Properties. Under "Open With", click Change and choose a file.
What is ls -la?
Same as ls -l -a. Order IS taken into account.
What do we use the grep command for in Bash?
Searching for words within files, that match a certain pattern.
What does -Force parameter do?
Shows hidden files.
When right-clicking on a folder, there are two similar values: Size, and Size on Disk. What is the difference?
Size is an actual byte count. Size on Disk refers to how much space is being used on the disk.
What is /etc (pronounced etsy)?
Stores important system configuration files.
What is the /bin directory?
Stores our essential binaries, or programs.
What is the details tab?
Tells us basic information about the file.
What does pwd do?
Tells you what current directory you're in.
What is syntax highlighting?
Text is displayed in different colors/fonts to categorize things easily.
What is job control?
The ability to selectively stop (or suspend) the execution of processes, and continue (or resume) their execution later.
What are paths?
The location of files and directories.
What is a relative path?
The path from your current directory.
In Linux, what is the main directory that all others stem from? What is it denoted by?
The root directory. Denoted by a forward slash.
What are the C:, D:, and X: drives on Windows?
They are all file systems.
What are Program Files (x86)?
They contain most of the applications/programs that are installed on Windows.
What is the difference between the user home directory and /home in Linux?
Tilde takes you towards "user home", which is your username. User Home is one directory underneath /home.
How do you enable Windows Search Service for all files (instead of just files in your home directory)?
Type Indexing Options into the start menu. Click on it. Select Users and click Advanced. Click File Types tab, and select Index Properties and File Contents. Click OK. Click close. Then Windows will start re-indexing your files.
How do you find a word in multiple files using the CLI?
Use the sls or Select-String command in PowerShell. It allows you to search for text that matches a Regex pattern you provide.
What does the Users directory contain?
User profile directories.
How are files and folders organized in operating systems?
Using a hierarchal directory tree, in which one big main directory branches off to others.
How do we copy over multiple files at once?
Using a wildcard: a character that's used to help select files based on a certain pattern. An asterisk is a stand-in for "anything".
What are parameters?
Values that are associated with a command
What are some alternatives to Nano?
Vim and emacs. The latter is incredibly powerful and has its own set of tutorials.
What is tab completion?
We can use the tab key to autocomplete file names and directories. Hitting it multiple times in Windows allows you to slideshow between the different options. For Linux all options are shown at the get-go.
Why are hidden files hidden?
We don't want them to be intentionally or unintentionally modified.
What if you want to find a word in multiple files? (For Windows Search Service)
Windows has a service called the Windows Search Service. You use this (OR Notepad++ OR the command line). Windows Search Service indexes files on your computer by looking through them on a schedule, then puts the information into a database. This allows us, when enabled (it usually isn't fully enabled), to search by CONTENTS of files as well! It makes it way slower though!
How does PowerShell history command work? (And Bash)
You can see your previous commands. You can also scroll through previous commands using the up/down keys.
How to make cp a deep copy? So everything inside of it is also copied?
You need to use the -recurse option with cp.
What is the ls -a command?
all. Shows us ALL the files in the directory, including the hidden files.
How do we just see the first part of a file in the terminal in Windows?
cat file -Head 10 (for the first 10 lines)
How do we see just the last 10 lines?
cat file -Tail 10
How do you go one level above your current directory?
cd ..
What is the cd command?
change directory.
How to rename a file in the command line?
mv command. Which also helps you move files to different places.
The C: drive root folder is a ___ directory and the contents inside are ___ directories.
parent, child
ls is a ___, and it is located in the ___ folder.
program, /bin.
what is the command to remove files/directories?
rm or remove. Doesn't use recycle bin.
How do you launch Notepad++ from the CLI?
start notepad++ filename.extension
For operators such as OR or WHILE, what variable does bash use?
usually the exit status of the previous command.