Redirect and append
Quest: redirect-and-append
Mission
Create ~/playground/hi.txt with >, append a second line with >>, and print the result.
Why This Matters
Redirection is powerful because it lets command output become file content. It is also dangerous because > replaces. You need to feel the difference early.
Commands You Will Use
echo>>>cat
Steps
- Run
echo "hello makers" > ~/playground/hi.txt. - Run
echo again >> ~/playground/hi.txt. - Run
cat ~/playground/hi.txt. - Confirm that the file has two lines:
hello makersandagain. - Ask the guide to check the file.
Hints
- Use
>only for the first line. - Use
>>for the second line. - If the file only contains
again, you used>the second time.
If Check Fails
Recreate the file from scratch. First use >, then use >>.

Linux Foundations