A Lab to prime your skills in using the Linux/mac OSX command line (bash)
An Azure RM template is included in infrastructure/
to create the environment:
Using Azure PowerShell, do the following to provision the resources:
.\startup.ps1
Alternatively, you can perform a one-click deploy with the following button:
-
Assign the
my_path
variable a value of/home
:my_path=/home
-
Print the value stored in
my_path
:echo $my_path
-
List the contents of
/home
using themy_path
variable:ls $my_path
-
Assign the value of
/
(root directory) tomy_path
:my_path=/
-
List the contents of the directory stored in
my_path
:ls $my_path
-
Type
echo $
then press tab twice to list all the currently defined variables. -
Type
y
to confirm that you want to see all the possible completions:Some worth knowing are
- $HOME: Home directory path
- $HOSTNAME: Name of the Linux host/machine
- $PATH: A list of paths that are separated by colons. Whenever you enter a command these paths are automatically searched to find the corresponding command binary to run. Without the $PATH variable, you would need to give complete paths instead of just the name of the command. For example, rather than /bin/ls, you can enter ls because /bin is in your $PATH.
- $SHELL: Path to the shell binary of your current shell (/bin/bash in the case of this Lab)
- $USER: Name of the logged in user
-
Store the the date in a variable called current_date:
current_date=$(date)
-
Output the value of the current_date variable:
echo $current_date
When finished, remove the Azure resources with:
.\teardown.ps1