Thursday, May 6, 2010
CREATING FILES IN LINUX
CREATING FILES IN LINUX
Cmd1 : Use touch command to create empty file's
to create file's
SYNTAX: # touch filename
Example:
#touch test
To create multiple files at a time..
#touch {filename1 filename2 filename3}
#touch {1,2,3}{4,5,6}
The above command will create files with 14,15,16,24,25,26,34,35,36 as names by using this you can create n number of files at a time.
For checking weather your files/folders are created you can use ls command.
Cmd2 : Creating files using cat command in combination of output redirecting operator(>)
#cat > filename
Once enter this command you have to enter the content of the file and once you finish it just press Ctrl+d this will save the file. Use again ls command to display the files created.
Cmd3 : Creating a file with any editor(either VI,emacs etc)
#vi filename
Once you execute this command the file will be opened and in order to enter any data we have to first press i to go in to insert mode. Once you type the content in to the file just press esc and :wq to save and quit the file.
Cmd1 : Use touch command to create empty file's
to create file's
SYNTAX: # touch filename
Example:
#touch test
To create multiple files at a time..
#touch {filename1 filename2 filename3}
#touch {1,2,3}{4,5,6}
The above command will create files with 14,15,16,24,25,26,34,35,36 as names by using this you can create n number of files at a time.
For checking weather your files/folders are created you can use ls command.
Cmd2 : Creating files using cat command in combination of output redirecting operator(>)
#cat > filename
Once enter this command you have to enter the content of the file and once you finish it just press Ctrl+d this will save the file. Use again ls command to display the files created.
Cmd3 : Creating a file with any editor(either VI,emacs etc)
#vi filename
Once you execute this command the file will be opened and in order to enter any data we have to first press i to go in to insert mode. Once you type the content in to the file just press esc and :wq to save and quit the file.
Subscribe to Posts [Atom]
Post a Comment