Skip to content
Snippets Groups Projects
Commit b18205b9 authored by jacques.dainat_ird.fr's avatar jacques.dainat_ird.fr
Browse files

improvements

parent bdce483f
No related branches found
No related tags found
No related merge requests found
Pipeline #2538 passed
...@@ -57,7 +57,7 @@ You will end up in a window that represent the inside of your file, with the cur ...@@ -57,7 +57,7 @@ You will end up in a window that represent the inside of your file, with the cur
![](../images/4-creation/nano.png){: style="height:250px"} ![](../images/4-creation/nano.png){: style="height:250px"}
Try to display the help `^G`. Not easy isnt'it? But it is like that, no way to make it easier... Depending the command line editor the command that can be executed and their key combinations differ. With nano what is conveniant it's that we do not need a command cheatsheets, the commands are described before our very eyes. Try to display the help `^G`. Not easy isnt'it? But it is like that, no way to make it easier... Depending the command line editor the command that can be executed and their key combinations differ. The great thing about `**nano** is that you do not need a cheat sheet of commands, they are right there in front of you.
Let's now write someting: `I love guacamole` Let's now write someting: `I love guacamole`
and save the result with `^O` and save the result with `^O`
...@@ -145,24 +145,36 @@ Let's practice a bit more and by trying to copy the entire `script` folder this ...@@ -145,24 +145,36 @@ Let's practice a bit more and by trying to copy the entire `script` folder this
### Your first globbing ### Your first globbing
Before running you analysis you also need some data. Let's copy in the fastq files present in the `data` folder. Before running your analysis you also need some data. Let's copy in the fastq files present in the `data` folder.
You could use the `cp` command for all the files one by one as we have seen previously. You could use the `cp` command for all the files one by one as we have seen previously.
But imagine you have hundred of those `fastq` files? But imagine you have hundred of those `fastq` files?
Well Bash does carry out a very powerful feature, the `filename expansion`, a process known as globbing! (to not confound with regular expressions). Well Bash does carry out a very powerful feature, the `filename expansion`, a process known as globbing! (to not confound with regular expressions).
Here the list of globbing: **Here the list of globbing:**
`?` Any single character | wildcard characters | meaning |
`*` Zero or more characters | :-: | :-: |
`[]` Specify a range. Any character of the range or none of them by using ! inside the bracket. | `?` | Any single character |
`{term1,term2}` Specify a list of terms separated by commas and each term must be a name or a | `*` | Zero or more characters |
wildcard. | `[]` | Specify a range. Any character of the range or none of them by using `!` inside the bracket.|
`{term1..term2}` Called brace expansion, this syntax | `{term1,term2}` | Specify a list of terms separated by commas and each term must be a name or a wildcard.|
expands all the terms between term1 and term2 (Letters or Integers). | `{term1..term2}` | Called brace expansion, this syntax expands all the terms between term1 and term2 (Letters or Integers).|
For now you just has to rember the most important one, `*`. !!! question "Using `ls` how would you list the fastq files available in the `data` folder (and only the fastq files!) ?"
Let's now copy the fastq files using the `*` filename expansion. ??? example "Click to show the solution"
```bash
ls ../data/data?.fastq
```
This one works but if we had a file called `dataPE.fastq` it would not appear because only a single character is expected between `data` and `.fastq` while here it would be `PE`.
```bash
ls ../data/*.fastq
```
Excellent this one match all files ending in `.fastq`.
For now the most important one you have to rember is `*`.
Let's now copy all the fastq files using a single command thanks to the `*` filename expansion.
??? example "Click to show the solution" ??? example "Click to show the solution"
```bash ```bash
...@@ -268,7 +280,7 @@ ln existing_file [hard_link_name] ...@@ -268,7 +280,7 @@ ln existing_file [hard_link_name]
ln ../data/data1.fa data1_hard.fa ln ../data/data1.fa data1_hard.fa
``` ```
Run again `ls -l`. Run again `ls -l`.
The second column is the number of hard links to the file. (For a directory, the number of hard links is the number of immediate subdirectories it has plus its parent directory and itself) We can see that we have currrently 3 "files" pointing to the same inode. The second column is the number of hard links to the file. (For a directory, the number of hard links is the number of immediate subdirectories it has plus its parent directory and itself) We can see that we have currently 3 "files" pointing to the same inode.
### Soft link ### Soft link
...@@ -291,7 +303,7 @@ ln -s existing_file [soft_link_name] ...@@ -291,7 +303,7 @@ ln -s existing_file [soft_link_name]
Run `ls -l`. What do you see? Run `ls -l`. What do you see?
??? example "Click to show the solution" ??? example "Click to show the solution"
There is an extra arrow showing to what file my link point to. There is an extra arrow showing to what file my link point to.
Create a Hard link of the `script/script1.sh` file and run again `ls -l` Create a Soft link of the `script/script1.sh` file and run again `ls -l`
??? example "Click to show the solution" ??? example "Click to show the solution"
```bash ```bash
ln -s ../data/data1.fa ln -s ../data/data1.fa
......
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment