OpenViSTAI · Agents · Blockchain · Crypto
Menu

OPENVIST LEARN · FREE LESSONS

Create, read and copy a small text file

Write a predictable practice file and understand the difference between commands and file contents.

Lesson 5 of 10 · About 15 minutes · Beginner · English

By the end of this lesson

Create hello.txt, read it and keep a copy without touching system files.

Before you start

  • Lesson 4; the openvist-learn folder exists.

Three words to know

Text file
A file containing characters rather than an application interface.
Redirection
Shell syntax that connects a command’s input or output to a file.
Here-document
A block of text supplied to a command until a chosen marker is reached.

1. Start in the practice folder

Confirm the destinationVPS · Bash
cd "$HOME/openvist-learn"
pwd
ls -la
What you should see · example output
A path ending in /openvist-learn, followed by the folder listing.

2. Paste one complete block

Create the text fileVPS · Bash
cat > hello.txt <<'TEXT'
Hello from OpenViST.
I know which computer I am using.
TEXT
What you should see · example output
Usually no output; the shell prompt returns after the final TEXT marker.

cat receives the two text lines. The > symbol sends them to hello.txt. The quoted TEXT marker keeps the body literal: shell substitutions inside it are not expanded. The final TEXT must appear alone on its line. If the terminal still shows a continuation prompt, the block is incomplete; Ctrl+C cancels it so you can start again.

3. Read and copy the result

Read the fileVPS · Bash
cat hello.txt
What you should see · example output
Hello from OpenViST.
I know which computer I am using.
Make a copy without silently replacing an existing backupVPS · Bash
cp -i hello.txt hello-backup.txt
ls -l hello.txt hello-backup.txt
What you should see · example output
Two files are listed. If the backup already exists, cp -i asks before overwriting it.

cp makes another file; it does not rename the original. Answer an overwrite question deliberately. You now have a small file for the transfer exercise.

YOUR TURN

A small check before you continue

Create a second file named notes.txt with one sentence, then read it. What happens if you use > on that name again?

Show a suggested answer

Use the same complete here-document pattern with notes.txt, then cat notes.txt. The > redirection replaces existing contents; it does not append.

Sources and scope

Documentation and examples reviewed 2026-10-18. Provider screens, package versions and output wording can differ. Examples show expected outcomes; they are not a claim that OpenViST connected to your server or verified your setup.