From the course: Linux: Shells and Processes
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Variables and shell environment - Linux Tutorial
From the course: Linux: Shells and Processes
Variables and shell environment
- The shell store has configuration items as well as information in Shell Variables. For example, the format of your shell prompt is stored in a variable named PS1. You can view this variable using the echo command. Whenever accessing variables, prefixed the variable name with the dollar sign. For instance, type in "echo $PS1" and hit enter. This shows my prompt format which equates to my username, the "@" symbol followed by the host name and the current working directory, and lastly the dollar sign. Not only can we read this information, but we can change it. Type in "PS1" equals double quote, backslash "u", colon, backslash "$", space double quote and hit enter. We can see that my prompt changed only include my username. This isn't saved anywhere so if I want to revert it back, I can just close a terminal and open it again. Now that we've seen how variables are used, let's talk about the types of variables. There…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
About Linux shells6m 21s
-
About Linux terminals1m 50s
-
(Locked)
Shell pathname tricks7m 7s
-
(Locked)
Shell history tricks3m 29s
-
(Locked)
Configure shell history6m 59s
-
(Locked)
Variables and shell environment5m 33s
-
(Locked)
Make shell variables persistent6m 48s
-
(Locked)
Pattern matching with globs5m 9s
-
(Locked)
Globs exercise6m 42s
-
(Locked)
Pattern matching with extended globs6m 25s
-
(Locked)
Extended glob exercise4m 22s
-
-
-
-
-