You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/workshops/hpc_exchange/week1/commands.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ every time. There are three parts to a command:
21
21
3) The argument(s)
22
22
23
23
Here is an example of a copy command
24
-
```bash
24
+
```bash linenums="0"
25
25
$ cp --verbose -r example-data data.bak
26
26
```
27
27
!!! note
@@ -40,14 +40,14 @@ As the last part of the command, we have the argument(s). These tell the program
40
40
41
41
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
42
42
43
-
```bash
43
+
```bash linenums="0"
44
44
$ cp -z example-data data.bak
45
45
cp: invalid option -- 'z'
46
46
Try 'cp --help' for more information.
47
47
```
48
48
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:
Copy file name to clipboardExpand all lines: docs/workshops/hpc_exchange/week1/editing.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ whitespace as delineating the arguments of a program.
11
11
So, if you had a folder named `example data`, and ran
12
12
this command:
13
13
14
-
```bash
14
+
```bash linenums="0"
15
15
$ ls example data
16
16
```
17
17
It would try to list everything in the `example` and
@@ -22,11 +22,11 @@ you can escape it by using the escape character (`\`)
22
22
to tell the command line to take that character as
23
23
is and not try to interpret it. So you could do:
24
24
25
-
```bash
25
+
```bash linenums="0"
26
26
$ ls example\ data
27
27
```
28
28
or
29
-
```bash
29
+
```bash linenums="0"
30
30
$ ls "example data"
31
31
```
32
32
@@ -60,11 +60,11 @@ friendly.
60
60
To start `nano` you can do one of two ways:
61
61
62
62
Simply type `nano` to start it in a new file:
63
-
```
63
+
```linenums="0"
64
64
$ nano
65
65
```
66
66
Or provide a file name to start editing that file:
67
-
```
67
+
```linenums="0"
68
68
$ nano document.txt
69
69
```
70
70
Nano looks similar to this:
@@ -97,7 +97,7 @@ specify and `Exit` quits out of the editor.
97
97
### vim:
98
98
Starting vim is similar to nano, you can either specify a file you want to edit or make, or simply type `vim`:
99
99
100
-
```bash
100
+
```bash linenums="0"
101
101
$ vim document.txt
102
102
```
103
103
@@ -126,13 +126,13 @@ the name of the file you want to change it to, or if it's
126
126
a directory, it's the place you want to put the file.
127
127
128
128
Changing the name of the file:
129
-
```bash
129
+
```bash linenums="0"
130
130
$ mv document.txt paper.txt
131
131
```
132
132
Which will change the name of the file to be `paper.txt`
133
133
134
134
Changing the location of the file:
135
-
```bash
135
+
```bash linenums="0"
136
136
$ mv paper.txt ~/Desktop/
137
137
```
138
138
Which will move the file into the `Desktop`
@@ -141,7 +141,7 @@ directory, but keep the same name.
141
141
!!! note "Moving Multiple Files"
142
142
If you provide more than 2 arguments, `mv` will require the last argument to be a destination directory. Like:
143
143
144
-
```bash
144
+
```bash linenums="0"
145
145
mv file1.png file2.png *.txt Desktop
146
146
```
147
147
@@ -151,7 +151,7 @@ The `cp` or `copy` program is similar to the `mv` program
151
151
except that it leaves the original copy intact. This is
152
152
useful if you want to create a backup or a fork of
153
153
something. The command:
154
-
```bash
154
+
```bash linenums="0"
155
155
$ cp ~/example-data/paper.txt ~/thesis.txt
156
156
```
157
157
@@ -166,14 +166,14 @@ directory, but still keep the original file around.
166
166
167
167
168
168
Let's try backing up a directory:
169
-
```bash
169
+
```bash linenums="0"
170
170
$ cp example-data/ data.bak
171
171
cp: example-data/ is a directory (not copied).
172
172
```
173
173
Oops, what happened here?
174
174
175
175
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:
176
-
```bash
176
+
```bash linenums="0"
177
177
$ cp -r example-data/ data.bak
178
178
```
179
179
@@ -186,15 +186,15 @@ there is no concept of a trash bin, **if you remove a file,
186
186
it's gone forever, no way to get it back**. So make sure
187
187
you know what you're deleting before you run `rm`.
188
188
189
-
```bash
189
+
```bash linenums="0"
190
190
$ rm thesis.txt
191
191
```
192
192
193
193
To delete directories, you need to use the `-r` or
194
194
recursive option. This will delete the directory and
195
195
everything inside of it. Again, this is permanent, so
196
196
be very careful to know exactly what you're deleting.
Copy file name to clipboardExpand all lines: docs/workshops/hpc_exchange/week1/filesystem.md
+24-30Lines changed: 24 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ As a user, you can picture a filesystem as a series of nested files and folders(
12
12
13
13
`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*:
14
14
15
-
```bash
15
+
```bash linenums="0"
16
16
$ pwd
17
17
/home/username
18
18
```
@@ -21,7 +21,7 @@ $ pwd
21
21
22
22
Most shells start in your home directory!
23
23
24
-
```bash
24
+
```bash linenums="0"
25
25
$ pwd
26
26
/home/username
27
27
```
@@ -30,7 +30,7 @@ $ pwd
30
30
31
31
`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:
32
32
33
-
```bash
33
+
```bash linenums="0"
34
34
$ ls
35
35
data.csv Documents bin Desktop
36
36
```
@@ -55,12 +55,12 @@ argument to list contents of that directory.
55
55
56
56
You can substitute these in to match specific patterns like so:
57
57
58
-
```bash
58
+
```bash linenums="0"
59
59
$ ls *.txt
60
60
file1.txt file2.txt file3.txt
61
61
```
62
62
63
-
```bash
63
+
```bash linenums="0"
64
64
$ ls data?.[ct]sv
65
65
data1.csv data2.tsv data3.csv
66
66
```
@@ -69,7 +69,7 @@ argument to list contents of that directory.
69
69
70
70
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:
71
71
72
-
```
72
+
``` linenums="0"
73
73
.bashrc - bash startup customization file
74
74
.conda - Conda python environments
75
75
.cache - Cached data (like photo thumbnails)
@@ -87,7 +87,7 @@ is `cd`, which stands for *change directory*, but should be
87
87
thought of as *change working directory*. This will change
88
88
which directory you are currently working in.
89
89
90
-
```
90
+
```linenums="0"
91
91
$ pwd
92
92
/home/username
93
93
$ cd Desktop/data
@@ -120,13 +120,13 @@ $ pwd
120
120
121
121
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.
122
122
123
-
```
123
+
```linenums="0"
124
124
$ mkdir example-data
125
125
```
126
126
You can also put multiple arguments and `mkdir` will
127
127
create all of them. A helpful option to pass to the `mkdir`
128
128
program is `-p`, which will create parent directories as needed.
129
-
```
129
+
```linenums="0"
130
130
$ mkdir -p another_one/test1
131
131
```
132
132
Which will create the `another_one` directory in your current
@@ -137,14 +137,14 @@ directory.
137
137
138
138
There are several ways! We could first `cd` to the Desktop, and run `mkdir`:
139
139
140
-
```bash
140
+
```bash linenums="0"
141
141
cd /home/user/Desktop
142
142
mkdir myfolder
143
143
```
144
144
145
145
Or we could make it from our home directory by specifying the path:
146
146
147
-
```bash
147
+
```bash linenums="0"
148
148
mkdir Desktop/myfolder
149
149
```
150
150
@@ -159,12 +159,12 @@ a slash (`/`). Relative paths are relative to your current working
159
159
directory and do not start with a slash.
160
160
161
161
### Absolute path
162
-
```
162
+
```linenums="0"
163
163
$ ls /home/username/Desktop
164
164
output_of_ls
165
165
```
166
166
### Relative path
167
-
```
167
+
```linenums="0"
168
168
$ ls Desktop
169
169
output_of_ls
170
170
```
@@ -180,7 +180,7 @@ UNIX file systems:
180
180
* The `-` represents the previous working directory (the directory you were in before your current one)
181
181
* You can run `cd -` to navigate to the previous directory you were in.
182
182
183
-
```bash
183
+
```bash linenums="0"
184
184
$ cd Desktop/data
185
185
$ cd -
186
186
$ pwd
@@ -203,7 +203,7 @@ $ pwd
203
203
* 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`
204
204
* You can also stack these! For example, to move "up" two directories, you could use the command `cd ../../`
The three program options used here are: `a`, which displays all files/folders,
239
-
even hidden ones; `l` which lists out more information about each listing;
240
-
and `h` which shows the size of items in a human-readable format.
238
+
The three program options used here are:
239
+
240
+
*`a`, which displays all files/folders,even hidden ones
241
+
*`l` which lists out more information about each listing
242
+
*`h` which shows the size of items in a human-readable format
241
243
242
244
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.
243
245
@@ -304,7 +306,7 @@ hear the term *man page* which is just short for *manual page*, or
304
306
running the program `man` with the argument being the program you
305
307
want more information about.
306
308
307
-
```
309
+
```linenums="0"
308
310
$ man ls
309
311
```
310
312
The `man` program pulls up a page that you can scroll up and down
@@ -313,13 +315,5 @@ pressing the `q` key. It is up to each program to provide its
313
315
own `man` page, so not all programs have them, but when they do
314
316
it can be helpful.
315
317
316
-
<!-- As a quiz, who can find (using the `ls` `man` page) what are the
317
-
options necessary to list items by reverse chronological order
0 commit comments