Line At A Time
Level 24: Putting It All Together
Putting It All Together Use everything you have learnt to build something from nothing.

No new commands this time. Build a folder called band, put a file of instruments inside it, then read it back sorted and counted, using only what you already know.

Two things worth noticing as you go. First: echo "Guitar" > band/instruments.txt makes the file inside band without you ever walking into it, because a path works anywhere a filename does. Second: one > followed by two >> is the pattern for building any file up, line by line.

Everything you have done in this course (make a folder, write files, read them back, sort and count them) is what people do in a terminal all day long. Next up: putting these same commands into a file, so the computer can run them for you.

mkdir bandMake the folder.
echo "Guitar" > band/instruments.txtStart the file.
echo "Drums" >> band/instruments.txtAdd to it.
sort band/instruments.txtRead it back, tidied.
wc -l band/instruments.txtCount what is in it.
Your task
  • Make a folder called band
  • Put a file of three instruments inside it
  • Print it sorted
  • Count the lines in it

Open this level in your browser to type the commands at a live terminal that answers back.