\n is used as new line character which will create more than 1 lines of the file. Printf this is 2 lines file \n this is second line > Amit1.txt Using Echo as well as printf command user can create file,Įcho ………lines of file.….
$ rm –i :- To delete a file with permission/confirmation.Į.g: rm Amit_Emptyfile 3.Create a file using Echo and printf command: The above command will create 2 zero byte files named Yodhini and Amit.
Touch command is used to create the empty or zero byte file,touch command also used to update the access or modification time of the file.touch command is basically used to create multiple files in linux or ing Cat command one can create or update one file at a time but using touch command user can only create multiple zero byte files but can not update multiple files at a time. To append the data or to change the data in file we need to use > Operator. User can create a new file using ‘Cat’ command in unix.Using shell prompt directly user can create a file.Using ‘Cat’ command user will able to open a specific file also.If user wants to process the file and append data to the specific file use ‘Cat’ command.Īfter Completion of your text you need to press Control + d which is used to save the file and come out of the prompt.The above statement will create a file named ‘Amit_new.txt’.įor Creating file operator (>) is mandatory. User can create a file in unix using following ways:Ĥ.Using Different text editors-Vi,emac 1.Cat Command in unix: In previous article i have explained the basic unix commands which are useful to the programmers.In this article i will explain the different ways to create a file with real life examples in detail.All data in unix is organized in to files.This article is about to create a file using multiple ways in unix.You can create file in unix using different unix commands.I will explain the Cat command and Touch command with real life examples also.The 100% asked interview question is what is difference between CAT and touch Command in unix?You can create file in unix using Command line prompt or using unix editors.