How to create empty file in Linux

How do I create an empty file from the bash shell or command line in Linux? Can you tell me command to create empty file in Linux?

Introduction – Empty file means files with zero bytes and in a plain text format no data stored in a file. When you create a blank open office file, it contains extra data structure. The best way to create an empty file on Linux is to use the touch command.

How to create empty file in Linux using touch command

  1. Open a terminal window. Press CTRL+ALT+T on Linux to open the Terminal app.
  2. To create an empty file from command line in Linux:
    touch fileNameHere
  3. Verify that file has been created with the ls -l fileNameHere on Linux

Let us see some examples and commands to create empty file in Linux.

How to create an empty or blank file on Linux

As I said earlier use the touch command to create an empty file. In this example, the file “passbook.txt” created:
touch passbook.txt
See if file created or not with the help of ls command:
ls -l
ls -l passbook.txt

Use the cat command to verify that nothing stored in the file named passbook.txt:
cat passbook.txt

How to create an empty file using touch command on Linux

What is the purpose of the touch command on Linux?

The touch command used to update the access and modification times of given FILENAME to the current Linux time. If a FILENAME does not exist, it is created as an empty file. One can verify that file is empty with the following file command on Linux:
file passbook.txt
passbook.txt: empty

Creating empty file in Linux using > redirection operator

Another option to make empty file in Linux is just type the following command:
> file-name-here
echo '' > filename
ls filename
file filename


You learned that an empty file is a file that contains no data and got zero bytes in size. Further, you used the touch command to create an empty file on the Linux operating system.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 2 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • Stepney Oct 4, 2016 @ 11:44


    I use touch file to create an empty file from the command line.

    Best luck,


  • Raju K Feb 13, 2017 @ 3:01

    Me thinks that touch command is the easiest way to create new, empty files on Linux or Unix-like systems including macOS.
    touch foo bar baz
    ls foo bar baz

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum