create a file command line code example

Example 1: bash create file

# syntax
touch 

# example
touch NewFile_1.txt

# -----------------------------------------------------
# FOR CREATING MULTIPLE FILES

# syntax
touch <1st-file-name> <2nd-file-name> ... 

# example
touch NewFile_1.txt NewFile_2.txt NewFile_3.txt

Example 2: create a file cmd

type NUL > EmptyFile.txt
# also
echo. 2>EmptyFile.txt
copy nul file.txt > nul # also in qid's answer below
REM. > empty.file
fsutil file createnew file.cmd 0 # to create a file on a mapped drive

Example 3: terminal command to create new file

touch filename.txt

Example 4: command line make file

touch term-paper.txt

Example 5: how to create files in command line

notepad mynewfile.*insert file extension here*

Tags:

Misc Example