-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogging-on-linux-slides.qmd
More file actions
210 lines (149 loc) · 4.68 KB
/
logging-on-linux-slides.qmd
File metadata and controls
210 lines (149 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
---
title: "Linux Command Line Essentials"
subtitle: "Getting comfortable with the CLI on HPC systems"
format:
revealjs:
theme: [default, slides-custom.scss]
logo: assets/img/logo/logo.png
footer: "HPC1: Introduction to High Performance Computing | University of Leeds"
slide-number: true
show-slide-number: all
background-transition: fade
---
## Command Line Interface (CLI)
Aire does not have a GUI (Graphical User Interface) and so you need to interact with it through a CLI.
::: {.fragment}
- CLIs allow us to interact with a computer through text-based commands typed into the command-line
- While GUIs can be simple and intuitive to use, they can make it difficult to reproduce workflows
:::
---
## Why CLI for HPC?
**Reproducibility Issues with GUIs:**
- Sometimes you have to record by hand (or with a screen recording) what sub-options from different menus you used
- Updates to GUIs can make it difficult to find the same menu options
- A workflow with multiple steps can be tedious to repeat for multiple datasets (having to click through multiple layers of menu options for each dataset)
## Why CLI for HPC?
**CLI Benefits:**
- Scriptable and repeatable
- Faster for experienced users
- Works better over remote connections
- Can be automated
---
## Bash Shell
Bash is the default shell on Unix systems like Linux or Mac
::: {.fragment}
**Key Concepts:**
- Shell interprets and executes commands
- Commands follow pattern: `command [options] [arguments]`
- Case sensitive
- Use `man command` to get help
:::
---
## File Systems on Linux
::: {.fragment}
**Navigation Basics:**
- Navigate to your home directory with `cd`
- List the files and directories present with `ls`
- Change to a different directory with `cd path/to/directory`
:::
::: {.fragment}
**Path Types:**
- Absolute path: `/home/username/data`
- Relative path: `../data` or `./scripts`
- Home directory: `~`
:::
---
## Essential Commands
- We don't expect you to memorise these!
- We have included them here for quick and easy reference.
## Essential Commands - Navigation
```bash
pwd # Print working directory - where am I?
ls # List files and directories
ls -la # List with details and hidden files
cd # Change to home directory
cd /path # Change to specific directory
cd .. # Go up one directory level
cd - # Go back to previous directory
```
::: {.fragment}
**Try it:** Navigate around the file system and see where you are. You might not have any files or folders if you've just created your account!
:::
---
## Essential Commands - Files
```bash
mkdir newdir # Create directory
cp file1 file2 # Copy file1 to file2
mv oldname new # Move/rename file
rm filename # Remove file (be careful!)
rm -r dirname # Remove directory and contents
```
::: {.fragment}
::: {.callout-warning}
## Be Careful with rm!
The `rm` command permanently deletes files - there's no "recycle bin" on Linux!
:::
:::
---
## Essential Commands - Viewing Files
```bash
cat filename # Display entire file contents
less filename # View file page by page (q to quit)
head filename # Show first 10 lines
tail filename # Show last 10 lines
head -20 file # Show first 20 lines
tail -f logfile # Follow a log file in real time
```
---
## Essential Commands - System Info
```bash
whoami # Current username
df -h # Disk usage (human readable)
free -h # Memory usage
ps # Running processes
top # Real-time process viewer
which command # Location of a command
```
---
## Exercise: Command Practice {.center}
What do the following Linux commands do? How might they be used on the HPC service?
---
## Exercise Questions
::: {.fragment}
- `ls` - ?
:::
::: {.fragment}
- `pwd` - ?
:::
::: {.fragment}
- `mkdir` - ?
:::
::: {.fragment}
- `cp` - ?
:::
::: {.fragment}
- `wget` - ?
:::
::: {.fragment}
- `rm` - ?
:::
---
## Exercise Answers
- `ls` - **List files and directories** (see what's available)
- `pwd` - **Print working directory** (know where you are)
- `mkdir` - **Make directory** (organize your work)
- `cp` - **Copy files** (backup important data)
- `wget` - **Download files from web** (get datasets, software)
- `rm` - **Remove files** (clean up files)
---
## Getting More Help
::: {.fragment}
- `man command` - Manual pages for any command
- `command --help` - Quick help for most commands
- [Linux Cheat Sheet](https://arctraining.github.io/rc-slides/linux101#/cheat-sheet)
- [Introduction to Linux for HPC](https://arctraining.github.io/rc-slides/linux101#/section)
:::
---
## Next Steps {.center}
Now you're ready to work on the command line!
Let's learn about [storage systems on HPC](storage.html)