Creating and Reading Files

Learn how to read and create files using the CLI.

Creating files

The echo command takes text and prints it back to the screen. Run the terminal below to run the following command:

$ echo Hello there
Terminal 1
Terminal
Loading...

We see the text we entered printed back to us. We use echo in scripts we write to display instructions or output to users. But we can also use it to insert text into files if we combine it with a redirection feature.

Let’s create a text file in our root directory that contains the text “Hello”. We call this file greetings.txt. At the ...