Simple mistakes can have tremendous effects on the internet as a
whole.
In 2017 one single google engineer made a mistake resulting in
a loss of internet for Japan for a couple hours
It is a network of networks
... and it is HUGE.
When you create websites you should have basic knowledge of the environment you build it for. And you should be aware how important security and performance are.
Internet:
Network of networks.
Global network of interconnected computers that communicate via
TCP/IP.
Web:
The world wide web is an
information system where documents and other resources are available
over the internet. Documents are transfrerred via
HTTP/S.
How your computer accesses websites
or QUERY contains instructions detailing the
https://
powercoders.org
GET
/volunteer/it-trainer/
results in an URL: https://powercoders.org/volunteer/it-trainer/
Which protocol to use depends on what content and result is expected
Anatomy of domain names:
subdomain.domain.topleveldomain
Translates domain names into the IP addresses that allow machines to communicate with one another.
Look up powercoders's IP address by typing into VSC Terminal:
nslookup powercoders.org
Short recap: Websites are stored on web/hosting servers.
Web servers are often large computers connected to a network.
Search engines exist to discover, understand, and organize the internet's content in order to offer the most relevant results to the questions searchers are asking.
You want to find a co-working space nearby. You need to do some research online first.
You want to learn Python and you are looking for the course / book / tutorial that fits your needs best.
AIs don't actually know anything, they just predict the most likely next word based on context. They can easely go wrong and invent things:
Fortunately, there were a lot more than just one survivorI asked chatGPT to write an entire programm:
This is what it created
It did not work
Machine
is the physical
computer and hardware (disks, keyboard, etc)Operating System
,
which manages access to everythingshell
(user interface)1. Example: Let's open an application, e.g. Visual Studio Code.
2. Example: Let's create a new folder and inside a new file.
3. Example: Let's move to a specific file in your directory.
In general you might use the command line to...
nslookup
)As developer you might use the command line to...
A text-based command interpreter.
Windows:
,
type
cmd
OS X: ⌘
+
Space
, type
terminal
Visual Studio Code has an integrated terminal.
Depending on the operating system different default shells are installed.
Depending on the shell the syntax is different and not every command works everywhere.
Bash
(Born
again shell) is the popular
default shell on Linux.zsh
is similar to bash, and is now the default shell on macOS.PowerShell
and
cmd.exe
, 2 different shells
with their own syntax.zsh
as
our preferred shell.Also referred to as "folders".
A directory is a container for files, or other directories.
At the very top of the tree is the root folder.
Usually shows your username and computer name.
Indicates that the terminal is ready for a command.
Indicates your current spot in the terminal.
Shows you where the stuff you type will go.
cd
: change directoryls
: list all the filesmkdir
: make directoryrmdir
: remove/delete
directorytouch
: create a filerm
: remove a filepwd
: find out the file path of
current directory you are in, from the rootMany commands take one or more arguments, which come after the command, and give detail about what the command should do.
For example, echo
takes an
argument representing the text to be repeated.
$ echo "This is an argument."
.
..
~
-
Bonus: Drag a folder into the terminal to show its path.
(Only works in Visual Studio Code in Windows.)
Tab completion autocompletes commands and filenames.
echo hello
into your
terminal and press enter.pwd
into your terminal
and press enter.clear
into your terminal
and press enter.
If you are stuck somewhere, try
Ctrl + C
to get back to your
entry cursor.
clear
The clear
command clears the
contents of the terminal and issues a prompt.
This is good for removing previous output that is unnecessary to the task at hand.
Feel free to use this whenever things get too cluttered.
pwd
(Print Working Directory)
Type it whenever you want to see what directory (folder) you’re in.
pwd
(Print Working Directory)
Nested files and directories can be referenced using paths.
Each directory or file is separated by a forward slash
/
There are two kinds of paths:
Desktop/the_project/overview.txt
/Users/Susanne/Desktop/logo.png
cd
The cd
command changes the
current working directory.
It expects a file path as an argument.
If no file path is given, it assumes your home directory by default.
cd
.
..
~
-
Bonus: Drag a folder into the terminal to show its path.
(Only works in Visual Studio Code in Windows.)
The ls
command lists the contents
of a directory.
It expects a file path as an argument.
If no file path is given, it assumes the current directory by default.
ls
The ls
command accepts several
option flags.
A flag is a special argument that is used to set an option for the command.
These are commonly a hyphen followed by a single character (e.g.
-g
)
ls -l
Setting the -l
flag on the
ls
command causes it to provide
more verbose (long) output.
Filenames that begin with a period are hidden from normal output.
e.g. ".bashrc"
Use the ls
command with the
-a
flag to see hidden files in
addition to the usual output.
Type ls -la
into your terminal.
Use the -h
flag to get human
readable file sizes.
ls -la
Play with the cd
and
ls
commands.
Be sure to incorporate:
.
shortcut..
shortcut~
shortcutcd
without an argument
Use pwd
to check your location
periodically.
Use Tab completion to autocomplete commands and filenames.
Use mkdir
to create a new empty
directory.
Pass the path of the directory name as the first argument.
If the base of the path doesn't already exist, the command will fail.
Use the -p
flag to create the
full path if non-existent.
mkdir
Use rmdir
to remove an empty
directory.
Use rm -r
to remove a non-empty
directory.
rmdir
cd
to your home directory.pwd
command to verify
you are home.
Use touch
to create a new file.
The touch
command expects the
name of your new file as an argument.
touch
Use cp
to copy a file.
The cp
command takes two
arguments:
$ cp resume.txt resume-copy.txt
Use cp -R
to copy a whole
directory and all files in it.
cp
cp origin destination
cp -R
cp -R origin destination
Use mv
to move a file or
directory.
The mv
command takes two
arguments:
If the destination is a filename, the file will be renamed.
mv origin destination
mv origin destination(filename)
Use rm
to remove a file.
The rm
command takes the name of
the file you are removing as an argument.
rm
Use cat
to output the contents of
a file to the console.
Use more
to step through the
contents of a file one screen at a time.
Use less
to step backwards or
forwards.
Use q
to get out of the
less
.
Use open
to open a file or
directory in its default app—the equivalent of double-clicking it.
(Sadly, this does not work in Windows. 😞)
Pass the path of the file or directory name as the argument.
Use code .
to open the current
directory in VSC.
Use code
plus filename to open a
specific file of the current dirctory in Visual Studio Code (VSC).
You can use various editors built into bash, including
vi
and
nano
.
Enter the editor command and the file path:
$ nano myfile.txt
Or on a Mac, you can open with any desktop app:
open -a TextEdit myfile.txt
Or with the default editor:
$ open -t myfile.txt
vi
or
nano
to add a few sentences to
file2.txt, then exit and save.code
to
open file2.txt in Visual Studio Code.←
and
→
arrow keys let you edit
within a command↑
and
↓
arrow keys let you select
previous commandstab
auto-completes filenames
and directories
$ cd ~/pr[TAB]ojects/ac[TAB]medesign/doc[TAB]umentation/
Use the history
command to see a
list of all your previous commands.
Each command will be listed next to a line number.
A few history-related commands:
history
up
and
down
arrows to locate a past
command with one or more arguments.date
command.!
.time !!
.aaaaaaaa
('a' x 8)cd
in to a directory that does
not existcd ...
cd .
cd
filename
rmdir aaaaaaaa
Different processes have different ways of exiting back to the prompt. If you're stuck, try one of these:
q
:q
:q
command not found
If you receive a
command not found
error message,
check for typos!
Otherwise, you may need to install the software that uses the command.
Try searching online for:
how to install [command-name-here] on [Mac/Windows/Linux]
Action | Windows | OS X |
---|---|---|
Print working directory | cd |
pwd |
List directory contents | dir |
ls |
Change to a subdirectory |
cd
dir
|
cd
dir
|
Go up a directory |
cd ..
|
cd ..
|
Create a directory |
mkdir
dir
|
mkdir
dir
|
Delete a directory |
rmdir
dir
|
rmdir
dir
|
... and many more on following cheat sheet