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, just update its timestamp.

Create a new file link

ln -s existingPath newPath

Create a file at newPath that is a symbolic link to another file.

(symbolic link, aka soft link, is a file whose content is a file path to another file.)

ln existingPath newPath

Create a file at newPath that is a hard link of a file.

(Hard link is a “normal” file. A file may have many hard links.)

Linux, Files and Dirs