Handson-ml: Create the Workspace

Created on 25 Nov 2019  路  2Comments  路  Source: ageron/handson-ml

There are two lines and I don't understand them. Please explain in detail, I'm a very new Linux user.
$ export ML_PATH="$HOME/ml"
$ mkdir -p $ML_PATH

Secondly, I made a folder on my desired destination. Then opened the terminal there, and typed these commands. And nothing seemed happen. The command line just skipped to get a new command.

Most helpful comment

Hi @SM-Fahim ,

Thanks for your questions!

The first $ sign on each line is just there to indicate that the rest of the line is a command that should be typed in a shell (i.e., a Terminal window running a shell program such as Bourne Again Shell = bash, or zsh). Do not type the first $ on each line.

The export keyword is used in a shell to define an environment variable. In this case, we are defining the ML_PATH environment variable to be equal to the value of the HOME environment variable followed by /ml. The HOME env variable is usually automatically defined by your system to be equal to the path to your home directory, which is typically /home/your_login. So typically the first line will result in defining the env variable ML_PATH to be equal to /home/your_login/ml (or /Users/your_login/ml on MacOSX).

The second line uses the mkdir command to create the directory whose name we just defined in the ML_PATH environment variable. The -p option says that the command should create any parent directory that does not exist yet. For example, suppose that there's no directory called /a, then the command mkdir -p /a/b/c would create three directories: /a, then /a/b inside it, and finally /a/b/c inside it.

Regarding your second point: the first command will not return any output, it just defines the environment variable, so it's normal not to get any output. Similarly, the second command creates a directory and it does not give any output if it is successful. If the directory already exists, it does nothing at all.

I hope this helps!

All 2 comments

Hi @SM-Fahim ,

Thanks for your questions!

The first $ sign on each line is just there to indicate that the rest of the line is a command that should be typed in a shell (i.e., a Terminal window running a shell program such as Bourne Again Shell = bash, or zsh). Do not type the first $ on each line.

The export keyword is used in a shell to define an environment variable. In this case, we are defining the ML_PATH environment variable to be equal to the value of the HOME environment variable followed by /ml. The HOME env variable is usually automatically defined by your system to be equal to the path to your home directory, which is typically /home/your_login. So typically the first line will result in defining the env variable ML_PATH to be equal to /home/your_login/ml (or /Users/your_login/ml on MacOSX).

The second line uses the mkdir command to create the directory whose name we just defined in the ML_PATH environment variable. The -p option says that the command should create any parent directory that does not exist yet. For example, suppose that there's no directory called /a, then the command mkdir -p /a/b/c would create three directories: /a, then /a/b inside it, and finally /a/b/c inside it.

Regarding your second point: the first command will not return any output, it just defines the environment variable, so it's normal not to get any output. Similarly, the second command creates a directory and it does not give any output if it is successful. If the directory already exists, it does nothing at all.

I hope this helps!

Hi, I have just start on the book and I dont know much about the command on terminal for macbook. Do you recommend any resource to learn those command line ? Thank you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

qinhanmin2014 picture qinhanmin2014  路  5Comments

batblah picture batblah  路  5Comments

eliaperantoni picture eliaperantoni  路  3Comments

shaminder1 picture shaminder1  路  3Comments

nitml picture nitml  路  4Comments