Overwrite and Append in Shell

Level 270 keystrokes

> creates or overwrites a file, >> appends to a file.

Shell code

# $(date) inserts the current date and time
# > creates log.txt or empties it first, then writes the line
1echo "Started at $(date)" > log.txt
# >> appends to the end of log.txt, keeping the first line
2echo "Process complete" >> log.txt
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Shell code and how often they appear.

  • "× 4
  • >× 3
  • .× 2
  • (× 1
  • )× 1
  • $× 1

More Shell examples at level 2

← Shell typing practice