Linux: Create New File

By Xah Lee. Date: . Last updated: .

Create a new file

touch fileName
Create a new file with empty content. If the file exists already, update its timestamp.

Create a new file link

ln -s newPath existingPath
Create a new file that is a symbolic link (aka soft link) to another file.
(symbolic link is a file whose content is a file path to another file.)
ln newPath existingPath
Create a new file that is a hard link of a file.
(Hard link makes 2 files pointing to the same index in the file system (hard disk).)

Linux, Files and Dirs