Skip to content

Commit

Permalink
more additions to week1
Browse files Browse the repository at this point in the history
  • Loading branch information
jdtournier committed Oct 4, 2024
1 parent 38cff88 commit 6efce38
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 22 deletions.
6 changes: 5 additions & 1 deletion _layouts/presentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
img {
filter: drop-shadow(0.3em 0.3em 0.3em #888888);
}
code {
background: #F0F0F0;
}
pre code {
filter: drop-shadow(0.3em 0.3em 0.3em #888888);
}
Expand Down Expand Up @@ -65,7 +68,8 @@
width=100%;
padding: 0.5em;
background-color: #FFFFCC;
font-size: 0.8em;
font-size: 0.9em;
color: #444;
filter: drop-shadow(0.3em 0.3em 0.3em #888888);
> p {
margin: 0em;
Expand Down
116 changes: 95 additions & 21 deletions week1.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,18 @@ application](https://support.apple.com/en-gb/guide/terminal/welcome/mac).

# The command-line

To get started, click on the _Start_ menu and search for the `MSYS2 MSYS`
application

.note[
ignore the other options, you need to use the `MSYS` variant!]


--

<br>
<br>

The terminal is an application that allows you to enter _commands_ and displays
their output

Expand All @@ -194,20 +206,9 @@ intrepreter_

.note[
On Windows, the standard shell used to be the DOS shell, though MicroSoft
has since introduced the more modern PowerShell - we won't be using either of
has since introduced the more modern PowerShell &mdash; we won't be using either of
them on this course!]

--

<br>
<br>

To get started, click on the _Start_ menu and search for the `MSYS2 MSYS`
application

.note[
ignore the other options, you need to use the `MSYS` variant!]

---

# The command prompt
Expand Down Expand Up @@ -243,17 +244,17 @@ The `~` symbol is used as a shorthand for your home folder]

Try the following commands:

- `ls`: list the files & folders in the current folder
- `ls -l`: list in long format (permissions, ownership, file sizes, ...)
- `ls Desktop`: list the files in the `Desktop` folder
- `ls` &emsp; list the files & folders in the current folder
- `ls -l` &emsp; list in long format (permissions, ownership, file sizes, ...)
- `ls Desktop` &emsp; list the files in the `Desktop` folder

- `pwd`: print the current working directory
- `pwd` &emsp; print the current working directory

- `cd`: change directory
- `cd`: change to your _home folder_
- `cd ..`: change to the _parent directory_ relative to the current folder
- `cd Documents`: change to the `Documents` folder
- `cd ../Desktop`: change to the `Desktop` folder in the parent directory
- `cd` &emsp; change directory
- `cd` &emsp; change to your _home folder_
- `cd ..` &emsp; change to the _parent directory_ relative to the current folder
- `cd Documents` &emsp; change to the `Documents` folder
- `cd ../Desktop` &emsp; change to the `Desktop` folder in the parent directory


.note[
Expand All @@ -276,6 +277,79 @@ command-line correspond to the folders on your account.
on macOS, you can use the _finder_ application instead]


---

# Command-line tips & tricks

Typing long commands over and over again can quickly get tiresome

--

Thankfully, modern command interpreters provide handy shortcuts to make life
easier
- please get used to them as early as you can!

--

The **up/down arrows** allow you recall previously typed commands, which you can
then edit and modify as required (using the left/right arrows)
- very useful when you have a single typo on a long command

--

The **TAB key** asks the shell to complete the current word if it has enough
information to do so.
- for example, typing `cd Doc`, then pressing the `TAB` will complete the
command to `cd Documents`
- *provided* there is a `Documents` folder at that location
- *and* there are no other folders that start with `Doc`




---

# Writing our first C++ program

We need to start by creating a folder to store our code

--
- we can use the Windows File Explorer (or Finder on macOS), then navigate to
this folder using the command-line

--

- ... or we can use the command-line straight away!

---

# Create a folder on the command-line

- navigate to the location where you want to create the folder, for example:
```bash
cd ~/"OneDrive - King's College London/Documents/"
```

--
- use the `mkdir` command to create the desired folder:
```bash
mkdir OOP
```

--
- navigate to this folder, and create a subfolder for this first example:
```bash
cd OOP/
mkdir hello_world
```

--
- finally, change directory into this folder:
```
cd hello_world
```


---

# Hello World
Expand Down

0 comments on commit 6efce38

Please sign in to comment.