@@ -191,19 +191,46 @@ cd ~/te <Tab>
191
191
tests/ tmp/
192
192
```
193
193
194
+ #### Redirection
195
+
196
+ This course uses the redirection pipes ` > ` to "pipe" what is on the left of the symbol into the file give on the
197
+ right. A single ` > ` will over-write any contents in the file if it already exists. If you want to append something to a
198
+ file you can use ` >> ` instead.
199
+
194
200
#### History
195
201
196
202
Bash keeps a record of the commands you use in its ` history ` . You can view _ all_ your history by simply typing
197
203
` history ` .
198
204
199
205
``` bash
200
206
history
201
-
207
+ ...
202
208
cd work
203
209
mkdir git
204
210
git clone git@github.com:ns-rse/python-maths
205
211
```
206
212
213
+ You can recall previous commands using the ` Ctrl + p ` or the Up arrow, each press takes you to the ` p ` revious command in
214
+ the history. You can move forwards to the ` n ` ext command using ` Ctrl + n ` or the Down arrow. When you get to the command
215
+ you want simply hit ` Return ` to execute it.
216
+
217
+ This is really useful but what if there is a command you know you've used at some point in the past but it wasn't
218
+ recently? It could take a long time going back through the history one command at a time. Fortunately you can search
219
+ your history for a command using ` Ctrl + r ` to carry out a "reverse search" on the term you enter. Each subsequent press
220
+ of ` Ctrl + r ` will go the previous match.
221
+
222
+ ::::::::::::::::::::::::::::::::::::: callout
223
+
224
+ ## Readline Library
225
+
226
+ There are a lot of useful key chords that have evolved over the years which make navigating on the command line easier
227
+ and faster. They have been collected into the [ Readline library] [ readline ] .
228
+
229
+ These are available not just in Bash but many other command line interfaces (CLI) and learning them will make you
230
+ quicker when working at the command line. A useful [ cheatsheet] [ readlinecheat ] is available.
231
+
232
+ ::::::::::::::::::::::::::::::::::::::::::::::::
233
+
207
234
### Nano
208
235
209
236
[ Nano] [ nano ] is a basic terminal editor, you open files by calling ` nano <path/to/filename> ` , there is a useful [ nano
@@ -231,7 +258,7 @@ When done editing you need to exit and return to the command line, you do this w
231
258
232
259
::::::::::::::::::::::::::::::::::::: callout
233
260
234
- #### Useful alias
261
+ ## Useful alias
235
262
236
263
You may want to set the following alias in your ` ~/.bashrc ` file, it sets various options. You can then `source
237
264
~ /.bashrc` to
@@ -697,6 +724,8 @@ the most well known but there are many others including [BitBucket][bitbucket],
697
724
[ pytest ] : https://docs.pytest.org/
698
725
[ rustGithub ] : https://github.com/rust-lang/rust
699
726
[ r ] : https://www.r-project.org/
727
+ [ readline ] : https://tiswww.cwru.edu/php/chet/readline/rltop.html
728
+ [ readlinecheat ] : https://readline.kablamo.org/emacs.html
700
729
[ snapcast ] : https://mjaggard.github.io/snapcast/
701
730
[ sourcehut ] : https://sourcehut.org/
702
731
[ swCarpentryGit ] : https://swcarpentry.github.io/git-novice/
0 commit comments