The
pwd
command stands for “present working directory,” and it lets you know
where you are within the current filesystem.
To create a new directory called files we’ll write the following,
with
mkdir
being the command and files being the argument:
mkdir files
You can listing out the files in the directory, with the
ls
command (signifying “list”).
In order to move into the directory that we have created, we’ll use
the
cd
command and pass the name of the directory we want to move into as
the argument. The command cd stands for “change directory,” and
we’ll construct it like so:
cd files
Regardless of where we are in a filesystem, we can always use the
command
cd /
to move to the primary directory
From where we currently are, we can use two dots to return to the
parent user directory, like so:cd ..
You can type the following from anywhere on your machine and return
to this home directory:
cd ~
touch
command, can create a new file or modify an existing file. To use
it, you can use the command touch and pass the name of the text file
you want to create as the argument:
touch ocean.txt
We can use
echo
directly on the command line to have the interface repeat after us.
The traditional first program, "Hello, World!", can be written with
echo like so:echo Hello, World!
the
echo
command does not allow us to store the value of our text into a text
file. In order to do that, we will need to type the following:echo "Sammy the Shark" > sammy.txt
Short for concatenate, the
cat
command is very useful for working with files. Among its functions
is showing the contents of a file.
The nano text editor can be summoned with the
nano
command. If we want to edit our existing .txt file, we can do so by
passing the file name as an argument.
The
mv
command, which stands for move, will allow us to change the location
of a file. The command is constructed by taking the file we want to
move as the first argument, and the new location as the second
argument
We can copy the .txt file to create more files. To do this, we can
use the
cp
command, which stands for copy. This command works similarly to the
mv command, taking the original file as the first argument, and the
new file as the second argument.
The
curl
command transfer data from the web to our personal interactive
terminal on the browser. The command curl stands for client URL (web
address).
We can remove individual files with the
rm
command, which stands for remove. We’ll need to pass the file we
want to remove as the argument.
The command that is used to remove directories is called
rmdir, which stands for remove directory. Only works on empty
directories
Using the
rm
command, we can recursively remove the primary directory and all of
its content dependencies. We’ll use the
-r
flag, which stands for recursive, and pass the folder as the
argument.
Semantic HTML
Sensible defaults. Browsers have a bunch of built-in styles and
behaviours you should take advantage of. Why re-create all of that
from scratch when you could just override the bits you want to
change.
Complex behaviour. Built-in elements have lots of complex behaviours
that are hard (or impossible) to reproduce.
Machine-readable. By describing the structure of our page we allow
computer programs to understand it as well as humans.
This is also very important for accessibility. The web is for
everyone, including people who use other types of software to
browse. For example visually-impaired users often use “screen
readers”, which read the page out loud.
Here’s a quick list to run through whenever you’re picking an
element:
Is it a meaningful area of the page? Use an HTML5 block element like
<header>
or
<footer>.
Does it label the start of a new section? Use a heading (with the
right level) like
<h2>
or
<h3>.
Does it navigate to a new page? Use an
<a href="/page">.
Does it trigger JS behaviour? Use a
<button>.
Does it allow user input? Use a
<form>
containing
<input>s (with
<label>s!).
Is it just for applying some layout/styles? Use something like
<div class="grid">
or
<span class="big-text">.