Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • main
  • master
  • 2023
  • ci_2025
  • review_2025
5 results

Target

Select target project
  • can/unix-command-line
  • gdurif/unix-command-line_dev
2 results
Select Git revision
  • main
  • master
  • quarto-refactor
3 results
Show changes
Commits on Source (26)
Showing
with 1436 additions and 373 deletions
pages:
stage: deploy
image: rocker/tidyverse
image: ghcr.io/quarto-dev/quarto
script:
- apt update && apt install -y libxt6
- quarto -v
- |
quarto render
......@@ -12,5 +11,7 @@ pages:
artifacts:
paths:
- public
rules:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
......@@ -3,36 +3,27 @@ title: Install system programs
author: "Laurent Modolo"
---
```{r include = FALSE}
if (!require("fontawesome")) {
install.packages("fontawesome")
}
library(fontawesome)
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(comment = NA)
```
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" />
</a>
Objective: Learn how to install programs in GNU/Linux
As we have seen in the [4 Unix file system](http://perso.ens-lyon.fr/laurent.modolo/unix/4_unix_file_system.html#lib-and-usrlib) session, programs are files that contain instruction for the computer to do things. Those files can be in binary or text format (with a [shebang](http://perso.ens-lyon.fr/laurent.modolo/unix/9_batch_processing.html#shebang)). Any of those files, present in a folder of the [**PATH**](http://perso.ens-lyon.fr/laurent.modolo/unix/9_batch_processing.html#path) variable are executable anywhere by the user. For system wide installation, the program files are copied within shared folder path containained in the [**PATH**](http://perso.ens-lyon.fr/laurent.modolo/unix/9_batch_processing.html#path) variable.
As we have seen in the [4 Unix file system](http://perso.ens-lyon.fr/laurent.modolo/unix/4_unix_file_system.html#lib-and-usrlib) session, programs are files that contain instruction for the computer to do things. Those files can be in binary or text format (with a [shebang](http://perso.ens-lyon.fr/laurent.modolo/unix/9_batch_processing.html#shebang)). Any of those files, present in a folder of the [**PATH**](http://perso.ens-lyon.fr/laurent.modolo/unix/9_batch_processing.html#path) variable are executable anywhere by the user. For system-wide installation, the program files are copied within shared folder path contained in the [**PATH**](http://perso.ens-lyon.fr/laurent.modolo/unix/9_batch_processing.html#path) variable.
Developers dont want to reinvent the wheel each time they want to write complex instruction in their programs, this is why they use shared library of pre-written complex instruction. This allows for quicker development, fewer bugs (we only have to debug the library once and use it many times), and also [better memory management](http://perso.ens-lyon.fr/laurent.modolo/unix/6_unix_processes.html#processes-tree) (we only load the library once and it can be used by different programs).
Developers don't want to reinvent the wheel each time they want to write complex instruction in their programs, this is why they use a shared library of pre-written complex instruction. This allows for quicker development, fewer bugs (we only have to debug the library once and use it many times), and also [better memory management](http://perso.ens-lyon.fr/laurent.modolo/unix/6_unix_processes.html#processes-tree) (we only load the library once and it can be used by different programs).
## Package Manager
However, interdependencies between programs and libraries can be a nightmare to handle manually this is why most of the time when you install a program you will use a [package manager](https://en.wikipedia.org/wiki/Package_manager). [Package managers](https://en.wikipedia.org/wiki/Package_manager) are system tools that will handle automatically all the dependencies of a program. They rely on **repositories** of programs and library which contains all the information about the trees of dependence and the corresponding files (**packages**).
However, interdependencies between programs and libraries can be a nightmare to handle manually this is why most of the time when you install a program you will use a [package manager](https://en.wikipedia.org/wiki/Package_manager). [Package managers](https://en.wikipedia.org/wiki/Package_manager) are system tools that will handle automatically all the dependencies of a program. They rely on **repositories** of programs and library which contain all the information about the trees of dependence and the corresponding files (**packages**).
Systemwide installation steps:
System-wide installation steps:
- The user asks the package manager to install a program
- The **package manager** queries its repository lists to search for the most recent **package** version of the program (or a specific version)
- The **package manager** construct the dependency tree of the program
- The **package manager** check that the new dependency tree is compatible with every other installed program
- The **package manager** install the program **package** and all its dependencies **packages** in their correct version
- The **package manager** constructs the dependency tree of the program
- The **package manager** checks that the new dependency tree is compatible with every other installed program
- The **package manager** installs the program **package** and all its dependencies **packages** in their correct version
The main difference between GNU/Linux distribution is the package manager they use
......@@ -43,7 +34,7 @@ The main difference between GNU/Linux distribution is the package manager they u
- Gentoo: [portage](https://en.wikipedia.org/wiki/Portage_(software))
- Alpine: [apk](https://wiki.alpinelinux.org/wiki/Alpine_newbie_apk_packages)
Packages manager install the packages in **root** owned folders, you need **root** access to be able to use them.
Packages manager install the packages in **root** owned folders, you need **root** access to use them.
<details><summary>Solution</summary>
<p>
......@@ -57,7 +48,7 @@ docker run -it --volume /:/root/chroot alpine sh -c "chroot /root/chroot /bin/ba
**R** is a complex program that relies on loots of dependencies. Your current VM run on Ubuntu, so we are going to use the `apt` tool (`apt-get` is the older version of the `apt` command, `synaptic` is a graphical interface for `apt-get`).
You can check the **r-base** package dependencies on the website [packages.ubuntu.com](https://packages.ubuntu.com/focal/r-base). Not too much dependency ? Check the sub-package **r-base-core**.
You can check the **r-base** package dependencies on the website [packages.ubuntu.com](https://packages.ubuntu.com/focal/r-base). Not too much dependency? Check the sub-package **r-base-core**.
You can check the **man**ual of the `apt` command to install **r-base-core**.
......@@ -69,7 +60,7 @@ sudo apt install r-base-core
</p>
</details>
What is the **R** version that you installed ? Is there a newer version of **R** ?
What is the **R** version that you installed? Is there a newer version of **R**?
### Adding a new repository
......@@ -78,10 +69,10 @@ You can check the list of repositories that `apt` checks in the file `/etc/apt/s
You can add the official cran repository to your repositories list:
```sh
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu <release_name>-cran40/'
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
```
You can use the command `lsb_release -sc` to get your **release name**.
The command `lsb_release -sc` automatically fetches your distribution **release name**.
Then you must add the public key of this repository:
......@@ -91,7 +82,7 @@ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD
### Updating the repository list
You can now use `apt` to update your repository list dans try to reinstall **r-base-core**
You can now use `apt` to update your repository list and try to reinstall **r-base-core**
<details><summary>Solution</summary>
<p>
......@@ -101,7 +92,7 @@ sudo apt update
</p>
</details>
The command gives you a way to list all the upgradable **packages**, which version of **R** can you install now ?
The command gives you a way to list all the upgradable **packages**, which version of **R** can you install now?
You can upgrade all the upgradable **packages**.
......@@ -113,7 +104,7 @@ sudo apt upgrade
</p>
</details>
With the combination of `update` and `upgrade` you can keep your whole system up to date the even the kernel files is just another package. You can use `apt` to search for the various versions of the `linux-image`.
With the combination of `update` and `upgrade`, you can keep your whole system up to date the even the kernel files are just another package. You can use `apt` to search for the various versions of the `linux-image`.
<details><summary>Solution</summary>
<p>
......@@ -124,10 +115,9 @@ sudo apt search linux-image
</details>
### Language specific package manager
If its not a good idea to have different **package manager** on the same system (they dont know how the dependencies are handled by the other’s manager). You will also encounter language specific package manager:
If it's not a good idea to have different **package manager** on the same system (they don't know how the dependencies are handled by the other managers). You will also encounter language specific package manager:
- `ppm` for Perl
- `pip` for Python
......@@ -138,7 +128,7 @@ If it’s not a good idea to have different **package manager** on the same syst
These **package managers** allow you to make installation local to the user, which is advisable to avoid any conflict with the **packages manager** of the system.
For example, you can use the following command to install `glances` system wide with `pip`
For example, you can use the following command to install `glances` system-wide with `pip`
```sh
sudo pip3 install glances
......@@ -146,15 +136,14 @@ sudo pip3 install glances
You can now try to install `glances` with `apt`
What is the `glances` version installed with `apt`, what is the one installed with `pip` ? What is the version of the `glances` of your **PATH** ?
What is the `glances` version installed with `apt`, what is the one installed with `pip`? What is the version of the `glances` in your **PATH**?
Next-time use `pip` with the `--user` switch.
## Manual installation
Sometimes, a specific tool that you want to use will not be available through a **package manager**. If you are lucky, you will find a **package** for your distribution. For `apt` the **package** are `.deb` files.
Sometimes, a specific tool that you want to use will not be available through a **package manager**. If you are lucky, you will find a **package** for your distribution. For `apt`, the **package** are `.deb` files.
For example, you can download `simplenote` version 2.7.0 for your architecture [here](https://github.com/Automattic/simplenote-electron/releases/tag/v2.7.0).
......@@ -182,9 +171,9 @@ wget https://github.com/Automattic/simplenote-electron/archive/v2.7.0.tar.gz
You can use the command `tar -xvf` to extract this archive
When you go into the `simplenote-electron-2.7.0` folder, you can see a `Makefile` this means that you can use the `make` command to build Simplenote from those files. `make` is a tool that read recipes (`Makefiles`) to build programs.
When you go into the `simplenote-electron-2.7.0` folder, you can see a `Makefile`. This means that you can use the `make` command to build Simplenote from those files. `make` is a tool that read recipes (`Makefiles`) to build programs.
You can try to install `node` and `npx` with `apt`. What happened ?
You can try to install `node` and `npx` with `apt`. What happened?
<details><summary>Solution</summary>
<p>
......@@ -204,7 +193,7 @@ sudo apt install libnss3
</p>
</details>
What now ? Installing dependencies manually is an iterative process...
What now? Installing dependencies manually is an iterative process...
<details><summary>Solution</summary>
<p>
......@@ -214,9 +203,9 @@ sudo apt install libnss3 libatk1.0-dev libatk-bridge2.0-0 libgdk-pixbuf2.0-0 lib
</p>
</details>
Yay we should have every lib !
Yay we should have every lib!
What now ? A nodejs dependency is missing... After, some query on the internet we can find the solution...
What now? A nodejs dependency is missing... After, some query on the internet we can find the solution...
<details><summary>Solution</summary>
<p>
......@@ -227,9 +216,9 @@ npm install --save-dev electron-window-state
</p>
</details>
And now you understand why program packaging takes time in a project, and why its important !
And now you understand why program packaging takes time in a project, and why it's important!
You can finalize the installation with the command `make install`. Usually the command to build a tool is available in the `README.md` file of the project.
You can finalize the installation with the command `make install`. Usually, the command to build a tool is available in the `README.md` file of the project.
Read the `README` file of the [fastp](https://github.com/OpenGene/fastp) program to see which methods of installation are available.
......
......@@ -3,15 +3,6 @@ title: Virtualization
author: "Laurent Modolo"
---
```{r include = FALSE}
if (!require("fontawesome")) {
install.packages("fontawesome")
}
library(fontawesome)
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(comment = NA)
```
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" />
</a>
......@@ -23,8 +14,8 @@ If a computer can run any programs, it can also run a program simulating another
You can save the state of the whole **guest** system using a **snapshot**. The **snapshots** can then be executed on any other **hypervisor**. This as several benefits:
- If the **host** has a hardware failure, the **snapshots** can be executed on another **host** to avoid service interruption
- For scalable system, as many **guest** systems as necessary can be launched adaptively on many **host** systems to handle peak consumption. When the peak is over, we can easily stop the additional **guest** systems.
- For computing science a **snapshot** of a suite of tools allows to you run the same computation as it also captures all the software (and simulated) hardware environment.
- For scalable systems, as many **guest** systems as necessary can be launched adaptively on many **host** systems to handle peak consumption. When the peak is over, we can easily stop the additional **guest** systems.
- For computing sciences, a **snapshot** of a suite of tools allows to you run the same computation as it also captures all the software (and simulated) hardware environment.
To avoid the overhead of simulating every component of the **guest** system, which means that the **hypervisor** programs must run code that simulates a given hardware and code that simulate the **guest** programs running on this hardware, some part of the **host** system can be shared (with control) with the **guest** system.
......@@ -32,13 +23,13 @@ There are different levels of virtualisation which correspond to different level
## Full virtualization
A key challenge for full virtualization is the interception and simulation of privileged operations, such as I/O instructions. The effects of every operation performed within a given virtual machine must be kept within that virtual machine virtual operation cannot be allowed to alter the state of any other virtual machine, the control program, or the hardware. Some machine instructions can be executed directly by the hardware, since their effects are entirely contained within the elements managed by the control program, such as memory locations and arithmetic registers. But other instructions that would "pierce the virtual machine" cannot be allowed to execute directly; they must instead be trapped and simulated. Such instructions either access or affect state information that is outside the virtual machine.
A key challenge for full virtualization is the interception and simulation of privileged operations, such as I/O instructions. The effects of every operation performed within a given virtual machine must be kept within that virtual machine; virtual operations cannot be allowed to alter the state of any other virtual machine, the control program, or the hardware. Some machine instructions can be executed directly by the hardware, since their effects are entirely contained within the elements managed by the control program, such as memory locations and arithmetic registers. But other instructions that would "pierce the virtual machine" cannot be allowed to execute directly; they must instead be trapped and simulated. Such instructions either access or affect state information that is outside the virtual machine.
## Paravirtualization
In paravitualization, the virtual hardware of the **guest** system is similar to the hardware of the **host**. The goal is to reduce the portion of the **guest** execution time spent to simulate hardware which is the same as the **host** hardware. The paravirtualization provides specially defined **hooks** to allow the **guest** and **host** to request and acknowledge these tasks, which would otherwise be executed in the virtual domain (where execution performance is worse).
A hypervisor provides the virtualization of the underlying computer system. In [full virtualization](https://en.wikipedia.org/wiki/Full_virtualization), a guest operating system runs unmodified on a hypervisor. However, improved performance and efficiency is achieved by having the guest operating system communicate with the hypervisor. By allowing the guest operating system to indicate its intent to the hypervisor, each can cooperate to obtain better performance when running in a virtual machine. This type of communication is referred to as paravirtualization.
A hypervisor provides the virtualization of the underlying computer system. In [full virtualization](https://en.wikipedia.org/wiki/Full_virtualization), a guest operating system runs unmodified on a hypervisor. However, improved performance and efficiency is achieved by having the guest operating system communicate with the hypervisor. By allowing the guest operating system to indicate its intent to the hypervisor, each can cooperate to obtain better performance when running in a virtual machine. This type of communication is referred to as paravirtualization.
## OS-level virtualization
......@@ -63,7 +54,7 @@ sudo apt install virtualbox
sudo usermod -G vboxusers -a $USER
```
The first thing that we need to do with virtual box is to create a new virtual machine. We want to install Ubuntu 20.04 on it.
The first thing that we need to do with a virtual box is to create a new virtual machine. We want to install Ubuntu 20.04 on it.
```sh
VBoxManage createvm --name Ubuntu20.04 --register
......@@ -87,20 +78,20 @@ We set the virtual RAM
VBoxManage modifyvm Ubuntu20.04 --memory 1024
```
We add a virtual IDE peripheric storage on which we can boot on.
We add a virtual IDE storage device on which we can boot on.
```sh
VBoxManage storagectl Ubuntu20.04 --name IDE --add ide --controller PIIX4 --bootable on
```
And add an ubuntu image to this IDE device
And add an Ubuntu image to this IDE device
```sh
wget https://releases.ubuntu.com/20.10/ubuntu-20.10-live-server-amd64.iso
VBoxManage storageattach Ubuntu20.04 --storagectl IDE --port 0 --device 0 --type dvddrive --medium "/home/etudiant/ubuntu-20.10-live-server-amd64.iso"
```
Add a network interface
Then, add a network interface
```sh
VBoxManage modifyvm Ubuntu20.04 --nic1 nat --nictype1 82540EM --cableconnected1 on
......@@ -112,7 +103,8 @@ And then start the VM to launch the `ubuntu-20.10-live-server-amd64.iso` install
VBoxManage startvm Ubuntu20.04
```
Why did this last command fail ? Which kind of virtualisation VirtualBox is using ?
Why did this last command fail? Which kind of virtualisation VirtualBox is using?
## Docker
......@@ -130,7 +122,7 @@ Launching a container
docker run -it alpine:latest
```
You can check your user name
You can check your username
<details><summary>Solution</summary>
<p>
......@@ -146,7 +138,7 @@ Launching a background container
docker run -d -p 8787:8787 -e PASSWORD=yourpasswordhere rocker/rstudio:3.2.0
```
You can check the running container with :
You can check the running container with:
```sh
docker ps
......@@ -176,19 +168,19 @@ Deleting a container image
docker rmi rocker/rstudio:3.2.0
```
Try to run the `mcr.microsoft.com/windows/servercore:ltsc2019` container, what is happening ?
Try to run the `mcr.microsoft.com/windows/servercore:ltsc2019` container. What is happening?
### Building your own container
You can also create your own container by writing a container recipe. For Docker this file is named `Dockerfile`
You can also create your own container by writing a container recipe. For Docker this file is named `Dockerfile`.
The first line of such recipe is a `FROM` statement. You don't start from scratch like in VirtualBox, but from a bare distribution:
The first line of a `Dockerfile` contains a `FROM` statement. You don't start from scratch like in VirtualBox, but from a bare distribution:
```dockerfile
FROM ubuntu:20.04
```
From this point you can add instructions
From this point, you can add instructions
`COPY` will copy files from the `Dockerfile` directory to a path inside the container
......@@ -196,7 +188,7 @@ From this point you can add instructions
COPY .bashrc /
```
`RUN`will execute command inside the container
`RUN`will execute commands inside the container
```dockerfile
RUN apt updatge && apt install -y htop
......@@ -227,7 +219,7 @@ Launching a container
singularity run docker://alpine:latest
```
You can check your user name
You can check your username
<details><summary>Solution</summary>
<p>
......@@ -243,4 +235,3 @@ Executing a command within a container
```sh
singularity exec docker://alpine:latest apk
```
......@@ -3,22 +3,13 @@ title: Understanding a computer
author: "Laurent Modolo"
---
```{r include = FALSE}
if (!require("fontawesome")) {
install.packages("fontawesome")
}
library(fontawesome)
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(comment = NA)
```
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" />
</a>
Objective: understand the relations between the different components of a computer
## Which parts are necessary to define a computer ?
## Which parts are necessary to define a computer?
## Computer components
......@@ -57,9 +48,9 @@ Objective: understand the relations between the different components of a comput
---
## As simple as a Turing machine ?
## As simple as a Turing machine?
![Universal Truing Machine](./img/universal_truing_machine.png){width=100%}
![Universal Turing Machine](./img/universal_truing_machine.png){width=100%}
- A tape divided into cells, one next to the other. Each cell contains a symbol from some finite alphabet.
- A head that can read and write symbols on the tape and move the tape left and right one (and only one) cell at a time.
......@@ -72,9 +63,9 @@ Objective: understand the relations between the different components of a comput
> Used to perform hardware initialization during the booting process (power-on startup), and to provide runtime services for operating systems and programs.
- comes pre-installed on a personal computer's system board
- the first software to run when powered on
- in modern PCs initializes and tests the system hardware components, and loads a boot loader from a mass memory device
- Comes pre-installed on a personal computer's system board
- The first software to run when powered on
- In modern PCs, it initializes and tests the system hardware components, and loads a boot loader from a mass memory device
---
......@@ -104,7 +95,7 @@ Disadvantages:
### Kernel
> The kernel provides the most basic level of control over all of the computer's hardware devices. It manages memory access for programs in the RAM, it determines which programs get access to which hardware resources, it sets up or resets the CPU's operating states for optimal operation at all times, and it organizes the data for long-term non-volatile storage with file systems on such media as disks, tapes, flash memory, etc.
> The kernel provides the most basic level of control over all of the computer's hardware devices. It manages memory access for programs in the RAM, determines which programs get access to which hardware resources, sets up or resets the CPU's operating states for optimal operation at all times, and it organizes the data for long-term non-volatile storage with file systems on such media as disks, tapes, flash memory, etc.
![Kernel](./img/220px-Kernel_Layout.svg.png){width=100%}
......@@ -112,7 +103,7 @@ Disadvantages:
## UNIX
> Unix is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix,
> Unix is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix.
[![Unix history](./img/1920px-Unix_timeline.en.svg.png){width=100%}](https://upload.wikimedia.org/wikipedia/commons/b/b5/Linux_Distribution_Timeline_21_10_2021.svg)
......@@ -122,18 +113,18 @@ The ones you are likely to encounter:
- [BSD (Berkeley Software Distribution) variant](https://www.freebsd.org/)
- [GNU/Linux](https://www.kernel.org/)
The philosophy of UNIX is to have a large number of small software which do few things but to them well.
The philosophy of UNIX is to have a large number of small software which do a few things but do them well.
## GNU/Linux
Linux is the name of the kernel which software, to get a full OS, Linux is part of the [GNU Project](https://www.gnu.org/).
Linux is the name of the kernel which, combined with GNU, gives a full OS. Linux is part of the [GNU Project](https://www.gnu.org/).
The GNU with Richard Stallman introduced the notion of Free Software:
The GNU project, with Richard Stallman, introduced the notion of Free Software:
1. The freedom to run the program as you wish, for any purpose.
2. The freedom to study how the program works, and change it so it does your computing as you wish. Access to the source code is a precondition for this.
3. The freedom to redistribute copies so you can help others.
4. The freedom to distribute copies of your modified versions to others. By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.
4. The freedom to distribute copies of your modified versions to others. By doing this, you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.
You can find a [list of software licenses](https://www.gnu.org/licenses/license-list.html)
......@@ -142,7 +133,7 @@ You can find a [list of software licenses](https://www.gnu.org/licenses/license-
Your browser does not support the video tag.
</video>
See this [presentation](https://plmlab.math.cnrs.fr/gdurif/presentation_foss/-/blob/main/presentation/presentation_DURIF_foss.pdf) (in french) for a quick introduction about **software license** and **free/open source software**.
See this [presentation](https://plmlab.math.cnrs.fr/gdurif/presentation_foss/-/blob/main/presentation/presentation_DURIF_foss.pdf) (in french) for a quick introduction about **software licenses** and **free/open source software**.
[Instead of installing GNU/Linux on your computer, you are going to learn to use the IFB Cloud.](./2_using_the_ifb_cloud.html)
......@@ -3,22 +3,13 @@ title: IFB (Institut Français de bio-informatique) Cloud
author: "Laurent Modolo"
---
```{r include = FALSE}
if (!require("fontawesome")) {
install.packages("fontawesome")
}
library(fontawesome)
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(comment = NA)
```
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" />
</a>
Objective: Start and connect to an appliance on the IFB cloud
Instead of working on your computer where you don't have an Unix-like OS or have limited right, we are going to use the [IFB (Institut Français de bio-informatique) Cloud]( https://biosphere.france-bioinformatique.fr/).
Instead of working on your computer where you don't have a Unix-like OS or have limited rights, we are going to use the [IFB (Institut Français de bio-informatique) Cloud]( https://biosphere.france-bioinformatique.fr/).
## Creating an IFB account
......@@ -27,9 +18,9 @@ Instead of working on your computer where you don't have an Unix-like OS or have
3. Then click on ![login](./img/login_ifb.png)
4. Use the **Incremental search field** to select your identity provider (CNRS / ENS de Lyon / etc.)
5. Login
6. Complete the form with your **Name**, **First Name**, **Town** and **Zip Code**. You can ignore the other field and click on **accept**.
6. Complete the form with your **Name**, **First Name**, **Town** and **Zip Code**. You can ignore the other fields and click on **accept**.
7. Go to your **Groups** parameters on the top right ![group_selection_ifb](./img/group_selection_ifb.png)
8. Click on ![join_a_group](./img/join_a_group.png) and type **LBMC Unix 2022**
8. Click on ![join_a_group](./img/join_a_group.png) and type **CAN UNIX 2023**
9. You can click on the **+** sign to register and wait to be accepted in the group
## Starting the LBMC Unix 2022 appliance
......@@ -58,11 +49,11 @@ The ![hourglass](./img/wait_my_appliances_ifb.png) symbol indicates that your ap
## Accessing the LBMC Unix 2022
You can open the **https** link next to the termination button of your appliance in a new tab. You will have the following message
You can open the **https** link next to the termination button of your appliance in a new tab. You will have the following message.
![ssl warning](./img/ssl_warning.png)
This means that the https connection is encrypted with a certificate unknown to your browser. As this certificate is going to be destroyed when you terminate your appliance, we don't want to pay a certification authority to validate it. Therefore you can safely add an exception for this certificate.
This means that the https connection is encrypted with a certificate unknown to your browser. As this certificate is going to be destroyed when you terminate your appliance, we don't want to pay a certification authority to validate it. Therefore, you can safely add an exception for this certificate.
![ssl exception](./img/ssl_exception.png)
......@@ -88,8 +79,8 @@ To copy / paste your password, you will need to perform a right-click and select
![past from browser](./img/shellinabox_past_from_browser.png)
Then paste your password in the dialog box.
Then, paste your password in the dialog box.
Don't worry the password will not be displayed (not even in the form of `*****`, so someone looking at your screen will not be able to guess it's length), you can press **enter** to log on your VM.
Don't worry the password will not be displayed (not even as `*****`, so someone looking at your screen cannot guess it's length), you can press **enter** to log on your VM.
[First steps in a terminal.](./3_first_steps_in_a_terminal.html)
......@@ -3,48 +3,39 @@ title: First step in a terminal
author: "Laurent Modolo"
---
```{r include = FALSE}
if (!require("fontawesome")) {
install.packages("fontawesome")
}
library(fontawesome)
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(comment = NA)
```
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" />
</a>
Objective: learn to use basic terminal command
Objective: learn to use basic terminal commands
Congratulations you are now connected on your VM !
Congratulations, you are now connected to your VM!
The first thing that you can see is a welcome message (yes GNU/Linux users are polite and friendly), and information on your distribution.
The first thing that you can see is a welcome message (yes, GNU/Linux users are polite and friendly), and information on your distribution.
> A **Linux distribution** (often abbreviated as **distro**) is an [operating system](https://en.wikipedia.org/wiki/Operating_system) made from a software collection that is based upon the [Linux kernel](https://en.wikipedia.org/wiki/Linux_kernel)
What is the distribution installed on your VM ?
What is the distribution installed on your VM?
You can go to this distribution website and have a look at the list of firms using it.
## Shell
A command-line interpreter (or shell), is a software designed to read lines of text entered by a user to interact with an OS.
A command-line interpreter (or shell) is a software designed to read lines of text entered by a user to interact with an OS.
To simplify the shell executes the following infinite loop:
1. read a line
2. translate this line as a program execution with its parameters
3. launch the corresponding program with the parameters
3. wait for the program to finish
1. Read a line
2. Translate this line as a program execution with its parameters
3. Launch the corresponding program with the parameters
3. Wait for the program to finish
4. Go back to 1.
When you open a terminal on an Unix-like OS, you will have a **prompt** displayed: it can end with a `$` or a `%` character depending on your configuration. As long as you see your prompt, it means that you are in step **1.**, if no prompt is visible, you are in step **4.** or you have set up a very minimalist configuration for your shell.
When you open a terminal on a Unix-like OS, you will have a **prompt** displayed: it can end with a `$` or a `%` character depending on your configuration. As long as you see your prompt, it means that you are in step **1.**, if no prompt is visible, you are in step **4.** or you have set up a very minimalist configuration for your shell.
<img src="./img/prompt.png" alt="prompt" style="zoom:150%;" />
The blinking square or vertical bar represents your **cursor**. Shell predates graphical interfaces, so most of the time you wont be able to move this cursor with your mouse, but with the **directional arrows** (left and right).
The blinking square or vertical bar represents your **cursor**. Shell predates graphical interfaces, so most of the time you won't be able to move this cursor with your mouse, but with the **directional arrows** (left and right).
On the IFB, your prompt is a `$`:
......@@ -54,7 +45,7 @@ etudiant@VM:~$
You can identify the following information from your prompt: **etudiant** is your login and **VM** is the name of your VM (`~` is where you are on the computer, i.e. the current working directory, but we will come back to that later).
On Ubuntu 20.04, the default shell is [Bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) while on recent version of macOS its [zsh](https://en.wikipedia.org/wiki/Z_shell). There are [many different shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters), for example, Ubuntu 20.04 also has [sh](https://en.wikipedia.org/wiki/Bourne_shell) installed.
On Ubuntu 20.04, the default shell is [Bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) while on recent version of macOS it's [zsh](https://en.wikipedia.org/wiki/Z_shell). There are [many different shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters), for example, Ubuntu 20.04 also has [sh](https://en.wikipedia.org/wiki/Bourne_shell) installed.
## Launching Programs
......@@ -64,9 +55,9 @@ You can launch every program present on your computer from the shell. The syntax
etudiant@VM:~$ program_name option_a option_b option_c [...] option_n
```
And pressing **enter** to execute your command.
And pressing the **Enter** key to execute your command.
For example, we can launch the `cal` software by typing the following command and pressing **enter**:
For example, we can launch the `cal` software by typing the following command and pressing **Enter**:
```sh
cal
......@@ -79,24 +70,24 @@ When you launch a command, various things can happen:
- Files can we read or written
- etc.
We can pass argument to the `cal` software the following way.
We can pass an argument to the `cal` software in the following way:
```sh
cal -3
```
What is the effect of the `-3` parameter ?
What is the effect of the `-3` parameter?
You can add as many parameters as you want to your command, try `-3 -1` what is the meaning of the `-1` parameter ?
You can add as many parameters as you want to your command. Try `-3 -1`. What is the meaning of the `-1` parameter?
The `-d` option display the month of a given date in a `yyyy-mm` format. Try to display your month of birth.
The `-d` option displays the month of a date given in a `yyyy-mm` format. Try to display your month of birth.
Traditionally, parameters are *named* which means that they are in the form of:
Traditionally, parameters are *named* in one of two ways:
* `-X` for an on/off option (like `cal -3`)
* `-X something` for an input option (like `cal -d yyyy-mm`)
Here the name of the parameter is `X`, but software can also accept list of unnamed parameters. Try the following:
Here, the name of the parameter is `X`, but software can also accept a list of unnamed parameters. Try the following:
```sh
cal 2
......@@ -104,11 +95,11 @@ cal 1999
cal 2 1999
```
What is the difference for the parameter value `2` in the first and third command ?
What is the difference for the parameter value `2` in the first and third commands?
## Moving around
For the `cal` program, the position in the file system is not important (it’s not going to change the calendar). However, for most tools that are able to read or write files, its important to know where you are. This is the first real difficulty with command line interface: you need to remember where you are.
For the `cal` program, the position in the file system is not important (it will not change the calendar). However, for most tools that can read or write files, it's important to know where you are. This is the first real difficulty with the command line interface: **you need to remember where you are**.
If you are lost, you can **p**rint your **w**orking **d**irectory (i.e., where you are now, working) with the command.
......@@ -116,63 +107,61 @@ If you are lost, you can **p**rint your **w**orking **d**irectory (i.e., where y
pwd
```
Like `cal`, the `pwd` command return textual information
Like `cal`, the `pwd` command returns textual information.
By default when you log on an Unix system, you are in your **HOME** directory. Every user (except one) should have its home directory in the `/home/`folder.
By default when you log on a Unix system, you are in your **HOME** directory. Every user (except one) should have its home directory in the `/home/`folder.
To **c**hange **d**irectory you can type the command `cd`, `cd` take one argument: the path of the directory where you want to go. go to the `/home` directory.
To **c**hange **d**irectory you can type the command `cd`. `cd` takes one argument: the path of the directory where you want to go. To go to the `/home` directory you can use:
```sh
cd /home
```
The `cd` command doesn’t return any textual information, but change the environment of the shell (you can confirm it with ` pwd`) ! You can also see this change in your prompt:
The `cd` command doesn't return any textual information, but changes the environment of the shell (you can confirm it with ` pwd`)! You can also see this change in your prompt:
```sh
`etudiant@VM:/home$`
```
What happens when you type `cd` without any argument ?
What happens when you type `cd` with no arguments?
What is the location shown in your prompt ? Is it coherent with the `pwd` information ? Can you `cd` to the `pwd` path ?
What is the location shown in your prompt? Is it coherent with the `pwd` information? Can you `cd` to the `pwd` path?
When we move around a file system, we often want to see what is in a given folder. We want to **l**i**s**t the directory content. Go back to the `/home` directory and use to the `ls` command see how many people have a home directory there.
When we move around a file system, we often want to see what is in a folder. We want to **l**i**s**t its content. Go back to the `/home` directory and use the `ls` command to see how many users have a home directory there.
We will see various options for the `ls` command, throughout this course. Try the `-a` option.
We will see various options for the `ls` command throughout this course. Try the `-a` option.
```sh
ls -a
```
What changed compared to the `ls` command without this option ?
What changed compared to the `ls` command without this option?
Go to your home folder with the bare `cd` command and run the `ls -a` command again. The `-a` option makes the `ls` command list hidden files and folders. On Unix systems, hidden files and folders are all files and folders whose name starts with a `.`.
Can you `cd` to `.` ?
Can you `cd` to `.`?
```sh
cd .
```
What happened ?
What happened?
Can you cd to `..` ?
Can you cd to `..`?
```sh
cd ..
```
What appended ?
What happened?
Repeat 3 times the previous command (you can use the upper directional arrow to repeat the last command).
Repeat the previous command 3 times (you can use the up arrow key, `↑`, to repeat the last command).
What append ?
What happened?
You can use the `-l` option in combination with the `-a` option to know more about those folders.
> We have seen the commands :
> We have seen the commands:
>
> - `cal` for calendar
> - `cd` for change directory
......
......@@ -3,22 +3,13 @@ title: GNU/Linux file system
author: "Laurent Modolo"
---
```{r include = FALSE}
if (!require("fontawesome")) {
install.packages("fontawesome")
}
library(fontawesome)
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(comment = NA)
```
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" />
</a>
Objective: Understand how files are organized in Unix
> On a UNIX system, everything is a file ; if something is not a file, it is a process.
> On a UNIX system, everything is a file; if something is not a file, it is a process.
>
> Machtelt Garrels
......@@ -58,128 +49,127 @@ To see the file type you can type the command
ls -la
```
The first column will tell you the type of the file (here we have only the type `-` and `d`). We will come back on the other information later. Another less used command to get fine technical information on a file is the command `stat [file_name]`. Can you get the same information as `ls -la` with `stat` ?
The first column will tell you the type of the file (here we have only the types `-` and `d`). We will come back to the other types later. Another less-used command to get fine technical information on a file is the command `stat [file_name]`. Can you get the same information as `ls -la` with `stat`?
## Common Structure
From the root of the system (`/`), most of the Unix-like distribution will share the same folder tree structure. On macOS, the names will be different because when you sell the most advanced system in the world you need to rename things, with more advanced names.
From the root of the system (`/`), most Unix-like distributions will share the same folder tree structure. On macOS, the names will be different because when you sell the most advanced system in the world you need to rename things, with more advanced names.
### `/home`
You already know this one. You will find all your file and your configuration files here. Which configuration file can you identify in your home ?
You already know this one. You will find all your files and your configuration files here. Which configuration files can you identify in your home?
### `/boot`
You can find the Linux kernel and the boot manager there. What is the name of your boot manager (process by elimination) ?
You can find the Linux kernel and the boot manager there. What is the name of your boot manager (proceed by elimination)?
You can see a new type of file here, the type `l`. What it the version of the **vmlinuz** kernel ?
You can see a new type of file here, the type `l`. What it the version of the **vmlinuz** kernel?
### `/root`
The home directory of the super user, also called root (we will go back on him later). Can you check its configuration file ?
The home directory of the superuser, also called root (we will go back to it later). Can you check its configuration file?
### `/bin`, `/sbin`, `/usr/bin` and `/opt`
The folder containing the programs used by the system and its users. Programs are simple file readable by a computer, these files are often in **bin**ary format which means that its extremely difficult for a human to read them.
The folder containing the programs used by the system and its users. Programs are simple files readable by a computer. These files are often in **bin**ary format so it's extremely difficult for a human to read them.
What is the difference between `/bin` and `/usr/bin` ?
What is the difference between `/bin` and `/usr/bin`?
`/sbin` stand for system binary. What are the names of the programs to power off and restart your system ?
`/sbin` stands for system binary. What are the names of the programs used to power off and restart your system?
`/opt` is where you will find the installation of non-conventional programs (if you dont follow [the guide of good practice of the LBMC](http://www.ens-lyon.fr/LBMC/intranet/services-communs/pole-bioinformatique/ressources/good_practice_LBMC), you can put your bioinformatics tools with crapy installation procedure there).
`/opt` is where you will find the installation of non-conventional programs (if you don't follow [the guide of good practice of the LBMC](http://www.ens-lyon.fr/LBMC/intranet/services-communs/pole-bioinformatique/ressources/good_practice_LBMC). You can put your bioinformatics tools with crappy installation procedures there).
### `/lib` and `/usr/lib`
Those folder contains system libraries. Libraries are a collection of pieces of codes usable by programs.
Those folders contain system libraries. Libraries are a collection of pieces of codes usable by programs.
What is the difference between `/lib` and `/usr/lib`.
Search information on the `/lib/gnupg` library on the net.
Search information about the `/lib/gnupg` library on the net.
### `/etc`
The place where system configuration file and default configuration file are. What is the name of the default configuration file for `bash` ?
The place where system configuration files and default configuration files are. What is the name of the default configuration file for `bash`?
### `/dev`
Contains every peripheric
Contains every peripheral devices such as hard disks, disk partitions, and so on.
What is the type of the file `stdout` (you will have to follow the links)?
With the command `ls -l` can you identify files of type `b` ?
With the command `ls -l` can you identify files of type `b`?
Using `less` can you visualize the content of the file `urandom` ? What about the file `random` ?
Using `less` can you visualize the content of the file `urandom`? What about the file `random`?
What is the content of `/dev/null`?
### `/var`
Storage space for variables and temporary files, like system logs, locks, or file waiting to be printed...
Storage space for variables and temporary files, like system logs, locks, or files waiting to be printed...
In the file `auth.log` you can see the creation of the `ubuntu` and `etudiant `account. To visualize a file you can use the command
In the file `/var/log/auth.log` you can see the creation of the `ubuntu` and `etudiant `account. To visualize a file you can use the command.
```sh
less [file_path]
```
You can navigate the file with the navigation arrows. Which group the user `ubuntu` belongs to that the user `etudiant`don’t ?
You can navigate the file with the navigation arrows. Which group does the user `ubuntu` belong to that the user `etudiant` doesn't?
To close the `less` you can press `Q`. Try the opposite of `less`, what are the differences ?
To close the `less` window you can press `Q`. Try the opposite of `less`. What are the differences?
What is the type of the file `autofs.fifo-var-autofs-ifb` in the `run` folder ? From **fifo** in the name, can you guess the function of the `p` file ?
There are few examples of the last type of file in the `run` folder, in which color the command `ls -l` color them ?
There are few examples of type `p` files in the `run` folder, in which color the command `ls -l` colors them?
### `/tmp`
Temporary space. **Erased at each shutdown of the system !**
Temporary space. **Erased at each shutdown of the system!**
### `/proc`
Information on the system resources. This file system is virtual. What do we mean by that ?
Information about the system resources. This file system is virtual. What do we mean by that?
One of the columns of the command `ls -l` show the size of the files. Try is on the `/etc` folder. You can add the `-h` option to have human readable file size.
One column of the command `ls -l` shows the size of the files. Try is on the `/etc` folder. You can add the `-h` option to get human-readable file sizes.
What are the sizes of the files in the `/proc` folder ?
What are the sizes of the files in the `/proc` folder?
From the `cpuinfo` file get the brand of the cpu simulated by your VM.
From the `cpuinfo` file, get the brand of the CPU simulated by your VM.
From the `meminfo` file retrieve the total size of RAM
From the `meminfo` file, retrieve the total size of RAM.
## Links
With the command `ls -l` we have seen some links, the command `stat` can give us more information on them
With the command `ls -l` we have seen some links. The command `stat` can give us more information on them
```sh
stat /var/run
```
What is the kind of link for `/var/run` ?
What is the link type of `/var/run`?
Most of the time, when you are going to work with links, you will work with this kind of link. You can create a **l**i**n**k with the command `ln` and the option `-s` for a **s**ymbolic.
You will work with this kind of link most of the time. You can create a **l**i**n**k with the command `ln` and the option `-s` for a **s**ymbolic.
The first argument after the option of the `ln` command is the target of the link, the second argument is the link itself:
The first argument after the option of the `ln` command is the target of the link; the second argument is the link itself:
```sh
cd
touch .bash_history
ln -s .bash_history bash_history_slink
ls -la
```
What are the differences between the two following commands ?
What are the differences between the following two commands?
```sh
stat bash_history_slink
stat .bash_history
```
Symbolic links can bridge across, file system, if the target of the link disappears the link will be broken.
Symbolic links can bridge across file system. If the target of the link disappears, the link will be broken.
You can delete a file with the command `rm`
You can delete a file with the command `rm`.
**There is no trash with the command `rm` double-check your command before pressing enter !**
**There is no trash with the command `rm` double-check your command before pressing enter!**
Delete your `.bash_history` file, what happened to the `bash_history_slink` ?
Delete your `.bash_history` file, what happened to the `bash_history_slink`?
The command `ln` without the `-s` option create hard links. Try the following commands:
......@@ -190,14 +180,13 @@ stat .bashrc
ln .bashrc bashrc_linkb
```
Use `stat` to also study `bashrc_linka` and `bashrc_linkb`.
Use `stat` to check both `bashrc_linka` and `bashrc_linkb`.
What happens when you delete `bashrc_linka` ?
What happens when you delete `bashrc_linka`?
To understand the notion of **Inode** we need to know more about storage systems.
## Disk and partition
On a computer, the data are physically stored on a media (HDD, SSD, USB key, punch card...)
......@@ -206,7 +195,7 @@ On a computer, the data are physically stored on a media (HDD, SSD, USB key, pun
(Punched cards in storage at a U.S. Federal records center in 1959. All the data visible here would fit on a 4 GB flash drive.)
You cannot dump data directly into the disk, you need to organize things to be able to find them back.
You cannot dump data directly in the disk; you need to organize things to find them back.
![disk](./img/disk.png)
......@@ -214,7 +203,7 @@ Each media is divided into partitions:
![partitions](./img/partition.png)
The media is divided into one or many partition, each of which have a file system type. Examples of file system types are
The media is divided into one or many partitions, each of which has a file system type. Examples of file system types are:
- fat32, exFAT
- ext3, ext4
......@@ -222,15 +211,15 @@ The media is divided into one or many partition, each of which have a file syste
- NTFS
- ...
The file system handle the physical position of each file on the media. The position of the file in the index of file is called **Inode**.
The file system handles the physical position of each file on the media. The position of a file in the file index is called **Inode**.
The action of attaching a given media to the Unix file system tree, is called mounting a partition or media. To have a complete list of information on what is mounted where, you can use the `mount `command without argument.
The action of attaching a given media to the Unix file system tree is called mounting a partition or media. To have a complete list of information on what is mounted where, you can use the `mount `command without arguments.
```sh
mount
```
Find which disk is mounted at the root of the file tree.
Find out which disk is mounted at the root of the file tree.
> We have seen the commands:
>
......@@ -239,4 +228,4 @@ Find which disk is mounted at the root of the file tree.
> - `ln` to create links
> - `mount` to list mount points
[Thats all for the Unix file system, we will come back to it from time to time but for now you can head to the next section.](./5_users_and_rights.html)
[That's all for the Unix file system. We will come back to it from time to time, but for now you can head to the next section.](./5_users_and_rights.html)
......@@ -3,28 +3,19 @@ title: Users and rights
author: "Laurent Modolo"
---
```{r include = FALSE}
if (!require("fontawesome")) {
install.packages("fontawesome")
}
library(fontawesome)
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(comment = NA)
```
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" />
</a>
Objective: Understand how rights works in GNU/Linux
GNU/Linux and other Unix-like OS are multiuser, this means that they are designed to work with multiple users connected simultaneously to the same computer.
GNU/Linux and other Unix-like OS are multi-user, they are designed to work with multiple users connected simultaneously to the same computer.
There is always at least one user: the **root** user
- Its the super user
- It's the super user
- he has every right (we can say that he ignores the rights system)
- this account should only be used to administer the system.
- this account should only be used to administrate the system.
There can also be other users who
......@@ -47,7 +38,7 @@ Check your set of rights on your `.bashrc` file
ls -l ~/.bashrc
```
The first column of the `ls -l` output shows the status of the rights on the file
The first column of the `ls -l` output shows the status of the rights on the file.
![user_rights](./img/user_right.png)
......@@ -64,8 +55,8 @@ The first column of the `ls -l` output shows the status of the rights on the fil
- the 1st character is the type of the file (we already know this one)
- he 3 following characters (2 to 4) are the **user** rights on the file
- the characters 5 to 7 are the **group** rights on the file
- the characters 8 to 10 are the **others** rights on the file (anyone not the **user** nor in the **group**)
- the characters 5 to 7 are the **group** rights on the file
- the characters 8 to 10 are the **others'** rights on the file (anyone not the **user** nor in the **group**)
To change the file rights you can use the command `chmod`
......@@ -87,7 +78,7 @@ chmod o+r .bashrc
chmod u-x,g-w,o= .bashrc
```
What can you conclude on the symbols `+` , `=`, `-` and `,` with the `chmod` command ?
What can you conclude on the symbols `+`, `=`, `-` and `,` with the `chmod` command?
> ### Numeric notation
>
......@@ -107,13 +98,13 @@ What can you conclude on the symbols `+` , `=`, `-` and `,` with the `chmod` com
> | `-rw-rw-rw-` | 0666 | read & write |
> | `-rwxr-----` | 0740 | owner can read, write, & execute; group can only read; others have no permission |
The default group of your user is the first in the list of the groups you belong to. You can use the command `groups` to display this list. What is your default group ?
The default group of your user is the first in the list of the groups you belong to. You can use the command `groups` to display this list. What is your default group?
The command `id` show the same information, but with some differences what are they ?
The command `id` shows the same information, but with some differences, what are they?
Can you cross this additional information with the content of the file `/etc/passwd` and `/etc/group` ?
Can you cross this additional information with the content of the file `/etc/passwd` and `/etc/group`?
What is the user *id* of **root** ?
What is the user *id* of **root**?
When you create an empty file, system default rights and your default groups are used. You can use the command `touch` to create a file.
......@@ -121,7 +112,7 @@ When you create an empty file, system default rights and your default groups are
touch my_first_file.txt
```
What are the default rights when you crate a file ?
What are the default rights when you create a file?
You can create folders with the command `mkdir` (**m**a**k**e **dir**ectories).
......@@ -129,23 +120,23 @@ You can create folders with the command `mkdir` (**m**a**k**e **dir**ectories).
mkdir my_first_dir
```
What are the default rights when you create a directory ? Try to remove the execution rights, what appends then ?
What are the default rights when you create a directory? Try to remove the execution rights. What happens then?
You can see the **/root** home directory. Can you see its content ? Why ?
You can see the **/root** home directory. Can you see its content? Why?
Create a symbolic link (`ln -s`) to your **.bashrc** file, what are the default rights to symbolic links ?
Create a symbolic link (`ln -s`) to your **.bashrc** file. What are the default rights to symbolic links?
Can you remove the writing right of this link ? What happened ?
Can you remove the writing right of this link? What happened?
## Users and Groups
We have seen how to change the right associated with the group, but what about changing the group itself ? The command `chgrp` allows you to do just that:
We have seen how to change the right associated with the group, but what about changing the group itself? The command `chgrp` allows you to do just that:
```sh
chgrp audio .bashrc
```
Now the next step is to change the owner of a file, you can use the command `chown` for that.
Now the next step is to change the owner of a file. You can use the command `chown` for that.
```sh
chown ubuntu my_first_file.txt
......@@ -157,9 +148,9 @@ You can change the user and the group with this command:
chown ubuntu:audio my_first_file.txt
```
What are the rights on the program `mkdir` (the command `which` can help you find where program file are) ?
What are the rights on the program `mkdir` (the command `which` can help you find the program path)?
Can you remove the execution rights for the others ?
Can you remove the execution rights for the others?
The command `cp` allows you to **c**o**p**y file from one destination to another.
......@@ -167,13 +158,13 @@ The command `cp` allows you to **c**o**p**y file from one destination to another
man cp
```
Copy the `mkdir` tool to your home directory. Can you remove execution rights for the others on your copy of `mkdir` ? Can you read the contentof the `mkdir` file ?
Copy the `mkdir` tool to your home directory. Can you remove execution rights for the others on your copy of `mkdir`? Can you read the contentof the `mkdir` file?
You cannot change the owner of a file, but you can always allow another user to copy it and change the rights on its copy.
## Getting admin access
Currently you dont have administrative access to your VM, this means that you dont have the password to the *root* account. Another way to get administrative access in Linux is to use the `sudo` command.
Currently, you don't have administrative access to your VM, this means that you don't have the password to the *root* account. Another way to get administrative access in Linux is to use the `sudo` command.
You can read the documentation (manual) of the `sudo` command with the command `man`
......@@ -185,11 +176,11 @@ Like for the command, `less` you can close `man` by pressing **Q**.
![sandwich](https://imgs.xkcd.com/comics/sandwich.png)
On Ubuntu, only members of the group **sudo** can use the `sudo` command. Are you in this group ?
On Ubuntu, only members of the group **sudo** can use the `sudo` command. Are you in this group?
**The root user can do everything in your VM, for example it can delete everything from the `/` directory but its not a good idea (see the [Peter Parker principle](https://en.wikipedia.org/wiki/With_great_power_comes_great_responsibility))**
**The root user can do everything in your VM, for example, it can delete everything from the `/` directory but it's not a good idea (see the [Peter Parker principle](https://en.wikipedia.org/wiki/With_great_power_comes_great_responsibility))**
One advantage of using a command line interface is that you can easily reuse command written by others. Copy and paste the following command in your terminal to add yourself in the **sudo** group.
One advantage of using a command-line interface is that you can easily reuse command written by others. Copy and paste the following command in your terminal to add yourself to the **sudo** group.
```sh
docker run -it --volume /:/root/chroot alpine sh -c "chroot /root/chroot /bin/bash -c 'usermod -a -G sudo etudiant'"
......@@ -207,7 +198,7 @@ sudo id
You can try again the `chown` command with the `sudo` command.
Check the content of the file `/etc/shadow` , what is the utility of this file (you can get help from the `man` command).
Check the content of the file `/etc/shadow`, what is the utility of this file (you can get help from the `man` command).
## Creating Users
......@@ -222,9 +213,9 @@ useradd -m -s /bin/bash -g users -G adm,docker student
- `-g` the default group
- `-G` the additional groups
To log into another account you can use the command `su`
To log into another account, you can use the command `su`.
What is the difference between the two following commands ?
What is the difference between the two following commands?
```sh
su student
......@@ -234,7 +225,7 @@ su student
sudo su student
```
What append when you don't specify a login with the `su` command ?
What append when you don't specify a login with the `su` command?
## Creating groups
......@@ -256,7 +247,7 @@ And check the result:
groups student
```
To remove an user from a group you can rewrite its list of groups with the command `usermod`
To remove a user from a group, you can rewrite its list of groups with the command `usermod`
```sh
sudo usermod -G student student
......@@ -266,9 +257,9 @@ Check the results.
## Security-Enhanced Linux
While what you have seen in this section hold true for every Unix system, additional rules can be applied to control the rights in Linux. This is what is called [SE Linux](https://en.wikipedia.org/wiki/Security-Enhanced_Linux) (**s**ecurity-**e**nhanced **Linux**)
While what you have seen in this section hold true for every Unix system, we can apply additional rules to control the rights in Linux. This is what is called [SE Linux](https://en.wikipedia.org/wiki/Security-Enhanced_Linux) (**s**ecurity-**e**nhanced **Linux**).
When SE Linux is enabled on a system, every **process** can be assigned a set of rights. This is how, on Android for example, some programs can access your GPS while others cannot, etc. In this case it's not the user rights that prevail, but the **process** launched by the user.
When SE Linux is enabled on a system, every **process** can be assigned a set of rights. This is how, on Android for example, some programs can access your GPS while others cannot, etc. In this case, it's not the user rights that prevail, but the **process** launched by the user.
> We have seen the commands:
>
......@@ -284,4 +275,4 @@ When SE Linux is enabled on a system, every **process** can be assigned a set of
> - `groups` to list groups
> - `usermod`to manipulate users' groups
[To understand more about processes you can head to the next section.](./6_unix_processes.html)
[To understand more about processes, you can head to the next section.](./6_unix_processes.html)
......@@ -3,32 +3,23 @@ title: Unix Streams and pipes
author: "Laurent Modolo"
---
```{r include = FALSE}
if (!require("fontawesome")) {
install.packages("fontawesome")
}
library(fontawesome)
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(comment = NA)
```
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" />
</a>
Objective: Understand function of streams and pipes in Unix systems
Objective: Understand the function of streams and pipes in Unix systems
When you read a file you start at the top from left to right, you read a flux of information which stops at the end of the file.
When you read a file, you start at the top from left to right, you read a flux of information which stops at the end of the file.
Unix streams are much the same things instead of opening a file as a whole bunch of data, process can process it as a flux. There are 3 standard Unix streams:
Unix streams are much the same things. Instead of opening a file as a whole bunch of data, the process can process it as a flux. There are 3 standard Unix streams:
0. **stdin** the **st**an**d**ard **in**put
1. **stdout** the **st**an**d**ard **out**put
2. **sterr** the **st**an**d**ard **err**or
Historically, **stdin** has been the card reader or the keyboard, while the two others where the card puncher or the display.
Historically, **stdin** has been the card reader or the keyboard, while the two others were the card puncher or the display.
The command `cat `simply read from **stdin** and displays the results on **stdout**
The command `cat `simply reads from **stdin** and displays the results on **stdout**
```sh
cat
......@@ -42,8 +33,6 @@ It can also read files and display the results on **stdout**
cat .bashrc
```
## Streams manipulation
You can use the `>` character to redirect a flux toward a file. The following command makes a copy of your `.bashrc` files.
......@@ -56,7 +45,7 @@ Check the results of your command with `less`.
Following the same principle create a `my_cal` file containing the **cal**endar of this month. Check the results with the command `less`
Reuse the same command with the unnamed option `1999`. Check the results with the command `less`. What happened ?
Reuse the same command with the unnamed option `1999`. Check the results with the command `less`. What happened?
Try the following command
......@@ -64,13 +53,13 @@ Try the following command
cal -N 2 > my_cal
```
What is the content of `my_cal` what happened ?
What is the content of `my_cal` what happened?
The `>` command can have an argument, the syntax to redirect **stdout** to a file is `1>` it's also the default option (equivalent to `>`). Here the `-N` option doesn't exist, `cal` throws an error. Errors are sent to **stderr** which have the number 2.
Save the error message in `my_cal` and check the results with `less`.
We have seen that `>` overwrite the content of the file. Try the following commands:
We have seen that `>` overwrites the content of the file. Try the following commands:
```sh
cal 2020 > my_cal
......@@ -94,19 +83,17 @@ You can use different redirection on the same process. Try the following command
cat <<EOF > my_notes
```
Type some text and type `EOF` on a new line. `EOF` stand for **e**nd **o**f **f**ile, it's a conventional sequence to use to indicate the start and the end of a file in a stream.
Type some text and type `EOF` on a new line. `EOF` stands for **e**nd **o**f **f**ile, it's a conventional sequence used to indicate the start and the end of a file in a stream.
What happened ? Can you check the content of `my_notes` ? How would you modify this command to add new notes?
What happened? Can you check the content of `my_notes`? How would you modify this command to add new notes?
Finally, you can redirect a stream toward another stream with the following syntax:
```sh
cal -N2 2&> my_redirection
cal 2&>> my_redirection
cal -N 2 &> my_redirection
cal 2 &>> my_redirection
```
## Pipes
The last stream manipulation that we are going to see is the pipe which transforms the **stdout** of a process into the **stding** of the next. Pipes are useful to chain multiples simple operations. The pipe operator is `| `
......@@ -115,14 +102,12 @@ The last stream manipulation that we are going to see is the pipe which transfor
cal 2020 | less
```
What is the difference between with this command ?
What is the difference with this command?
```sh
cal 2020 | cat | cat | less
```
The command `zcat` has the same function as the command `cat` but for compressed files in [`gzip` format](https://en.wikipedia.org/wiki/Gzip).
The command `wget` download files from a url to the corresponding file. Don't run the following command which would download the human genome:
......@@ -131,17 +116,17 @@ The command `wget` download files from a url to the corresponding file. Don't ru
wget http://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.fa.gz
```
We are going to use the `-q` switch which silence `wget` (no download progress bar or such), and the option `-O` which allows use to set the name of the output file. In Unix setting the output file to `-` allow you to write the output on the **stdout** stream.
We are going to use the `-q` switch which silence `wget` (no download progress bar or such), and the option `-O` which allows us to set the name of the output file. In Unix setting the output file to `-` allow you to write the output on the **stdout** stream.
Analyze the following command, what would it do ?
Analyze the following command. What would it do?
```sh
wget -q -O - http://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.fa.gz | gzip -dc | less
```
Remember that most Unix command process input and output line by line. Which means that you can process huge datasets without intermediate files or huge RAM capacity.
Remember that most Unix command process input and output line by line. As a result, you can process huge datasets without intermediate files or huge RAM capacity.
> We have users the following commands:
> We have used the following commands:
>
> - `cat`/ `zcat` to display information in **stdout**
> - `>` / `>>` / `<` / `<<` to redirect a flux
......
......@@ -3,28 +3,19 @@ title: Text manipulation
author: "Laurent Modolo"
---
```{r include = FALSE}
if (!require("fontawesome")) {
install.packages("fontawesome")
}
library(fontawesome)
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(comment = NA)
```
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" />
</a>
Objective: Learn simple ways to work with text file in Unix
One of the great things with command line tools is that they are simple and fast. Which means that they are great for handling large files. And as bioinformaticians you have to handle large files, so you need to use command line tools for that.
One of the great things with command-line tools is that they are simple and fast. So they work great for handling large files. And as bioinformaticians, you have to handle large files, so you need to use command-line tools for that.
## Text search
The file [hg38.ncbiRefSeq.gtf.gz](http://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/genes/hg38.ncbiRefSeq.gtf.gz) contains the RefSeq annotation for hg38 in [GFT format](http://www.genome.ucsc.edu/FAQ/FAQformat.html#format4)
We can download files with the `wget` command. Here the annotation is in **gz** format which is a compressed format, you can use the `gzip` tool to handle **gz** files.
We can download files with the `wget` command. Here the annotation is in **gz** format which is a compressed format. You can use the `gzip` tool to handle **gz** files.
On useful command to check large text file is the `head `command.
......@@ -34,7 +25,7 @@ wget -q -O - http://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/genes/hg38.n
You can change the number of lines displayed with the option `-n number_of_line`. The command `tail` has the same function as `head` but starting from the end of the file.
Try the `tail` for the same number of lines displayed, does the computation take the same time ?
Try the `tail` for the same number of lines displayed. Does the computation take the same time?
Download the `hg38.ncbiRefSeq.gtf.gz` file in your `~/`.
......@@ -44,19 +35,19 @@ The program `grep string` allows you to search for *string* through a file or st
gzip -dc hg38.ncbiRefSeq.gtf.gz | grep "chr2" | head
```
What is the last annotation on the chromosome 1 (to write a tabulation character you can type `\t`) ?
What is the last annotation on the chromosome 1?
You can count things in text file with the command `wc` read the `wc` **man**ual to see how you can count lines in a file.
Does the number of *3UTR* match the number of *5UTR* ?
Does the number of *3UTR* match the number of *5UTR*?
How many transcripts does the gene *CCR7* have ?
How many transcripts does the gene *CCR7* have?
## Regular expression
When you do a loot text search, you will encounter regular expressions (regexp), which allow you to perform fuzzy search. To run `grep` in regexp mode you can use the switch. `-E`
When you do a lot text search, you will encounter regular expressions (regexp), which allow you to perform a fuzzy search. To run `grep` in regexp mode, you can use the switch `-E` or `-P` for Perl-like regexp (which offers additional features).
The most basic form fo regexp si the exact match:
The most basic form of regexp is the exact match:
```sh
gzip -dc hg38.ncbiRefSeq.gtf.gz | head | grep -E "gene_id"
......@@ -76,7 +67,7 @@ gzip -dc hg38.ncbiRefSeq.gtf.gz | head | grep -E "\."
### Character classes and alternatives
There are a number of special patterns that match more than one character. Youve already seen `.`, which matches any character apart from a newline. There are four other useful tools:
There are several special patterns that match more than one character. You've already seen `.`, which matches any character apart from a newline. There are four other useful tools:
- `\d`: matches any digit.
- `\s`: matches any whitespace (e.g. space, tab, newline).
......@@ -90,14 +81,18 @@ Search for two digits followed by an uppercase letter and one digit.
<details><summary>Solution</summary>
<p>
```sh
gzip -dc hg38.ncbiRefSeq.gtf.gz | head | perl -E "\d\d[A-Z]\d"
gzip -dc hg38.ncbiRefSeq.gtf.gz | grep -E "[0-9][0-9][A-Z][0-9]"
```
We need to use the flag `-P` to use the character class `\d`:
```sh
gzip -dc hg38.ncbiRefSeq.gtf.gz | grep -P "\d\d[A-Z]\d"
```
</p>
</details>
### Anchors
By default, regular expressions will match any part of a string. Its often useful to *anchor* the regular expression so that it matches from the start or end of the string. You can use
By default, regular expressions will match any part of a string. It's often useful to *anchor* the regular expression so that it matches from the start or end of the string. You can use either:
- `^` to match the start of the string.
- `$` to match the end of the string.
......@@ -120,7 +115,7 @@ The next step up in power involves controlling how many times a pattern matches
- `+`: 1 or more
- `*`: 0 or more
What is the following regexp going to match ?
What is the following regexp going to match?
```sh
gzip -dc hg38.ncbiRefSeq.gtf.gz | head | grep -E "[a-z]*_[a-z]*\s\"[1-3]\""
......@@ -133,31 +128,31 @@ You can also specify the number of matches precisely:
- `{,m}`: at most m
- `{n,m}`: between n and m
What is the following regexp going to match ?
What is the following regexp going to match?
```sh
gzip -dc hg38.ncbiRefSeq.gtf.gz | grep -E "^[a-z]{3}[2-3]\s.*exon\s\d{4,5}\s\d{4,5}.*"
```
How many gene names of more than 16 characters does the annotation contain ?
How many gene names over 16 characters does the annotation contain?
<details><summary>Solution</summary>
<p>
```sh
gzip -dc hg38.ncbiRefSeq.gtf.gz | grep -E "transcript\s.*gene_id\s\"\S{16,}\";" | wc -l
gzip -dc hg38.ncbiRefSeq.gtf.gz | grep -P "transcript\s.*gene_name\s\"\S{16,}\";" | wc -l
```
</p>
</details>
### Grouping and back references
You can group match using `()`, for example the following regexp match doublet of *12* .
You can group match using `()`, for example, the following regexp match doublet of *12*.
```sh
gzip -dc hg38.ncbiRefSeq.gtf.gz | grep -E "(12){2}"
```
Grouping is also used for back references in the case of text replacement. You can use the command `sed` for text replacement. The syntax of `sed` for replacement is the following: `sed -E 's|regexp|\n|g` where `n` is the grouping number. `s` stand for substitute and `g` stand for global (which means that is they are different substitutions per line `sed` won't stop at the first one).
Grouping is also used for back references in text replacement. You can use the command `sed` for text replacement. The syntax of `sed` for replacement is the following: `sed -E 's|regexp|\n|g` where `n` is the grouping number. `s` stand for substitute and `g` stand for global (so if they are different substitutions per line `sed` won't stop at the first one).
Try the following replacement regexp
......@@ -165,20 +160,20 @@ Try the following replacement regexp
gzip -dc hg38.ncbiRefSeq.gtf.gz | head | sed -E 's|(transcript_).{2}|\1number|g'
```
Try to write a `sed` command to replace *ncbiRefSeq* with *transcript_id* .
Try to write a `sed` command to swap *ncbiRefSeq* with *transcript_id*.
<details><summary>Solution</summary>
<p>
```sh
gzip -dc hg38.ncbiRefSeq.gtf.gz | head | sed -E 's|ncbiRefSeq(.*)(transcript_id "([A-Z_0-9.]*))|\3\1\2|g'
gzip -dc hg38.ncbiRefSeq.gtf.gz | head | sed -E 's|(ncbiRefSeq)(.*)(transcript_id)(.*)|\3\2\1\4|g'
```
</p>
</details>
Regexp can be very complex see for example [a regex to validate an email on starckoverflow](https://stackoverflow.com/questions/201323/how-to-validate-an-email-address-using-a-regular-expression/201378#201378). When you start you can always use for a given regexp to a more experienced used (just give him the kind of text you want to match and not match). You can test your regex easily with the [regex101 website](https://regex101.com/).
Regexp can be very complex see for example [a regex to validate an email on starckoverflow](https://stackoverflow.com/questions/201323/how-to-validate-an-email-address-using-a-regular-expression/201378#201378). The [regex101 website](https://regex101.com/) is a good place for starters that helps you construct your regexp step by step.
## Sorting
GTF files should be sorted by chromosome, starting position and end position. But you can change that with the command `sort` to select the column to sort on you can use the option `-k n,n` where `n` is the column number.
GTF files should be sorted by chromosome, starting position and end position. But you can change that with the command `sort` to select the column to sort on. You can use the option `-k n,n` where `n` is the column number.
You need to specify where sort keys start *and where they end*, otherwise (as in when you use `-k 3` instead of `-k 3,3`) they end at the end of the line.
......@@ -192,7 +187,7 @@ gzip -dc hg38.ncbiRefSeq.gtf.gz | head -n 10000 | sort -k 4,4 -k 5,5 | head
You can add more option to the sorting of each column, for example `r` for reverse order `d` for dictionary order or `n` for numeric order.
What will the following command do ?
What will the following command do?
```sh
gzip -dc hg38.ncbiRefSeq.gtf.gz | head -n 10000 | sort -k 3,3d -k 4,4n | head
......@@ -218,13 +213,11 @@ gzip -dc hg38.ncbiRefSeq.gtf.gz | head -n 10000 | sort -k 1,1 -k 4,4n -k 5,5n -c
</details>
## Field extractor
Sometime rather than using complex regexp, we want to extract a particular column from a file. You can use the command `cut` to do that.
The following command extracts the 3rd column of the annotation
The following command extracts the 3rd column of the annotation:
```sh
gzip -dc hg38.ncbiRefSeq.gtf.gz | head | cut -f 3
......@@ -235,10 +228,12 @@ You can change the field separator with the option `-d`, set it to `";"` to extr
<details><summary>Solution</summary>
<p>
```sh
gzip -dc hg38.ncbiRefSeq.gtf.gz | head | cut -f 2 -f 5 -d ";"
gzip -dc hg38.ncbiRefSeq.gtf.gz | head | grep -w "transcript" | cut -f 9 | cut -f 2,3 -d ";"
```
</p>
</details>
## Concatenation
There are different tools to concatenate files from the command line `cat` for vertical concatenation and `paste` for horizontal concatenation.
......@@ -247,35 +242,34 @@ There are different tools to concatenate files from the command line `cat` for v
cat .bashrc .bashrc | wc -l
```
What will be the results of the following command ?
What will be the result of the following command?
```sh
gzip -dc hg38.ncbiRefSeq.gtf.gz | head | paste - -
```
## Text editor
You often have access to different text editors from the common line, two of the most popular ones are `vim` and `nano`.
You often have access to different text editors from the common line. Two of the most popular ones are `vim` and `nano`.
`nano` is more friendly to use than `vim` but also very limited.
To open a text file you can type `editor file_path`.
In `nano` everything is written at the bottom, so you only have to remember that `^`is the symbol for the key `Ctrl`.
In `nano` everything is written at the bottom, so you only have to remember that `^` is the symbol for the key `Ctrl`.
Open you `.bashrc` file and delete any comment line (starting with the `#` character).
Open your `.bashrc` file and delete any comment line (starting with the `#` character).
`vim` is a child of the project `vi` (which should also be available on your system), and which bring him more functionality. The workings of `vim` can be a little strange at first, but you have to understand that on a US keyboard the distance that your finger have to travel while using `vim` is minimal.
`vim` is a child of the project `vi` (which should also be available on your system), and which brings him more functionality. The workings of `vim` can be a little strange at first, but you have to understand that on a US keyboard, the distance that your finger has to travel while using `vim` is minimal.
You have 3 modes in `vim`:
- The **normal** mode, where you can navigate the file and enter command with the `:` key. You can come back to this mode by pressing `Esc`
- The **insert** mode, where you can write things. You enter this mode with the `i` key or any other key insertion key (for example `a` to insert after the cursor or `A` to insert at the end of the line)
- The **visual** mode where you can select text for copy/paste action. You can enter this mode with the `v` key
- The **normal** mode, where you can navigate the file and enter a command with the `:` key. You can come back to this mode by pressing `Esc`
- The **insert** mode, where you can write things. You enter this mode with the `i` key or any other key insertion key (for example, `a` to insert after the cursor or `A` to insert at the end of the line)
- The **visual** mode where you can select text for copy/paste action. You can enter this mode with the `v` key.
If you want to learn more about `vim`, you can start with the https://vim-adventures.com/ website. Once you master `vim` everything is faster but you will have to practice a loot.
If you want to learn more about `vim`, you can start with the <https://vim-adventures.com/> website. Once you master `vim` everything is faster, but you will have to practice a lot.
> We have used the following commands:
>
......@@ -284,11 +278,10 @@ If you want to learn more about `vim`, you can start with the https://vim-advent
> - `gzip` to extract `tar.gz` files
> - `grep` to search text files
> - `wc` to count things
> - `sed` to search and replace string of text
> - `sort` to sort files on specific field
> - `sed` to search and replace strings of text
> - `sort` to sort files on specific fields
> - `cut` to extract a specific field
> - `cat` / `paste` for concatenation
> - `nano` / `vim` for text edition
In the next session, we are going to apply the logic of pipes and text manipulation to [batch processing.](./9_batch_processing.html)
......@@ -3,24 +3,15 @@ title: Batch processing
author: "Laurent Modolo"
---
```{r include = FALSE}
if (!require("fontawesome")) {
install.packages("fontawesome")
}
library(fontawesome)
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(comment = NA)
```
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" />
</a>
Objective: Learn basics of batch processing in GNU/Linux
In the previous section, we have seen how to handle streams and text. We can use this knowledge to generate list of command instead of text. This is called batch processing.
In the previous section, we have seen how to handle streams and text. We can use this knowledge to generate a list of command instead of text. This is called batch processing.
In everyday life, you may want to run command sequentiality without using pipes.
In everyday life, you may want to run command sequentially without using pipes.
To run `CMD1` and then run `CMD2` you can use the `;` operator
......@@ -28,7 +19,7 @@ To run `CMD1` and then run `CMD2` you can use the `;` operator
CMD1 ; CMD2
```
To run `CMD1` and then run `CMD2` if `CMD1` didnt throw an error, you can use the `&&` operator which is safer than the `;` operator.
To run `CMD1` and then run `CMD2` if `CMD1` didn't throw an error, you can use the `&&` operator, which is safer than the `;` operator.
```sh
CMD1 && CMD2
......@@ -40,17 +31,17 @@ You can also use the `||` to manage errors and run `CMD2` if `CMD1` failed.
CMD1 || CMD2
```
## Executing list of commands
## Executing a list of commands
The easiest option to execute list of command is to use `xargs`. `xargs` reads arguments from **stdin** and use them as arguments for a command. In UNIX systems the command `echo` send string of character into **stdout**. We are going to use this command to learn more about `xargs`.
The easiest option to execute a list of commands is to use `xargs`. `xargs` reads arguments from **stdin** and uses them as arguments for a command. In UNIX systems, the command `echo` send a string of character into **stdout**. We are going to use this command to learn more about `xargs`.
```sh
echo "hello world"
```
In general a string of character differs from a command when its placed between quotes.
In general, a string of character differs from a command when it's placed between quotes.
The two following commands are equivalent, why ?
Why are the two following commands equivalent?
```sh
echo "file1 file2 file3" | xargs touch
......@@ -59,7 +50,7 @@ touch file1 file2 file3
You can display the command executed by `xargs` with the switch `-t`.
By default the number of arguments sent by `xargs` is defined by the system. You can change it with the option `-n N`, where `N` is the number of arguments sent. Use the option `-t` and `-n` to run the previous command as 3 separate `touch` commands.
By default, the number of arguments sent by `xargs` is defined by the system. You can change it with the option `-n N`, where `N` is the number of arguments sent. Use the option `-t` and `-n` to run the previous command as 3 separate `touch` commands.
<details><summary>Solution</summary>
<p>
......@@ -78,18 +69,18 @@ echo "file1;file2;file3"
<details><summary>Solution</summary>
<p>
```sh
echo "file1;file2;file3" | xargs -t -d \; touch
echo -n "file1;file2;file3" | xargs -t -d\; touch
```
</p>
</details>
To reuse the arguments sent to `xargs` you can use the command `-I` which defines a string corresponding to the argument. Try the following command, what does the **man**ual says about the `-c` option of the command `cut` ?
To reuse the arguments sent to `xargs` you can use the command `-I` which defines a string corresponding to the argument. Try the following command. What does the **man**ual says about the `-c` option of the command `cut`?
```sh
ls -l file* | cut -c 44- | xargs -t -I % ln -s % link_%
```
Instead of using `ls` the command `xargs` is often used with the command `find`. The command `find` is a powerful command to search for files.
The command `xargs` is also often combined with the command `find`. The command `find` is a powerful command to search for files.
Modify the following command to make a non-hidden copy of all the file with a name starting with *.bash* in your home folder
......@@ -123,111 +114,109 @@ find /tmp/ -type d | xargs -t rm -R
## Writing `awk` commands
`xargs` It is a simple solution for writing batch commands, but if you want to write more complex command you are going to need to learn `awk`. `awk` is a programming language by itself, but you dont need to know everything about `awk` to use it.
`xargs` is a simple solution for writing batch commands, but if you want to write more complex ones, you are going to need to learn `awk`. `awk` is a programming language by itself, but you don't need to know everything about `awk` to use it.
You can to think of `awk` as a `xargs -I $N` command where `$1` correspond to the first column `$2` to the second column, etc.
You can to think of `awk` as a `xargs -I $N` command where `$1` corresponds to the first column `$2` to the second column, etc.
There are also some predefined variables that you can use like.
There are also some predefined variables that you can use:
- `$0` Correspond to all the columns.
- `$0` corresponds to all the columns.
- `FS` the field separator used
- `NF` the number of fields separated by `FS`
- `NR` the number of records already read
A `awk` program is a chain of commands with the form `motif { action }`
- the `motif` define where there `action` is executed
- there `action` is what you want to do
- the `motif` defines where there `action` is executed
- the `action` is what you want to do
They `motif` can be
The `motif` can be
- a regexp
- The keyword `BEGIN`or `END` (before reading the first line, and after reading the last line)
- the keyword `BEGIN`or `END` (before reading the first line, and after reading the last line)
- a comparison like `<`, `<=`, `==`, `>=`, `>` or `!=`
- a combination of the three separated by `&&` (AND), `||`(OR) and `!` (Negation)
- a range of line `motif_1,motif_2`
With `awk` you can
Count the number of lines in a file
```sh
awk '{ print NR " : " $0 }' file
```
Modify this command to only display the total number of line with awk (like `wc -l`)
<details><summary>Solution</summary>
<p>
```sh
awk 'END{ print NR }' file
```
</p>
</details>
Convert a tabulated sequences file into fasta format
```sh
awk -vOFS='' '{print ">",$1,"\n",$2,"\n";}' two_column_sample_tab.txt > sample1.fa
```
Modify this command to only get a list of sequence names in a fasta file
<details><summary>Solution</summary>
<p>
```sh
awk -vOFS='' '{print $1 "\n";}' two_column_sample_tab.txt > seq_name.txt
```
</p>
</details>
Convert a multiline fasta file into a single line fasta file
```sh
awk '!/^>/ { printf "%s", $0; n = "\n" } /^>/ { print n $0; n = "" } END { printf "%s", n }' sample.fa > sample1_singleline.fa
```
Convert fasta sequences to uppercase
```sh
awk '/^>/ {print($0)}; /^[^>]/ {print(toupper($0))}' file.fasta > file_upper.fasta
```
Modify this command to only get a list of sequence names in a fasta file un lowercase
<details><summary>Solution</summary>
<p>
```sh
awk '/[^>]/ {print(tolower($0))}' file.fasta > seq_name_lower.txt
```
</p>
</details>
Return a list of sequence_id sequence_length from a fasta file
```sh
awk 'BEGIN {OFS = "\n"}; /^>/ {print(substr(sequence_id, 2)" "sequence_length); sequence_length = 0; sequence_id = $0}; /^[^>]/ {sequence_length += length($0)}; END {print(substr(sequence_id, 2)" "sequence_length)}' file.fasta
```
Count the number of bases in a fastq.gz file
```sh
(gzip -dc $0) | awk 'NR%4 == 2 {basenumber += length($0)} END {print basenumber}'
```
Only read with more than 20bp from a fastq
```sh
awk 'BEGIN {OFS = "\n"} {header = $0 ; getline seq ; getline qheader ; getline qseq ; if (length(seq) >= 20){print header, seq, qheader, qseq}}' < input.fastq > output.fastq
```
With `awk` you can:
* Count the number of lines in a file
```sh
awk '{ print NR " : " $0 }' file
```
Modify this command to only display the total number of line with awk (like `wc -l`)
<details><summary>Solution</summary>
<p>
```sh
awk 'END{ print NR }' file
```
</p>
</details>
* Convert a tabulated sequences file into fasta format
```sh
awk -vOFS='' '{print ">",$1,"\n",$2,"\n";}' two_column_sample_tab.txt > sample1.fa
```
Modify this command to only get a list of sequence names in a fasta file
<details><summary>Solution</summary>
<p>
```sh
awk -vFS='\t' -vOFS='' '{print $1 "\n";}' two_column_sample_tab.txt > seq_name.txt
```
</p>
</details>
* Convert a multiline fasta file into a single line fasta file
```sh
awk '!/^>/ { printf "%s", $0; n = "\n" } /^>/ { print n $0; n = "" } END { printf "%s", n }' sample.fa > sample_singleline.fa
```
* Convert fasta sequences to uppercase
```sh
awk '/^>/ {print($0)}; /^[^>]/ {print(toupper($0))}' sample.fa > sample_upper.fa
```
Modify this command to only get a list of sequence names in a fasta file in lowercase
<details><summary>Solution</summary>
<p>
```sh
awk '/^[^>]/ {print(tolower($0))}' sample.fa > seq_name_lower.txt
```
</p>
</details>
* Return a list of sequence_id sequence_length from a fasta file
```sh
awk 'BEGIN {OFS = "\n"}; /^>/ {print(substr(sequence_id, 2)" "sequence_length); sequence_length = 0; sequence_id = $0}; /^[^>]/ {sequence_length += length($0)}; END {print(substr(sequence_id, 2)" "sequence_length)}' sample.fa
```
* Count the number of bases in a fastq.gz file
```sh
sample.fq.gz | (gzip -dc $0) | awk 'NR%4 == 2 {basenumber += length($0)} END {print basenumber}'
```
* Extract the reads with more than 20bp from a fastq file
```sh
awk 'BEGIN {OFS = "\n"} {header = $0 ; getline seq ; getline qheader ; getline qseq ; if (length(seq) >= 20){print header, seq, qheader, qseq}}' < input.fq > output.fq
```
## Writing a bash script
When you start writing complicated command, you may want to save them to reuse them later.
When you start writing complex commands, you might want to save them to reuse them later.
You can find everything that you are typing in your `bash`in the `~/.bash_history` file, but working with this file can be tedious as it also contains all the command that you mistype. A good solution, for reproducibility is to write `bash` scripts. A bash script is simply a text file that contains a sequence of `bash`commands.
You can find everything that you are typing in your `bash`in the `~/.bash_history` file, but working with this file can be tedious as it also contains all the commands that you mistype. A good solution, for reproducibility purpose, is to write `bash` scripts. A bash script is simply a text file that contains a sequence of `bash` commands.
As you use `bash` in your terminal, you can execute a `bash` script with the following command:
......@@ -235,11 +224,11 @@ As you use `bash` in your terminal, you can execute a `bash` script with the fol
source myscrip.sh
```
Its usual to write the `.sh` extension for `shell`scripts.
It's usual to write the `.sh` extension for `shell` scripts.
Write a bash script named `download_hg38.sh` that download the [hg38.ncbiRefSeq.gtf.gz](http://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/genes/hg38.ncbiRefSeq.gtf.gz) file, then extract it and that says that it has done it.
Write a bash script named `download_hg38.sh` that downloads the [hg38.ncbiRefSeq.gtf.gz](http://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/genes/hg38.ncbiRefSeq.gtf.gz) file, then extract it and that says that it has done it.
The `\` character like in regexp cancel the meaning of what follow, you can use it to split your one-liner scripts over many lines to use the `&&` operator.
The `\` character like in regexp cancels the meaning of what follow, you can use it to split your one-liner scripts over many lines to use the `&&` operator.
<details><summary>Solution</summary>
<p>
......@@ -254,23 +243,23 @@ echo "download and extraction complete"
### shebang
In your first bash script, the only thing saying that your script is a bash script is its extension. But most of the time UNIX system doesnt care about file extension, a text file is a text file.
In your first bash script, the only thing saying that your script is a bash script is its extension. But most of the time UNIX system doesn't care about file extension, a text file is a text file.
To tell the system that your text file is a bash script you need to add a **shebang**. A **shebang** is a special first line that starts with a `#!` followed by the path of the interpreter for your script.
To tell the system that your text file is a bash script, you need to add a **shebang**. A **shebang** is a special first line that starts with a `#!` followed by the path of the interpreter for your script.
For example, for a bash script in a system where `bash` is installed in `/bin/bash` the **shebang** is:
For example, for a bash script in a system where `bash` is installed in `/bin/bash`, the **shebang** is:
```bash
##!/bin/bash
```
When you are not sure `which`is the path of the tools available to interpret your script, you can use the following shebang:
When you are not sure `which` is the path of the tools available to interpret your script, you can use the following shebang:
```bash
##!/usr/bin/env bash
```
You can add a **shebang** to your script and add it the e**x**ecutable right.
You can add a **shebang** to your script and add to it e**x**ecutable right for yourself.
<details><summary>Solution</summary>
<p>
......@@ -287,22 +276,22 @@ Now you can execute your script with the command:
./download_hg38.sh
```
Congratulations you wrote your first program !
Congratulations you wrote your first program!
### PATH
Where did they `/usr/bin/env` find the information about your bash ? Why did we have to write a `./` before our script if we are in the same folder ?
Where did they `/usr/bin/env` find the information about your bash? Why did we have to write a `./` before our script if we are in the same folder?
This is all linked to the **PATH** bash variable. Like in many programming languages `bash` have what we call *variables*. *variables* are named storage for temporary information. You can print a list of all your environment variables (variables loaded in your `bash` memory), with the command `printenv`.
This is all linked to the **PATH** bash variable. Just as in many programming languages, `bash` have what we call *variables*. *variables* are named storage for temporary information. You can print a list of all your environment variables (variables loaded in your `bash` memory), with the command `printenv`.
To create a new variable you can use the following syntax:
To create a new variable, you can use the following syntax:
```sh
VAR_NAME="text"
VAR_NAME2=2
```
Create a `IDENTIY` variable with your first and last names.
Create an `IDENTIY` variable with your first and last names.
<details><summary>Solution</summary>
<p>
......@@ -312,7 +301,7 @@ IDENTITY="First name Last Name"
</p>
</details>
Its good practice to write your `bash` variable in uppercase with `_` in place of spaces.
It's good practice to write your `bash` variable in uppercase with `_` in place of spaces.
You can access the value of an existing `bash` variable with the `$VAR_NAME`
......@@ -322,14 +311,14 @@ To display the value of your `IDENTITY` variable with `echo` you can write:
echo $IDENTITY
```
When you want to mix variable value and text you can use the two following syntax:
When you want to mix variable value and text, you can use the two following syntax:
```sh
echo "my name is "$IDENTITY
echo "my name is ${IDENTITY}"
```
Going back to the `printenv` You can see a **PWD** variable that store your current path, a **SHELL** variable that store your current shell, and you can see a **PATH** variable that stores a loot of file path separated by `:`.
Going back to the `printenv` You can see a **PWD** variable that store your current path, a **SHELL** variable that store your current shell, and you can see a **PATH** variable that stores a lot of file paths, each separated by `:`.
The **PATH** variable contains every folder where to look for executable programs. Executable programs can be binary files or text files with a **shebang**.
......@@ -345,7 +334,7 @@ echo $PATH
You can create a `scripts`folder and move your `download_hg38.sh` script in it. Then we can modify the `PATH` variable to include the `scripts` folder in it.
> Dont erase your `PATH` variable !
> Don't erase your `PATH` variable!
<details><summary>Solution</summary>
<p>
......@@ -359,25 +348,25 @@ PATH=$PATH:~/scripts/
You can check the result of your command with `echo $PATH`
Try to call your `download_hg38.sh` from anywhere on the file tree. Congratulation you installed your first UNIX program !
Try to call your `download_hg38.sh` from anywhere on the file tree. Congratulation you installed your first UNIX program!
### Arguments
You can pass argument to your bash scripts, writing the following command:
You can pass argument to your bash scripts with the following command:
```sh
my_script.sh arg1 arg2 arg3
```
Means that from within the script:
From within the script:
- `$0` will give you the name of the script (`my_script.sh`)
- `$1`, `$2`, `$3`, `$n` will give you the value of the arguments (`arg1`, `arg2`, `arg3`, `argn`)
- `$$` the process id of the current shell
- `$#` the total number of arguments passed to the script
- `$@`the value of all the arguments passed to the script
- `$@` the value of all the arguments passed to the script
- `$?` the exit status of the last executed command
- `$!`the process id of the last executed command
- `$!` the process id of the last executed command
You can write the following `variables.sh` script in your `scripts` folder:
......@@ -389,7 +378,7 @@ echo "Total number of arguments: $#"
echo "Values of all the arguments: $@"
```
And you can try to call it with some arguments !
And you can try to call it with some arguments!
> We have used the following commands:
......@@ -397,10 +386,10 @@ And you can try to call it with some arguments !
> - `echo` to display text
> - `xarg` to execute a chain of commands
> - `awk` to execute complex chain of commands
> - `;` `&&` and `||` to chain commands
> - `;`, `&&` and `||` to chain commands
> - `source` to load a script
> - `shebang` to specify the language of a script
> - `PATH` to install script
In the next session, we are going to learn how to execute command on other computers with [ssh.](./10_network_and_ssh.html)
In the next session, we are going to learn how to execute commands on other computers with [ssh.](./10_network_and_ssh.html)
......@@ -8,18 +8,18 @@ book:
date: "2023-10-09"
chapters:
- index.md
- 1_understanding_a_computer.Rmd
- 2_using_the_ifb_cloud.Rmd
- 3_first_steps_in_a_terminal.Rmd
- 4_unix_file_system.Rmd
- 5_users_and_rights.Rmd
- 6_unix_processes.Rmd
- 7_streams_and_pipes.Rmd
- 8_text_manipulation.Rmd
- 9_batch_processing.Rmd
- 10_network_and_ssh.Rmd
- 11_install_system_programs.Rmd
- 12_virtualization.Rmd
- 1_understanding_a_computer.qmd
- 2_using_the_ifb_cloud.qmd
- 3_first_steps_in_a_terminal.qmd
- 4_unix_file_system.qmd
- 5_users_and_rights.qmd
- 6_unix_processes.qmd
- 7_streams_and_pipes.qmd
- 8_text_manipulation.qmd
- 9_batch_processing.qmd
- 10_network_and_ssh.qmd
- 11_install_system_programs.qmd
- 12_virtualization.qmd
body-footer: "License: Creative Commons [CC-BY-SA-4.0](http://creativecommons.org/licenses/by-sa/4.0/).<br>Made with [Quarto](https://quarto.org/)."
navbar:
search: true
......
# IFB cloud group description for UNIX training
## Short name
CAN UNIX 2023
## Full name
UNIX command line training
## Website
https://gitbio.ens-lyon.fr/can/unix-command-line/
---
# Detailed description
## Résumé (20 lignes)
Le [Conseil d'Analyse Numérique (CAN)](https://www.sfr-biosciences.fr/la-sfr/conseil-analyse-numerique/) de l'UAR [SFR BioSciences](https://www.sfr-biosciences.fr) (Lyon) organise une formation **"UNIX ligne de commandes"** à destination des membres des laboratoires de biologie affiliés (entre autres ceux hébergés à l'ENS de Lyon), laquelle débutera début octobre.
Cette formation s'étalera sur une quatorzaine de semaines à raison de 1h30 par semaine au semestre d'automne (suivant les demandes, elle aura lieu tous les ans au semestre d'automne).
Les objectifs de cette formation sont:
- comprendre le fonctionnement général d'un ordinateur
- interagir avec un système de type UNIX par une interface en ligne de commande
- utiliser des ressources distantes en ligne de commande
- installer et utiliser des programmes en ligne de commandes
- manipuler des données de types textuelles de manière automatisée
- avoir des notions d'administration sur ce type de système
- avoir des notions en virtualisation de système
## Informations pratiques
- Dates : 1h30/semaine de octobre 2022 à janvier 2023
- Lieu : Centre Blaise Pascal (CBP), ENS de Lyon
- Noms des formateurs : Laurent Modolo, Ghislain Durif, Mia Croiset
- Nombre de participants : 12
## Ressources demandées
Nous utiliserons des instances de l'*appliance* "LBMC Unix 2022" déjà utilisée l'année dernière. Les TPs portent sur la prise en main de commandes bash, donc les VM les plus petites suffisent, pour un TP d'1h30 nous aurons besoin de 2 vCPU par VM au plus.
### Outils et environnements
- une distribution Linux standard (Ubuntu)
- docker
- bash
- shellinabox (pour un accès au terminal via une interface web)
Tous ces outils sont intégrés dans l'*appliance* "LBMC Unix 2022".
### Resources informatiques
*Indiquer la quantité estimée de calcul et de stockage sur la durée totale de votre formation.*
* Taille max des VMs par participant : 2 vCPU, 2Go mémoire RAM, gabarit `ifb.tr.medium` (2c 2Go)
* Nombre total d'heures vCPU (vCPU.h) : 2 vCPU * (12 participants + 2 encadrants) * 14 séances * 1h30 = 588 vCPU.h
* Volume de stockage partagé : <1Go
* Besoins spécifiques
- grosse mémoire (RAM > 1 To) : NON
- GPU : NON
- haute fréquence processeur (> 3 GHz) : NON
- parallélisme : 2 vCPU/VM max
Disponibilité des ressources après la formation ? NON
---
## Start
10/10/2023
## End
31/01/2023
# Appel à formateurs/formatrices pour formations "UNIX ligne de commandes" et "R pour les débutant(e)s" automne 2023
# Appel à formateurs/formatrices pour formations "UNIX ligne de commandes" et "R pour les débutant(e)s", automne 2024
Bonjour (english below)
......@@ -7,25 +7,25 @@ TL;DR appel à formateurs/formatrices pour des formations hebdomadaire au semest
---
Le CAN (https://www.sfr-biosciences.fr/la-sfr/conseil-analyse-numerique/) va organiser deux formations sur le semestre d'automne qui débuteront débuts octobre : "UNIX ligne de commandes" et "R pour les débutant(e)s".
Le CAN (https://www.sfr-biosciences.fr/la-sfr/conseil-analyse-numerique/) va organiser deux formations sur le semestre d'automne qui débuteront débuts octobre : "UNIX ligne de commandes" et "R pour les débutant(e)s". En option, une extension à Python d'une partie du contenu de la formation "R pour les débutant(e)s" sera proposée sur deux séances supplémentaires.
Ces formations s'étaleront sur une dizaine de semaines, jusqu'en décembre (sauf pendant les vacances de Toussaint et Noël, avec la possibilité de rajouter quelques séances en janvier si besoin) à raison de 1h30 de travaux pratiques par semaine avec 10 personnes par créneau.
Ces formations sont accessibles à tous les membres (permanents et non permanents) des laboratoires suivants : CIRI, IGFL, LBMC, RDP, MMSB, LBTI, IVPC, IBCP (partenaires de la SFR BioSciences).
Ces formations sont accessibles à tous les membres (permanents et non permanents) des laboratoires suivants (partenaires de la SFR BioSciences) : CIRI, IGFL, LBMC, RDP, MMSB, LBTI, IVPC, IBCP.
Afin d'animer ces formations, nous sommes à la recherche de formateurs et formatrices volontaires, idéalement au moins 2 par créneau.
Informations importantes :
- il n'y a pas de préparation, les supports sont prêts
- c'est 1h30 par semaine, on peut facilement échanger si un jour on n'est pas dispo
- les personnes formées sont vraiment débutantes donc les questions ne seront pas complexes et toute aide sera la bienvenue, il faut juste être à l'aise avec R ou avec la ligne de commande sur UNIX (e.g. OS Linux), pas besoin d'être un expert ou une experte.
- il n'y a pas de préparation, les supports sont prêts,
- c'est 1h30 par semaine, on peut facilement échanger si un jour on n'est pas dispo,
- les personnes formées sont vraiment débutantes donc les questions ne seront pas complexes et toute aide sera la bienvenue, il faut juste être à l'aise avec R ou avec la ligne de commande sur UNIX (e.g. OS Linux), pas besoin d'être un expert ou une experte,
- et surtout c'est super enrichissant!
Si vous êtes intéressé(e), vous pouvez vous inscrire via les liens suivants :
- UNIX ligne de commandes : https://framaforms.org/appel-a-formatrices-et-formateurs-pour-la-formation-unix-ligne-de-commande-call-for-trainers-for
- R pour les débutant(e)s : https://framaforms.org/appel-a-formatrices-et-formateurs-pour-la-formation-r-pour-les-debutantes-call-for-trainers-for-r
- UNIX ligne de commandes : https://framaforms.org/appel-a-formatrices-et-formateurs-pour-la-formation-unix-ligne-de-commande-call-for-trainers-for-0
- R pour les débutant(e)s : https://framaforms.org/appel-a-formatrices-et-formateurs-pour-la-formation-r-pour-les-debutantes-call-for-trainers-for-r-0
Planning :
......@@ -37,13 +37,14 @@ Planning :
Si vous avez des questions, vous pouvez contacter:
- Ghislain Durif (ghislain.durif@ens-lyon.fr)
- Laurent Modolo (laurent.modolo@ens-lyon.fr)
- Laurent Gilquin (laurent.gilquin@ens-lyon.fr)
Merci d'avance,
Bien cordialement,
----
# Call for trainers for "R for beginners" and "UNIX command line" training sessions, fall 2024
Hi,
......@@ -51,25 +52,25 @@ Hi,
TL;DR call for trainers for the weekly training session during fall semester : "UNIX command line" (1 slot) and "R for beginners" (4 slots), link to register below
---
The CAN (https://www.sfr-biosciences.fr/la-sfr/conseil-analyse-numerique/) will organize two training session during the fall semester (starting in early October): "UNIX command line" and "R for beginners".
The CAN (https://www.sfr-biosciences.fr/la-sfr/conseil-analyse-numerique/) will organize two training session during the fall semester (starting in early October): "UNIX command line" and "R for beginners". As an option, an extension to Python of the "R for beginners" course will be proposed over two additional sessions.
These training sessions will take place during around ten weeks, until December (except during Toussaint and Christmas Holidays, with the possibility to add additional slots in January if necessary), with 1h30 of tutorial/practical every week and 10 trainees/slot.
These training sessions are available for all (permanent and non-permanent) members of the following labs: CIRI, IGFL, LBMC, RDP, MMSB, LBTI, IVPC, IBCP (SFR BioSciences partners).
These training sessions are available for all (permanent and non-permanent) members of the following labs (SFR BioSciences partners): CIRI, IGFL, LBMC, RDP, MMSB, LBTI, IVPC, IBCP.
We are looking for volunteers to be trainers, ideally 2 per slot.
Important information :
- no preparation required, training materials are ready
- it is only 1h30 per week (or more if you want to teach multiple sessions), it is possible to switch spots with other trainers if you are not available one time
- trainees will be beginners, so questions will not be too complex and any help is welcomed, you just need to be a regular UNIX command line user (e.g. Linux OS) or R user, no need to be an expert
- no preparation required, training materials are ready,
- it is only 1h30 per week (or more if you want to teach multiple sessions), it is possible to switch spots with other trainers if you are not available one time,
- trainees will be beginners, so questions will not be too complex and any help is welcomed, you just need to be a regular UNIX command line user (e.g. Linux OS) or R user, no need to be an expert,
- and also it is highly rewarding!
If you are interested, please register using the following links :
- UNIX command line: https://framaforms.org/appel-a-formatrices-et-formateurs-pour-la-formation-unix-ligne-de-commande-call-for-trainers-for
- R for beginners: https://framaforms.org/appel-a-formatrices-et-formateurs-pour-la-formation-r-pour-les-debutantes-call-for-trainers-for-r
- UNIX command line: https://framaforms.org/appel-a-formatrices-et-formateurs-pour-la-formation-unix-ligne-de-commande-call-for-trainers-for-0
- R for beginners: https://framaforms.org/appel-a-formatrices-et-formateurs-pour-la-formation-r-pour-les-debutantes-call-for-trainers-for-r-0
Schedule :
......@@ -81,8 +82,7 @@ Schedule :
If you have any questions, please contact:
- Ghislain Durif (ghislain.durif@ens-lyon.fr)
- Laurent Modolo (laurent.modolo@ens-lyon.fr)
- Laurent Gilquin (laurent.gilquin@ens-lyon.fr)
Thanks in advance,
Best regards,
# Formations "UNIX ligne de commandes" et "R pour les débutant(e)s" automne 2023
# Formations "UNIX ligne de commandes" et "R pour les débutant(e)s", automne 2024
Bonjour (english below)
......@@ -7,11 +7,11 @@ TL;DR formations hebdomadaire au semestre d'automne "UNIX ligne de commandes" (1
---
Le CAN (https://www.sfr-biosciences.fr/la-sfr/conseil-analyse-numerique/) va organiser deux formations sur le semestre d'automne qui débuteront débuts octobre : "UNIX ligne de commandes" et "R pour les débutant(e)s".
Le CAN (https://www.sfr-biosciences.fr/la-sfr/conseil-analyse-numerique/) va organiser deux formations sur le semestre d'automne qui débuteront débuts octobre : "UNIX ligne de commandes" et "R pour les débutant(e)s". En option, une extension à Python d'une partie du contenu de la formation "R pour les débutant(e)s" sera proposée sur deux séances supplémentaires.
Ces formations s'étaleront sur une dizaine de semaines, jusqu'en décembre (sauf pendant les vacances de Toussaint et Noël, avec la possibilité de rajouter quelques séances en janvier si besoin) à raison de 1h30 de travaux pratiques par semaine.
Ces formations sont accessibles à tous les membres (permanents et non permanents) des laboratoires suivants : CIRI, IGFL, LBMC, RDP, MMSB, LBTI, IVPC, IBCP (partenaires de la SFR BioSciences).
Ces formations sont accessibles à tous les membres (permanents et non permanents) des laboratoires suivants (partenaires de la SFR BioSciences): CIRI, IGFL, LBMC, RDP, MMSB, LBTI, IVPC, IBCP.
Prérequis : avoir un compte @ens-lyon.fr (pour accéder aux ordinateurs des salles de TP) ou avoir un ordinateur portable avec accès à internet via eduroam et un navigateur internet récent (aucune installation spécifique nécessaire, les TPs se font via une plateforme spécifique accessible par son navigateur Internet).
......@@ -19,10 +19,10 @@ Il y aura 1 créneau hebdomadaire (en français ou anglais suivant la demande) p
Si vous êtes intéressé(e), vous pouvez vous inscrire via les liens suivants :
- UNIX ligne de commandes : https://framaforms.org/formation-unix-ligne-de-commande-unix-command-line-training-session-1693397101
- R pour les débutant(e)s : https://framaforms.org/formation-r-pour-les-debutantes-r-for-beginners-training-session-1693316875
- UNIX ligne de commandes : https://framaforms.org/formation-unix-ligne-de-commande-unix-command-line-training-session-1720512376
- R pour les débutant(e)s : https://framaforms.org/formation-r-pour-les-debutantes-r-for-beginners-training-session-1720512419
IMPORTANT : En vous inscrivant vous vous engagez à venir sur l'ensemble de la formation (sauf absence ponctuelle en cas d'impératif professionnel ou personnel évidemment).
IMPORTANT : En vous inscrivant vous vous engagez à venir sur l'ensemble de la formation (sauf absence ponctuelle en cas d'impératif professionnel ou personnel évidemment). Les attestations de formation ne seront délivrées qu'aux personnes ayant suivi au moins 80% des séances de leur groupe.
Planning :
......@@ -34,10 +34,9 @@ Planning :
Si vous avez des questions, vous pouvez contacter:
- Ghislain Durif (ghislain.durif@ens-lyon.fr)
- Laurent Modolo (laurent.modolo@ens-lyon.fr)
- Laurent Gilquin (laurent.gilquin@ens-lyon.fr)
(Note : un e-mail différent sera envoyé pour en appeler aux formateurs et formatrices volontaires)
# Note : un e-mail différent sera envoyé pour en appeler aux formateurs et formatrices volontaires
Les objectifs de ces formations sont :
......@@ -59,10 +58,12 @@ Pour "R pour les débutant(e)s" :
- filtrer et trier des tables de données
- réorganiser des tables de données
- réaliser des figures
- manipuler des EXpressions REGulières (regex)
Bien cordialement,
----
# "R for beginners" and "UNIX command line" training sessions, fall 2024
Hi,
......@@ -70,11 +71,11 @@ Hi,
TL;DR weekly training session during fall semester : "UNIX command line" (10 places on 1 slot) and "R for beginners" (40 places on 4 slots), link to register below (thanks to carefully read the information below)
---
The CAN (https://www.sfr-biosciences.fr/la-sfr/conseil-analyse-numerique/) will organize two training session during the fall semester (starting in early October): "UNIX command line" and "R for beginners".
The CAN (https://www.sfr-biosciences.fr/la-sfr/conseil-analyse-numerique/) will organize two training session during the fall semester (starting in early October): "UNIX command line" and "R for beginners". As an option, an extension to Python of the "R for beginners" course will be proposed over two additional sessions.
These training sessions will take place during around ten weeks, until December (except during Toussaint and Christmas Holidays, with the possibility to add additional slots in January if necessary), with 1h30 of tutorial/practical every week.
These training sessions are available for all (permanent and non-permanent) members of the following labs: CIRI, IGFL, LBMC, RDP, MMSB, LBTI, IVPC, IBCP (SFR BioSciences partners).
These training sessions are available for all (permanent and non-permanent) members of the following labs (SFR BioSciences partners): CIRI, IGFL, LBMC, RDP, MMSB, LBTI, IVPC, IBCP.
Requirement: having an @ens-lyon.fr account (to access computers during the session) or having a laptop with a working eduroam Internet access and a recent web browser (no further installation is required, all practicals will be done via a specific platform available through the web browser).
......@@ -82,10 +83,10 @@ There will be 1 weekly session (in french or in english depending on the registe
If you are interested, please register using the following links :
- UNIX command line: https://framaforms.org/formation-unix-ligne-de-commande-1661852334
- R for beginners: https://framaforms.org/formation-r-pour-les-debutantes-1661853807
- UNIX command line: https://framaforms.org/formation-unix-ligne-de-commande-unix-command-line-training-session-1720512376
- R for beginners: https://framaforms.org/formation-r-pour-les-debutantes-r-for-beginners-training-session-1720512419
IMPORTANT: By registering, you agree to attend the entire course (except for one-time absences in case of professional or personal imperative obviously).
IMPORTANT: By registering, you agree to attend the entire course (except for one-time absences in case of professional or personal imperative obviously). Training certificates will only be delivered to people who have attended at least 80% of their group's sessions.
Schedule :
......@@ -97,10 +98,9 @@ Schedule :
If you have any questions, please contact:
- Ghislain Durif (ghislain.durif@ens-lyon.fr)
- Laurent Modolo (laurent.modolo@ens-lyon.fr)
- Laurent Gilquin (laurent.gilquin@ens-lyon.fr)
(Note: a separate e-mail will be send to call for trainers)
# Note: a separate e-mail will be send to call for trainers
The contents of the these training sessions are the following :
......@@ -120,6 +120,7 @@ For "R for beginners":
- filter and sort data table
- reorganize data table
- generate graphics and plots
- manipulate REGular EXpressions (regex)
Best regards,
$webform = array (
'nid' => '779305',
'nid' => '987106',
'next_serial' => '1',
'confirmation' => '',
'confirmation_format' => 'wysiwyg_user',
......@@ -46,7 +46,7 @@ $webform = array (
array (
15 =>
array (
'nid' => 779305,
'nid' => 987106,
'cid' => '15',
'pid' => '0',
'form_key' => 'new_1663580649768',
......@@ -65,7 +65,7 @@ $webform = array (
'title_display' => 'before',
'description' => '',
'description_above' => false,
'placeholder' => 'Dupont',
'placeholder' => 'John',
'attributes' =>
array (
),
......@@ -80,7 +80,7 @@ $webform = array (
),
14 =>
array (
'nid' => 779305,
'nid' => 987106,
'cid' => '14',
'pid' => '0',
'form_key' => 'new_1663580608320',
......@@ -99,7 +99,7 @@ $webform = array (
'title_display' => 'before',
'description' => '',
'description_above' => false,
'placeholder' => 'John',
'placeholder' => 'Dupont',
'attributes' =>
array (
),
......@@ -114,7 +114,7 @@ $webform = array (
),
1 =>
array (
'nid' => 779305,
'nid' => 987106,
'cid' => '1',
'pid' => '0',
'form_key' => 'new_1661852344800',
......@@ -126,7 +126,7 @@ $webform = array (
'multiple' => 0,
'format' => 'short',
'width' => '',
'unique' => 1,
'unique' => 0,
'disabled' => 0,
'title_display' => 'before',
'description' => '',
......@@ -146,7 +146,7 @@ $webform = array (
),
3 =>
array (
'nid' => 779305,
'nid' => 987106,
'cid' => '3',
'pid' => '0',
'form_key' => 'new_1661852536156',
......@@ -187,7 +187,7 @@ IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service
),
30 =>
array (
'nid' => 779305,
'nid' => 987106,
'cid' => '30',
'pid' => '0',
'form_key' => 'new_1693394806558',
......@@ -222,7 +222,7 @@ IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service
),
31 =>
array (
'nid' => 779305,
'nid' => 987106,
'cid' => '31',
'pid' => '0',
'form_key' => 'new_1693394865971',
......@@ -257,15 +257,15 @@ IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service
),
32 =>
array (
'nid' => 779305,
'nid' => 987106,
'cid' => '32',
'pid' => '0',
'form_key' => 'new_1693394929998',
'name' => 'Cloud IFB',
'type' => 'markup',
'value' => '<p>Nous utilisons le cloud de l\'IFB (<link href="https://biosphere.france-bioinformatique.fr/">https://biosphere.france-bioinformatique.fr/</link>) pour les travaux pratiques (les stagiaires travailleront depuis un navigateur internet sur une instance Rstudio server hébergé sur le cloud de l\'IFB).</p>
'value' => '<p>Nous utilisons le cloud de l\'IFB (<link href="https://biosphere.france-bioinformatique.fr/">https://biosphere.france-bioinformatique.fr/</link>) pour les travaux pratiques (les stagiaires travailleront depuis un navigateur internet sur une machine virtuelle (Ubuntu) hébergée sur le cloud de l\'IFB).</p>
<p><i>We use the IFB cloud (<link href="https://biosphere.france-bioinformatique.fr/">https://biosphere.france-bioinformatique.fr/</link>) for the practicals (trainees work in their web browser on a Rstudio server hosted on IFB cloud).</i></p>',
<p><i>We use the IFB cloud (<link href="https://biosphere.france-bioinformatique.fr/">https://biosphere.france-bioinformatique.fr/</link>) for the practicals (trainees work in their web browser on virtual machine (Ubuntu) hosted on IFB cloud).</i></p>',
'extra' =>
array (
'format' => 'wysiwyg_user',
......@@ -278,7 +278,7 @@ IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service
),
12 =>
array (
'nid' => 779305,
'nid' => 987106,
'cid' => '12',
'pid' => '0',
'form_key' => 'new_1663579980628',
......@@ -311,7 +311,7 @@ IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service
),
23 =>
array (
'nid' => 779305,
'nid' => 987106,
'cid' => '23',
'pid' => '0',
'form_key' => 'new_1693320671454',
......@@ -336,7 +336,7 @@ IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service
),
26 =>
array (
'nid' => 779305,
'nid' => 987106,
'cid' => '26',
'pid' => '0',
'form_key' => 'new_1693321164081',
......@@ -372,7 +372,7 @@ IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service
),
21 =>
array (
'nid' => 779305,
'nid' => 987106,
'cid' => '21',
'pid' => '0',
'form_key' => 'new_1693319362737',
......@@ -406,7 +406,7 @@ IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service
),
24 =>
array (
'nid' => 779305,
'nid' => 987106,
'cid' => '24',
'pid' => '0',
'form_key' => 'new_1693320727085',
......@@ -427,7 +427,7 @@ IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service
),
28 =>
array (
'nid' => 779305,
'nid' => 987106,
'cid' => '28',
'pid' => '0',
'form_key' => 'new_1693321289280',
......
$webform = array (
'nid' => '778921',
'nid' => '987108',
'next_serial' => '1',
'confirmation' => '',
'confirmation_format' => 'wysiwyg_user',
......@@ -46,7 +46,7 @@ $webform = array (
array (
15 =>
array (
'nid' => 778921,
'nid' => 987108,
'cid' => '15',
'pid' => '0',
'form_key' => 'new_1663580649768',
......@@ -65,7 +65,7 @@ $webform = array (
'title_display' => 'before',
'description' => '',
'description_above' => false,
'placeholder' => 'Dupont',
'placeholder' => 'John',
'attributes' =>
array (
),
......@@ -80,7 +80,7 @@ $webform = array (
),
14 =>
array (
'nid' => 778921,
'nid' => 987108,
'cid' => '14',
'pid' => '0',
'form_key' => 'new_1663580608320',
......@@ -99,7 +99,7 @@ $webform = array (
'title_display' => 'before',
'description' => '',
'description_above' => false,
'placeholder' => 'John',
'placeholder' => 'Dupont',
'attributes' =>
array (
),
......@@ -114,7 +114,7 @@ $webform = array (
),
1 =>
array (
'nid' => 778921,
'nid' => 987108,
'cid' => '1',
'pid' => '0',
'form_key' => 'new_1661852344800',
......@@ -126,7 +126,7 @@ $webform = array (
'multiple' => 0,
'format' => 'short',
'width' => '',
'unique' => 1,
'unique' => 0,
'disabled' => 0,
'title_display' => 'before',
'description' => '',
......@@ -146,7 +146,7 @@ $webform = array (
),
3 =>
array (
'nid' => 778921,
'nid' => 987108,
'cid' => '3',
'pid' => '0',
'form_key' => 'new_1661852536156',
......@@ -187,7 +187,7 @@ IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service
),
20 =>
array (
'nid' => 778921,
'nid' => 987108,
'cid' => '20',
'pid' => '0',
'form_key' => 'new_1693318963943',
......@@ -208,7 +208,7 @@ IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service
),
19 =>
array (
'nid' => 778921,
'nid' => 987108,
'cid' => '19',
'pid' => '0',
'form_key' => 'new_1693316967281',
......@@ -244,7 +244,7 @@ Ni l\'un ni l\'autre / None of the above|Ni l\'un ni l\'autre / None of the abov
),
12 =>
array (
'nid' => 778921,
'nid' => 987108,
'cid' => '12',
'pid' => '0',
'form_key' => 'new_1663579980628',
......@@ -277,7 +277,7 @@ Ni l\'un ni l\'autre / None of the above|Ni l\'un ni l\'autre / None of the abov
),
23 =>
array (
'nid' => 778921,
'nid' => 987108,
'cid' => '23',
'pid' => '0',
'form_key' => 'new_1693320671454',
......@@ -302,7 +302,7 @@ Ni l\'un ni l\'autre / None of the above|Ni l\'un ni l\'autre / None of the abov
),
26 =>
array (
'nid' => 778921,
'nid' => 987108,
'cid' => '26',
'pid' => '0',
'form_key' => 'new_1693321164081',
......@@ -338,7 +338,7 @@ Ni l\'un ni l\'autre / None of the above|Ni l\'un ni l\'autre / None of the abov
),
17 =>
array (
'nid' => 778921,
'nid' => 987108,
'cid' => '17',
'pid' => '0',
'form_key' => 'new_1663582031315',
......@@ -354,7 +354,7 @@ Ni l\'un ni l\'autre / None of the above|Ni l\'un ni l\'autre / None of the abov
<li><p>Il ne sera pas possible de changer de groupes (sauf cas exceptionnel) au cours du semestre car chaque groupe ira à sa vitesse.</p>
<p><i>It will not be possible to switch groups (except in exceptional cases) during the semester because each group will go at its own pace</i><p></li>
<p><i>It will not be possible to switch groups (except in exceptional cases) during the semester because each group will go at its own pace.</i><p></li>
</ul></p>',
'extra' =>
......@@ -369,7 +369,7 @@ Ni l\'un ni l\'autre / None of the above|Ni l\'un ni l\'autre / None of the abov
),
21 =>
array (
'nid' => 778921,
'nid' => 987108,
'cid' => '21',
'pid' => '0',
'form_key' => 'new_1693319362737',
......@@ -403,15 +403,19 @@ Ni l\'un ni l\'autre / None of the above|Ni l\'un ni l\'autre / None of the abov
),
24 =>
array (
'nid' => 778921,
'nid' => 987108,
'cid' => '24',
'pid' => '0',
'form_key' => 'new_1693320727085',
'name' => 'Nouveau champ "balisage"',
'type' => 'markup',
'value' => '<p>(sauf absence ponctuelle en cas d\'impératif professionnel ou personnel évidemment)</p>
'value' => '<p>(sauf absence ponctuelle en cas d\'impératif professionnel ou personnel évidemment)
Les attestations de formation ne seront délivrées qu\'aux personnes ayant suivi <b>au moins 80%</b> des séances de leur groupe.
</p>
<p><i>(except for one-time absences in case of professional or personal imperative obviously)</i><p>',
<p><i>(except for one-time absences in case of professional or personal imperative obviously)
Training certificates will only be delivered to people who have attended <b>at least 80%</b> of their group\'s sessions.
</i><p>',
'extra' =>
array (
'format' => 'wysiwyg_user',
......@@ -424,7 +428,7 @@ Ni l\'un ni l\'autre / None of the above|Ni l\'un ni l\'autre / None of the abov
),
28 =>
array (
'nid' => 778921,
'nid' => 987108,
'cid' => '28',
'pid' => '0',
'form_key' => 'new_1693321289280',
......
- hosts: all
tasks:
- name: Delete buggy OpenSSL python package
ansible.builtin.file:
path: /usr/lib/python3/dist-packages/OpenSSL
state: absent
- name: Reinstall pyopenssl
ansible.builtin.pip:
executable: pip3
name: pyopenssl
state: forcereinstall
- name: Update the system
apt:
upgrade: dist
......