2. Class Syllabus
• The syllabus has been posted on Blackboard
• The breakdown of grades is:
Linux Operating
Systems Labs
30%
Microsoft Operating
Systems Labs
35%
Hypervisor Labs 25%
Know My Computer
Assignment
10%
3. Software For This Class
• VMWare Workstation
– Downloadable from Blackboard
• VMWare Horizon
– Downloadable from Blackboard
• Elementary OS
– http://elementary.io
• Lubuntu OS
– http://lubuntu.net
4. How do Operating Systems Work?
• Last week we learned that the operating
system is everything between the user’s
programs and hardware.
OS
Hard ware
User
5. The “Kernel” and “Shell”
KernelKernel
ShellShell
A metaphor for explaining how operating systems work at a
theoretical level
The shell is what the user sees, while the kernel is how the
OS manages the hardware.
6. The “Kernel” and “Shell”
The user sends commands to the shell, which are turned
into “system calls” to the kernel, which in turns gives
instructions to the hardware.
7. Command Line
• Also called the “command line interface” (CLI)
• The closest you can get to the kernel while still
being in the shell.
– Again, generally. You can use system calls directly,
but this isn't usually advised unless you are doing
low-level programming.
• GUIs and windows often use command line
commands to get information and perform
actions.
8. “A” Shell vs. “The” Shell
• You will often here people refer to a CLI as a
“shell”
• This is because the command line is generally as low
as most people go in the Operating System
• Rule of thumb: “A” shell is a command line
interface. “The” shell is a metaphor for how
the operating system works.
9. Bash
• Most common CLI for Linux
• Is based on the “Bourne” Shell, which was one
of the original Unix Shells
• Bash stands for “Bourne Again Shell”
– The more time you spend in programming, the
more terrible puns you will see
10. Common Commands
• echo
• ls
• cd
• touch
• rm
• mkdir
• rmdir
• mv
• cp
• grep
• man
Commands
e.g.
m
11. echo
• Simplest command in all of linux
• Reads a string and repeats it
• e.g. echo “Hello World!”
12. ls
• “list”
• Lists files and directories
• Can accept “arguments” to look for more
specific information.
• Try running “ls –a” and “ls –l”. What happens?
13. cd
• “current directory”, although I like to think of
it as “change directory”
• Used to change the directory the user is
currently in.
• Use “ls” to get the names of the directories in
your current directory. Try using “cd
<directory>” to move into it.
• Use “cd ..” to move into the parent directory
14. cat
• “concatenate”
• Displays the output of one or more files
• The format is “cat <name of file>”
– e.g. cat thisfile
• Use “cd” and “ls” or “ls –l” to find some files,
then use cat to see what is inside them.
15. touch, rm
• touch and “remove”
• touch is used to create a blank file
– You can edit it later
– e.g. “touch test”
• rm deletes a file
–e.g. “rm test”
– There is no recycling bin for the command line, so
once a file is gone it’s gone.
16. mkdir, rmdir
• “make directory”, “remove directory”
• I’ll give you three guesses…
• You can only remove an empty directory
– You must delete all of the files inside the directory
first
– Deleting can be done faster using “globbing”
(discussed later)
17. mv & cp
• “move” and “copy”
• mv will create a copy of a file or directory and
delete the original. cp does not delete the
original.
• If the second input is a file instead of a folder,
then the file is renamed.
– e.g. mv oldfilename newfilename
18. Task #1 – 5 minutes
• Create a directory called “alphanumeric”
• Move into the directory, and create four files: “a”,
“b”, “1” and “2”
• Move out of the directory and create a copy of
“alphanumeric”.
• Create two new directories called “letters” and
“numbers”
• Move the files whose names are letters into the
“letters” directory, and the numbers into “numbers”
• Delete the original “alphanumeric”
19. Shell “Globbing”
• Moving files one at a time is incredibly tedious
• Luckily, bash lets us match many characters at
the same time. This matching is called shell
“globbing”
• Create three new files: “apple”, “apricot”, and
“banana”
• Compare “ls”, “ls a*”, “ls app*”, and “ls *a”
20. Special Characters in Globbing
Character Name Function
* Asterisk Wildcard. Matches any
characters to any length.
?
Question
Mark
Wildcard. Matches a single
character.
[] Square Br. Matches a range of
characters.
{} Curly Br. Matches a range of
expressions.
21. Fast Cleanup
• Use globbing to list all of the files in
“alphanumeric” that have a letter in their
name.
• Move a copy of every file in alphanumeric that
starts with a letter into the “letters” folder.
• Delete all of the files in alphanumeric, then
remove the directory
22. pipe
• Not a command, but a key feature of bash and
many other CLI s
• Allows you to take the output of one
command, and use it as the input of another
• The symbol is “|”
23. grep
• grep lets you search text for matching
information
– e.g. grep something filename
• By itself it is only a little bit useful, but it
becomes very powerful when combined with
pipes.
• e.g. ls | grep something
24. man
• Stands for “manual”
• If you don’t understand a command, “man”
will return the documentation for it.
• The format is “man <command>”
26. Access Issues Off-Campus
• Apparently some people are having trouble
accessing the VDI from off campus.
• I’ve talked to the IT department and they told
that it has been resolved
• If you are still having trouble let me know and
I will investigate it further with them.
27. A Bit About Batch and CMD
• For over 15 years, cmd was the default shell
environment used in Windows
• Batch files were simple lists of command line
instructions.
– Although limited in what they could do
individually, it was possible to schedule multiple
batch files together to accomplish complex tasks.
• Batch files remain in widespread use today
28. Problems With This
• Cmd does not have a built in scripting
language
– This means that it cannot access powerful
features of the kernel in the same way that bash
can
• While you can string batch files together, this
creates many new points of possible failure
– Even with scheduling, they are still very limited in
what they can do
29. Introducing Powershell
• Created in 2002
• Is a shell language, scripting language, and
REPL.
• Has been slowly replacing batch over the last
decade
• The syntax of powershell is based around
three concepts:
– Cmdlet -Alias -Application
30. Cmdlet
• Are made of verb-noun pairs
– example “get-command”, “restart-computer”,
“set-location”
– Gives an idea of what the command does
• Try running those commands (except for
restart-computer) along with get-childitem
31. Alias
• An alias is an alternative name for a cmdlet
Cmdlet Alias
ls get-childitem
cd set-location
cp copy-item
32. Finding Common Ground
• The command get-command listed all of the
commands in Powershell
– You can narrow it down with the “-name”
argument
Find if Powershell supports cat, touch, rm,
mkdir, rmdir, mv, man, and grep.
Also, test if shell globbing works the same way.
33. Application
• Applications are just that, applications. You
can launch them from powershell in the same
way that you can launch them by double
clicking.
• Try running “mspaint.exe” or “notepad.exe”
for a practical example.
34. Longer Paths
• Right click on a desktop shortcut. Go to
“properties” and copy the “target”. Try
pasting it into powershell and running it. What
happens?
• Without using the internet, can you figure out
how to start the program from Powershell?
– Hint: try using “get-command –name”, along with
globbing, to search for commands using key
words. (e.g. “get-command -name *start*”)
Editor's Notes
Example: 1pm you move the files to a server. 1:30 the server compresses the files. 1:45 the compressed file is moved into an archive.
&lt;number&gt;