This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
It's a strange question, since the two commands aren't even remotely similar. vi is a visual text editor (vi = visual. neat, huh?) It's visual compared to "ed" anyway, which just lets you see and change one line of text at a time. The touch command updates the timestamp on an existing file, or creates a new file if the file didn't already exist. It's good for testing things like Ant builds that are highly dependent on timestamps. Now if your file is a text file, or doesn't yet exist, opening it with vi, then issuing the command :wq to vi, would have the same result as touching that file. That's the only way the two commands are similar at all.
Ok from What I understood is that vi is a text editor but I can use it to create only new text files / edit existing text files and so on. But with the touch command as well I can create a new text file and in fact any type of files. So that was why I wanted to know the difference between these two commands. Please correct me if I'm wrong!