Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/workshops/hpc_exchange/week1/access.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ comes with the `ssh` program already there as
well. To use `ssh`, open a Terminal (in any system).
And use the command:

```sh
```sh linenums="0"
$ ssh USERNAME@CLUSTER.rcac.purdue.edu
```
Where `USERNAME` is replaced with your Purdue username
Expand All @@ -32,7 +32,7 @@ trying to access.

You should see something that looks like this:

```
``` linenums="0"
************************************************************

***** Use of Purdue BoilerKey or SSH keys is Required ******
Expand All @@ -54,7 +54,7 @@ to the cluster you are trying to get into).
When you're logged in, you prompt should change to be of
the form of:

```
``` linenums="0"
USERNAME@loginXX.CLUSTER:[~] $
```

Expand Down
6 changes: 3 additions & 3 deletions docs/workshops/hpc_exchange/week1/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ every time. There are three parts to a command:
3) The argument(s)

Here is an example of a copy command
```bash
```bash linenums="0"
$ cp --verbose -r example-data data.bak
```
!!! note
Expand All @@ -40,14 +40,14 @@ As the last part of the command, we have the argument(s). These tell the program

Some options are unsupported for different programs. Some programs will be helpful and tell you that the option is invalid. Others will silently fail and you will be left wondering why

```bash
```bash linenums="0"
$ cp -z example-data data.bak
cp: invalid option -- 'z'
Try 'cp --help' for more information.
```
Another problem you may run into is a `command not found` error. This happens when the computer doesn't know where to find the program you are trying to run:

