touchBut that's not the main reason many people use touch. The command has an interesting effect if you try to use the touch command on a file that doesn't exist: It creates an empty file using the name you specified. $ ls -l ~/ drwxr-xr-x 848 2005-10-19 11:36 src drwxr-xr-x 632 2005-10-18 12:25 videos $ touch test.txt $ ls -l ~/ drwxr-xr-x 848 2005-10-19 11:36 src -rw-r--r-- 0 2005-10-19 23:41 test.txt drwxr-xr-x 632 2005-10-18 12:25 videos Why would you use touch in this way? Let's say you want to create a file now, and then fill it with content later. Or you need to create several files to perform tests on them as you're playing with a new command you've discovered. Both of those are great reasons, and you'll find more as you start learning more about your shell. |