Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteUse touch filename to create an empty file, or use shell redirection with printf when you want to put text in it. The key difference: touch leaves existing file contents intact, while > replaces them and >> appends.
Create an empty file without changing its contents
Run touch with the file name:
touch notes.txt
If notes.txt does not exist, GNU Coreutils 9.11 creates it as an empty file. If it already exists, touch updates its timestamps rather than clearing its contents. It is primarily a timestamp utility; creating a missing file is one of its effects. See the GNU Coreutils 9.11 touch documentation.
As an Amazon Associate I earn from qualifying purchases.
For an empty file, shell redirection is another option:
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →: > notes.txt
The colon is a shell built-in that produces no output, and > sends that output to the file. Unlike touch, this empties the file if it already exists.
#1 Best Overall
Create a file and write text to it
Use printf to supply the text and > to write it to a file:
printf '%sn' 'First line' > notes.txt
If the file is missing, the shell creates it. If it already exists, the shell truncates it before writing, replacing its previous contents. The POSIX.1-2017 Shell Command Language specification defines these redirection behaviors.
Rank #2
Append text without replacing what is there
Use >> when new text should follow existing contents:
printf '%sn' 'Another line' >> notes.txt
If the file does not exist, it is created; if it does exist, the new output is appended. This is the safer choice when you need to keep the file’s existing text.
Write piped output with tee
tee copies standard input to both standard output and a named file:
printf '%sn' 'Hello' | tee greeting.txt
A missing output file is created. By default, an existing file is overwritten; add -a to append instead:
printf '%sn' 'More' | tee -a greeting.txt
GNU documents these behaviors in its Coreutils manual.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Choose the command by its effect
| Goal | Command | Effect if the file already exists |
|---|---|---|
| Create an empty file or leave existing contents alone | touch notes.txt |
Preserves contents and updates timestamps |
| Create a file or make it empty | : > notes.txt |
Truncates it to empty |
| Write text or replace existing text | printf '%sn' 'First line' > notes.txt |
Replaces existing contents |
| Add text while keeping existing contents | printf '%sn' 'Another line' >> notes.txt |
Appends |
| Send piped output to a file and the terminal | printf '%sn' 'Hello' | tee notes.txt |
Overwrites by default; use tee -a to append |
If the file cannot be created
Check the spelling and location of the path, then confirm that you can write to its parent directory. Shell redirection fails when the destination cannot be opened or created, for example because the directory is not writable. POSIX specifies the redirection operation but does not establish a single numeric permission mode that applies to every setup.
What is portable across Unix-like systems?
The redirection examples describe POSIX shell behavior. The touch behavior cited here comes from GNU Coreutils 9.11, which is applicable to GNU/Linux; Unix-like systems may ship other utility implementations, so GNU-specific options should not be assumed to work identically everywhere. The POSIX touch specification also describes creating a missing file.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




