You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Updated text-Fu/env: added examples and explanations for setting env variables
* Enhance env lesson content across multiple languages with improved clarity and examples
This commit updates the env (Umgebung) lesson by refining content and metadata in various languages. Key changes include:
- Improved phrasing and corrected typos for better readability.
- Added examples for setting environment variables to enhance understanding.
- Updated meta descriptions and keywords for improved SEO.
These changes aim to provide a clearer and more engaging learning experience for users.
* Refine env lesson content across multiple languages for clarity and consistency
This commit enhances the env (Umgebung) lesson by improving phrasing, correcting typos, and updating metadata in various languages. Key changes include:
- Enhanced clarity in explanations and examples for setting environment variables.
- Improved meta descriptions and keywords for better SEO.
These updates aim to provide a more engaging and informative learning experience for users.
---------
Co-authored-by: huhuhang <5147530+huhuhang@users.noreply.github.com>
Co-authored-by: huhuhang <huhuhang@users.noreply.github.com>
Copy file name to clipboardExpand all lines: lessons/de/text-fu/env-environment.md
+65-9Lines changed: 65 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,15 +13,15 @@ Ihr Linux-System verwendet Umgebungsvariablen, um Informationen zu speichern, au
13
13
14
14
### Grundlegende Umgebungsvariablen untersuchen
15
15
16
-
Sie können den Wert einer bestimmten Variablen anzeigen, indem Sie deren Namen ein `$`-Symbol voranstellen. Führen Sie beispielsweise den folgenden Befehl aus:
16
+
Sie können den Wert einer bestimmten Variablen anzeigen, indem Sie deren Namen ein `$`-Symbol voranstellen. Führen Sie zum Beispiel den folgenden Befehl aus:
17
17
18
18
```bash
19
19
echo$HOME
20
20
```
21
21
22
-
Dieser Befehl zeigt den Pfad zu Ihrem Home-Verzeichnis an, der etwa so aussehen könnte wie`/home/pete`.
22
+
Dieser Befehl zeigt den Pfad zu Ihrem Home-Verzeichnis an, der etwa so aussehen könnte:`/home/pete`.
23
23
24
-
Versuchen Sie es nun mit einem weiteren:
24
+
Versuchen Sie nun Folgendes:
25
25
26
26
```bash
27
27
echo$USER
@@ -57,19 +57,75 @@ echo $PATH
57
57
58
58
Dieser Befehl gibt eine durch Doppelpunkte getrennte Liste von Verzeichnissen zurück. Wenn Sie einen Befehl eingeben, durchsucht Ihr System diese Verzeichnisse, um die entsprechende ausführbare Datei zu finden.
59
59
60
-
Stellen Sie sich vor, Sie installieren manuell ein Programm in einem nicht standardmäßigen Verzeichnis wie `/opt/coolapp/bin`. Wenn Sie versuchen, es durch Eingabe von`coolcommand`auszuführen, erhalten Sie möglicherweise eine Fehlermeldung „command not found“. Dies geschieht, weil das Verzeichnis, das Ihr Programm enthält, nicht in der `PATH`-Variable aufgeführt ist, sodass die Shell nicht weiß, wo sie danach suchen soll.
60
+
Stellen Sie sich vor, Sie installieren manuell ein Programm in einem nicht standardmäßigen Verzeichnis wie `/opt/coolapp/bin`. Wenn Sie versuchen, es auszuführen, indem Sie`coolcommand`eingeben, erhalten Sie möglicherweise eine Fehlermeldung „command not found“. Dies geschieht, weil das Verzeichnis, das Ihr Programm enthält, nicht in der `PATH`-Variable aufgeführt ist, sodass die Shell nicht weiß, wo sie danach suchen soll.
61
61
62
-
Um dies zu beheben, können Sie die `PATH`-Variable ändern, um das neue Verzeichnis einzuschließen. Indem Sie Ihr benutzerdefiniertes Verzeichnis zu `PATH` hinzufügen, ermöglichen Sie der Shell, Ihre Programme von überall im Terminal zu finden und auszuführen.
62
+
Um dies zu beheben, können Sie die `PATH`-Variable ändern, um das neue Verzeichnis einzuschließen. Indem Sie Ihr benutzerdefiniertes Verzeichnis zu `PATH` hinzufügen, ermöglichen Sie der Shell, Ihre Programme von überall im Terminal aus zu finden und auszuführen.
63
+
64
+
### Festlegen einer Umgebungsvariable für die aktuelle Sitzung
65
+
66
+
Der folgende Befehl im Terminal legt die Umgebungsvariable `TEST` nur für die aktuelle Sitzung fest:
67
+
68
+
```bash
69
+
export TEST=test
70
+
```
71
+
72
+
Danach, wenn Sie ausführen:
73
+
74
+
```bash
75
+
echo$TEST
76
+
```
77
+
78
+
wird die Ausgabe sein:
79
+
80
+
```
81
+
test
82
+
```
83
+
84
+
Diese Variable ist verfügbar, solange die Terminalsitzung geöffnet bleibt. Sobald Sie das Terminal schließen und erneut öffnen, existiert die Variable nicht mehr.
85
+
86
+
### Die Umgebungsvariable sitzungsübergreifend persistent machen
87
+
88
+
Wenn die Umgebungsvariable in jeder Terminalsitzung verfügbar sein soll (auch nach dem Schließen und erneuten Öffnen des Terminals), müssen Sie sie zur Startdatei Ihrer Shell hinzufügen. Im Falle von Bash (der Standard-Shell für viele Linux-Distributionen und macOS) ist diese Datei normalerweise `.bashrc` in Ihrem Home-Verzeichnis.
89
+
90
+
Hier erfahren Sie, wie Sie dies tun:
91
+
92
+
1. Öffnen Sie `.bashrc` in Ihrem bevorzugten Texteditor. Zum Beispiel:
93
+
94
+
```bash
95
+
nano ~/.bashrc
96
+
```
97
+
98
+
2. Fügen Sie die `export`-Zeile am Ende der Datei hinzu:
99
+
100
+
```bash
101
+
export TEST=test
102
+
```
103
+
104
+
3. Speichern und beenden Sie den Editor (in Nano wäre dies `Strg+X`, dann `J` zur Bestätigung und `Enter`).
105
+
106
+
4. Um die Änderungen sofort anzuwenden, ohne das Terminal erneut öffnen zu müssen, führen Sie Folgendes aus:
107
+
108
+
```bash
109
+
source~/.bashrc
110
+
```
111
+
112
+
Danach ist die Variable `TEST` in allen zukünftigen Terminalsitzungen verfügbar, und die Ausführung von `echo $TEST` gibt `test` aus, auch nachdem Sie das Terminal geschlossen und erneut geöffnet haben.
113
+
114
+
### Ein Hinweis zu Shell-Konfigurationsdateien
115
+
116
+
- Für **Bash** (Standard auf vielen Systemen) ist die relevante Datei `~/.bashrc` für nicht-anmeldende interaktive Shells.
117
+
- Für **Zsh** ist die entsprechende Datei normalerweise `~/.zshrc`.
118
+
- Für **Fish** würden Sie typischerweise `~/.config/fish/config.fish` verwenden.
63
119
64
120
## Exercise
65
121
66
122
Übung macht den Meister! Hier sind einige praktische Übungen, um Ihr Verständnis von Linux-Umgebungsvariablen zu festigen:
67
123
68
-
1.**[Shell-Umgebung und Konfiguration unter Linux verwalten](https://labex.io/de/labs/comptia-manage-shell-environment-and-configuration-in-linux-590838)**– Üben Sie das Erstellen und Verwalten lokaler Variablen und Umgebungsvariablen, das Verständnis der Vererbung und das dauerhaftes Speichern von Konfigurationen durch Bearbeiten der `.bashrc`-Datei.
69
-
2.**[Umgebungsvariablen unter Linux](https://labex.io/de/labs/linux-environment-variables-in-linux-385274)**– Lernen Sie das Konzept und die Verwendung von Umgebungsvariablen kennen, wie man sie erstellt, ändert und verwaltet und welche Rolle sie bei der Systemkonfiguration spielen.
70
-
3.**[Linux-Umgebungsvariablen konfigurieren](https://labex.io/de/labs/linux-configure-linux-environment-variables-437861)**– Sammeln Sie praktische Erfahrungen beim Erstellen, Festlegen und Verwalten von Umgebungsvariablen in einem Linux-System.
124
+
1.**[Shell-Umgebung und Konfiguration in Linux verwalten](https://labex.io/de/labs/comptia-manage-shell-environment-and-configuration-in-linux-590838)**- Üben Sie das Erstellen und Verwalten lokaler Variablen und Umgebungsvariablen, das Verständnis der Vererbung und das dauerhaftes Speichern von Konfigurationen durch Bearbeiten der Datei `.bashrc`.
125
+
2.**[Umgebungsvariablen in Linux](https://labex.io/de/labs/linux-environment-variables-in-linux-385274)**- Lernen Sie das Konzept und die Verwendung von Umgebungsvariablen kennen, wie man sie erstellt, ändert und verwaltet und welche Rolle sie bei der Systemkonfiguration spielen.
126
+
3.**[Linux-Umgebungsvariablen konfigurieren](https://labex.io/de/labs/linux-configure-linux-environment-variables-437861)**- Sammeln Sie praktische Erfahrungen beim Erstellen, Festlegen und Verwalten von Umgebungsvariablen in einem Linux-System.
71
127
72
-
Diese Labs helfen Ihnen, die Konzepte in realen Szenarien anzuwenden und Vertrauen in die Verwaltung Ihrer Linux-Shell-Umgebung aufzubauen.
128
+
Diese Labs helfen Ihnen, die Konzepte in realen Szenarien anzuwenden und Vertrauen im Umgang mit Ihrer Linux-Shell-Umgebung aufzubauen.
Copy file name to clipboardExpand all lines: lessons/en/text-fu/env-environment.md
+56Lines changed: 56 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,62 @@ Imagine you manually install a program in a non-standard directory like `/opt/co
61
61
62
62
To fix this, you can modify the `PATH` variable to include the new directory. By adding your custom directory to `PATH`, you enable the shell to find and execute your programs from anywhere in the terminal.
63
63
64
+
### Setting an Environment Variable for the Current Session
65
+
66
+
Running the following command in your terminal sets the environment variable `TEST` for the current session only:
67
+
68
+
```bash
69
+
export TEST=test
70
+
```
71
+
72
+
After this, if you run:
73
+
74
+
```bash
75
+
echo$TEST
76
+
```
77
+
78
+
The output will be:
79
+
80
+
```
81
+
test
82
+
```
83
+
84
+
This variable will be available as long as the terminal session remains open. Once you close and reopen the terminal, the variable will no longer exist.
85
+
86
+
### Making the Environment Variable Persistent Across Sessions
87
+
88
+
If you want the environment variable to be available in every terminal session (even after closing and reopening the terminal), you need to add it to your shell’s startup file. In the case of Bash (the default shell for many Linux distributions and macOS), this file is usually `.bashrc` in your home directory.
89
+
90
+
Here's how you do it:
91
+
92
+
1. Open `.bashrc` in your preferred text editor. For example:
93
+
94
+
```bash
95
+
nano ~/.bashrc
96
+
```
97
+
98
+
2. Add the `export` line to the end of the file:
99
+
100
+
```bash
101
+
export TEST=test
102
+
```
103
+
104
+
3. Save and exit the editor (in Nano, this would be `Ctrl+X`, then `Y` to confirm, and `Enter`).
105
+
106
+
4. To apply the changes immediately without reopening the terminal, run:
107
+
108
+
```bash
109
+
source~/.bashrc
110
+
```
111
+
112
+
After this, the `TEST` variable will be available in all future terminal sessions, and running `echo $TEST` will print `test` even after you close and reopen the terminal.
113
+
114
+
### A Note on Shell Configuration Files
115
+
116
+
- For **Bash** (the default on many systems), the relevant file is `~/.bashrc` for non-login interactive shells.
117
+
- For **Zsh**, the equivalent file is usually `~/.zshrc`.
118
+
- For **Fish**, you'd typically use `~/.config/fish/config.fish`.
119
+
64
120
## Exercise
65
121
66
122
Practice makes perfect! Here are some hands-on labs to reinforce your understanding of Linux environment variables:
Copy file name to clipboardExpand all lines: lessons/es/text-fu/env-environment.md
+64-8Lines changed: 64 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ Su sistema Linux utiliza variables de entorno para almacenar información a la q
13
13
14
14
### Explorando Variables de Entorno Básicas
15
15
16
-
You puede ver el valor de una variable específica anteponiendo su nombre con un símbolo de `$`. Por ejemplo, ejecute el siguiente comando:
16
+
You puede ver el valor de una variable específica anteponiendo su nombre con un símbolo de `$`. Por ejemplo, ejecute el siguiente comando:
17
17
18
18
```bash
19
19
echo$HOME
@@ -27,11 +27,11 @@ Ahora, pruebe con otro:
27
27
echo$USER
28
28
```
29
29
30
-
Esto mostrará su nombre de usuario actual. ¿Pero de dónde viene esta información? Se almacena en el entorno de su shell.
30
+
Esto mostrará su nombre de usuario actual. ¿Pero de dónde viene esta información? Está almacenada en el entorno de su shell.
31
31
32
32
### ¿Qué Hace `env` en Linux?
33
33
34
-
Para ver todas las variables de entorno configuradas actualmente para su sesión, puede usar el comando `env`. El `comando linux env` es una herramienta fundamental para inspeccionar la configuración de su shell.
34
+
Para ver todas las variables de entorno configuradas actualmente para su sesión, puede usar el comando `env`. El `comando env de linux` es una herramienta fundamental para inspeccionar la configuración de su shell.
35
35
36
36
```bash
37
37
env
@@ -45,7 +45,7 @@ PWD=/home/user
45
45
USER=pete
46
46
```
47
47
48
-
Comprender el `linux env` es crucial para administrar su sistema de manera efectiva.
48
+
Comprender el `env de linux` es crucial para administrar su sistema de manera efectiva.
49
49
50
50
### La Importancia de la Variable PATH
51
51
@@ -61,15 +61,71 @@ Imagine que instala manualmente un programa en un directorio no estándar como `
61
61
62
62
Para solucionar esto, puede modificar la variable `PATH` para incluir el nuevo directorio. Al agregar su directorio personalizado a `PATH`, permite que el shell encuentre y ejecute sus programas desde cualquier lugar de la terminal.
63
63
64
+
### Establecer una Variable de Entorno para la Sesión Actual
65
+
66
+
Ejecutar el siguiente comando en su terminal establece la variable de entorno `TEST` solo para la sesión actual:
67
+
68
+
```bash
69
+
export TEST=test
70
+
```
71
+
72
+
Después de esto, si ejecuta:
73
+
74
+
```bash
75
+
echo$TEST
76
+
```
77
+
78
+
La salida será:
79
+
80
+
```
81
+
test
82
+
```
83
+
84
+
Esta variable estará disponible mientras la sesión de terminal permanezca abierta. Una vez que cierre y vuelva a abrir la terminal, la variable ya no existirá.
85
+
86
+
### Hacer Persistente la Variable de Entorno Entre Sesiones
87
+
88
+
Si desea que la variable de entorno esté disponible en cada sesión de terminal (incluso después de cerrar y volver a abrir la terminal), debe agregarla al archivo de inicio de su shell. En el caso de Bash (el shell predeterminado para muchas distribuciones de Linux y macOS), este archivo suele ser `.bashrc` en su directorio de inicio.
89
+
90
+
Así es como se hace:
91
+
92
+
1. Abra `.bashrc` en su editor de texto preferido. Por ejemplo:
93
+
94
+
```bash
95
+
nano ~/.bashrc
96
+
```
97
+
98
+
2. Agregue la línea `export` al final del archivo:
99
+
100
+
```bash
101
+
export TEST=test
102
+
```
103
+
104
+
3. Guarde y salga del editor (en Nano, esto sería `Ctrl+X`, luego `Y` para confirmar y `Enter`).
105
+
106
+
4. Para aplicar los cambios inmediatamente sin volver a abrir la terminal, ejecute:
107
+
108
+
```bash
109
+
source~/.bashrc
110
+
```
111
+
112
+
Después de esto, la variable `TEST` estará disponible en todas las sesiones de terminal futuras, y ejecutar `echo $TEST` imprimirá `test` incluso después de cerrar y volver a abrir la terminal.
113
+
114
+
### Una Nota sobre los Archivos de Configuración del Shell
115
+
116
+
- Para **Bash** (el predeterminado en muchos sistemas), el archivo relevante es `~/.bashrc` para shells interactivos que no inician sesión.
117
+
- Para **Zsh**, el archivo equivalente suele ser `~/.zshrc`.
118
+
- Para **Fish**, normalmente usaría `~/.config/fish/config.fish`.
119
+
64
120
## Exercise
65
121
66
122
¡La práctica hace al maestro! Aquí hay algunos laboratorios prácticos para reforzar su comprensión de las variables de entorno de Linux:
67
123
68
-
1.**[Administrar el Entorno y la Configuración del Shell en Linux](https://labex.io/es/labs/comptia-manage-shell-environment-and-configuration-in-linux-590838)** - Practique la creación y gestión de variables locales y de entorno, comprenda la herencia y haga que las configuraciones sean persistentes modificando el archivo `.bashrc`.
69
-
2.**[Variables de Entorno en Linux](https://labex.io/es/labs/linux-environment-variables-in-linux-385274)** - Aprenda el concepto y el uso de las variables de entorno, cómo crearlas, modificarlas y gestionarlas, y su papel en la configuración del sistema.
70
-
3.**[Configurar Variables de Entorno de Linux](https://labex.io/es/labs/linux-configure-linux-environment-variables-437861)** - Obtenga experiencia práctica creando, estableciendo y gestionando variables de entorno en un sistema Linux.
124
+
1.**[Administrar el Entorno y la Configuración del Shell en Linux](https://labex.io/es/labs/comptia-manage-shell-environment-and-configuration-in-linux-590838)** - Practique la creación y administración de variables locales y de entorno, comprenda la herencia y haga que las configuraciones sean persistentes modificando el archivo `.bashrc`.
125
+
2.**[Variables de Entorno en Linux](https://labex.io/es/labs/linux-environment-variables-in-linux-385274)** - Aprenda el concepto y el uso de las variables de entorno, cómo crearlas, modificarlas y administrarlas, y su papel en la configuración del sistema.
126
+
3.**[Configurar Variables de Entorno de Linux](https://labex.io/es/labs/linux-configure-linux-environment-variables-437861)** - Obtenga experiencia práctica creando, estableciendo y administrando variables de entorno en un sistema Linux.
71
127
72
-
Estos laboratorios le ayudarán a aplicar los conceptos en escenarios reales y a ganar confianza en la gestión del entorno de su shell Linux.
128
+
Estos laboratorios le ayudarán a aplicar los conceptos en escenarios reales y a ganar confianza en la administración del entorno de su shell de Linux.
0 commit comments