```bash
```bash linenums="0"
$ blah
-bash: blah: command not found
```
Expand Down
28 changes: 14 additions & 14 deletions docs/workshops/hpc_exchange/week1/editing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ whitespace as delineating the arguments of a program.
So, if you had a folder named `example data`, and ran
this command:

```bash
```bash linenums="0"
$ ls example data
```
It would try to list everything in the `example` and
Expand All @@ -22,11 +22,11 @@ you can escape it by using the escape character (`\`)
to tell the command line to take that character as
is and not try to interpret it. So you could do:

```bash
```bash linenums="0"
$ ls example\ data
```
or
```bash
```bash linenums="0"
$ ls "example data"
```

Expand Down Expand Up @@ -60,11 +60,11 @@ friendly.
To start `nano` you can do one of two ways:

Simply type `nano` to start it in a new file:
```
``` linenums="0"
$ nano
```
Or provide a file name to start editing that file:
```
``` linenums="0"
$ nano document.txt
```
Nano looks similar to this:
Expand Down Expand Up @@ -97,7 +97,7 @@ specify and `Exit` quits out of the editor.
### vim:
Starting vim is similar to nano, you can either specify a file you want to edit or make, or simply type `vim`:

```bash
```bash linenums="0"
$ vim document.txt
```

Expand Down Expand Up @@ -126,13 +126,13 @@ the name of the file you want to change it to, or if it's
a directory, it's the place you want to put the file.

Changing the name of the file:
```bash
```bash linenums="0"
$ mv document.txt paper.txt
```
Which will change the name of the file to be `paper.txt`

Changing the location of the file:
```bash
```bash linenums="0"
$ mv paper.txt ~/Desktop/
```
Which will move the file into the `Desktop`
Expand All @@ -141,7 +141,7 @@ directory, but keep the same name.
!!! note "Moving Multiple Files"
If you provide more than 2 arguments, `mv` will require the last argument to be a destination directory. Like:

```bash
```bash linenums="0"
mv file1.png file2.png *.txt Desktop
```

Expand All @@ -151,7 +151,7 @@ The `cp` or `copy` program is similar to the `mv` program
except that it leaves the original copy intact. This is
useful if you want to create a backup or a fork of
something. The command:
```bash
```bash linenums="0"
$ cp ~/example-data/paper.txt ~/thesis.txt
```

Expand All @@ -166,14 +166,14 @@ directory, but still keep the original file around.


Let's try backing up a directory:
```bash
```bash linenums="0"
$ cp example-data/ data.bak
cp: example-data/ is a directory (not copied).
```
Oops, what happened here?

We can't copy directories without recursively copying its contents, which `cp` does not do by default. You can copy directories with the `-r` (recursive) option:
```bash
```bash linenums="0"
$ cp -r example-data/ data.bak
```

Expand All @@ -186,15 +186,15 @@ there is no concept of a trash bin, **if you remove a file,
it's gone forever, no way to get it back**. So make sure
you know what you're deleting before you run `rm`.

```bash
```bash linenums="0"
$ rm thesis.txt
```

To delete directories, you need to use the `-r` or
recursive option. This will delete the directory and
everything inside of it. Again, this is permanent, so
be very careful to know exactly what you're deleting.
```bash
```bash linenums="0"
$ rm -r data.bak
```

Expand Down
54 changes: 24 additions & 30 deletions docs/workshops/hpc_exchange/week1/filesystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ As a user, you can picture a filesystem as a series of nested files and folders(

`pwd` is a program that is occasionally helpful, but is a good way to get your feet wet in trying out different UNIX commands. All it does is print out what directory (folder) you are currently in. Usually you will already know where you're at from the prompt, but it can be helpful to know the full path. `pwd` stands for *print working directory*:

```bash
```bash linenums="0"
$ pwd
/home/username
```
Expand All @@ -21,7 +21,7 @@ $ pwd

Most shells start in your home directory!

```bash
```bash linenums="0"
$ pwd
/home/username
```
Expand All @@ -30,7 +30,7 @@ $ pwd

`ls` is one of the most common UNIX programs that you may use while on UNIX systems. By default, it lists the contents of your current working directory:

```bash
```bash linenums="0"
$ ls
data.csv Documents bin Desktop
```
Expand All @@ -55,12 +55,12 @@ argument to list contents of that directory.

You can substitute these in to match specific patterns like so:

```bash
```bash linenums="0"
$ ls *.txt
file1.txt file2.txt file3.txt
```

```bash
```bash linenums="0"
$ ls data?.[ct]sv
data1.csv data2.tsv data3.csv
```
Expand All @@ -69,7 +69,7 @@ argument to list contents of that directory.

Check with `$ ls --all`! These will vary depending on what you have installed, but most will be configuration files for programs you have installed. Common ones are:

```
``` linenums="0"
.bashrc - bash startup customization file
.conda - Conda python environments
.cache - Cached data (like photo thumbnails)
Expand All @@ -87,7 +87,7 @@ is `cd`, which stands for *change directory*, but should be
thought of as *change working directory*. This will change
which directory you are currently working in.

```
``` linenums="0"
$ pwd
/home/username
$ cd Desktop/data
Expand Down Expand Up @@ -120,13 +120,13 @@ $ pwd

The last program we'll go over in this section is the `mkdir` or *make directory* command. This does what it sounds like and will create the directory noted in the argument if it doesn't already exist.

```
``` linenums="0"
$ mkdir example-data
```
You can also put multiple arguments and `mkdir` will
create all of them. A helpful option to pass to the `mkdir`
program is `-p`, which will create parent directories as needed.
```
``` linenums="0"
$ mkdir -p another_one/test1
```
Which will create the `another_one` directory in your current
Expand All @@ -137,14 +137,14 @@ directory.

There are several ways! We could first `cd` to the Desktop, and run `mkdir`:

```bash
```bash linenums="0"
cd /home/user/Desktop
mkdir myfolder
```

Or we could make it from our home directory by specifying the path:

```bash
```bash linenums="0"
mkdir Desktop/myfolder
```

Expand All @@ -159,12 +159,12 @@ a slash (`/`). Relative paths are relative to your current working
directory and do not start with a slash.

### Absolute path
```
``` linenums="0"
$ ls /home/username/Desktop
output_of_ls
```
### Relative path
```
``` linenums="0"
$ ls Desktop
output_of_ls
```
Expand All @@ -180,7 +180,7 @@ UNIX file systems:
* The `-` represents the previous working directory (the directory you were in before your current one)
* You can run `cd -` to navigate to the previous directory you were in.

```bash
```bash linenums="0"
$ cd Desktop/data
$ cd -
$ pwd
Expand All @@ -203,7 +203,7 @@ $ pwd
* The `..` represents the parent directory of the directory you are currently in. For example, if you are in `/home/username/Documents/mydata`, the command `cd ..` will change your directory to `/home/username/Documents`
* You can also stack these! For example, to move "up" two directories, you could use the command `cd ../../`

```bash
```bash linenums="0"
$ cd Desktop/data
$ cd ..
$ pwd
Expand All @@ -213,7 +213,7 @@ $ pwd
![cd dot dot ](/assets/images/workshops/hpc_exchange/cd_dotdot.png)

??? question "How would we move from the `data` directory to the Downloads directory with one command?"
```bash
```bash linenums="0"
cd ../../Downloads
```

Expand All @@ -225,8 +225,8 @@ the command `ls -l` which runs the `ls` program with the `l` option
which tells `ls` to print out more information about the files.

The following code block shows an example of what you might see from
the longer `ls` output:
```bash
the longer `ls` output of your `.ssh` directory:
```bash linenums="0"
$ ls -a -l -h ~/.ssh
total 6.0K
drwxr-xr-x 2 username student 4 Jul 17 11:19 .
Expand All @@ -235,9 +235,11 @@ drwx------ 14 username student 28 Jul 16 22:26 ..
-rw-r--r-- 1 username student 0 Jul 17 11:19 config
```

The three program options used here are: `a`, which displays all files/folders,
even hidden ones; `l` which lists out more information about each listing;
and `h` which shows the size of items in a human-readable format.
The three program options used here are:

* `a`, which displays all files/folders,even hidden ones
* `l` which lists out more information about each listing
* `h` which shows the size of items in a human-readable format

In the first ten columns of the output are the permissions of that item, details of which will be discussed in the next paragraph. The next number is the number of hardlinks to the file, which for most use cases isn't important.

Expand Down Expand Up @@ -304,7 +306,7 @@ hear the term *man page* which is just short for *manual page*, or
running the program `man` with the argument being the program you
want more information about.

```
``` linenums="0"
$ man ls
```
The `man` program pulls up a page that you can scroll up and down
Expand All @@ -313,13 +315,5 @@ pressing the `q` key. It is up to each program to provide its
own `man` page, so not all programs have them, but when they do
it can be helpful.

<!-- As a quiz, who can find (using the `ls` `man` page) what are the
options necessary to list items by reverse chronological order
(older items listed first).

.. admonition:: Answer
:collapsible: closed

The command would be `$ ls -t -r` -->

Next section: [Editing Files](./editing.md)
2 changes: 1 addition & 1 deletion docs/workshops/hpc_exchange/week1/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Week 1

This is the outline for our first week of the HPC Exchange. It is
an intoduction to Unix and how to use it. We will discuss how to
an introduction to Unix and how to use it. We will discuss how to
navigate the filesystem and common commands you may encounter while
working with Unix systems.

Expand Down
Loading