If you want to create a new file rather than copy an existing one, use the touch command:
$ touch new.file
This creates a new, empty file.
If you issue the ls -lnew.file command, you can verify that the file has a size of zero bytes. It might seem silly to create an
empty file, but you can use them to verify that you have permission to create files in a certain directory, and some programs insist
upon a control or log file even if it's empty. (The touch command will also update the time and date stamp on an existing file.)
If you'd rather create a new file with data in it--for example, a line of text--use the echo command:
$ echo "Remember to buy oatmeal raisin cookies." > reminder
This will create a file named reminder with just one line in it (the text in quotation marks). The echo command normally just
prints a line to the screen, but here we've directed the output to a file. (This command also works in DOS.)
If you want to create a multiline file, use the cat command (similar to the DOS type command):
$ cat > fox.socks Through three cheese trees three free fleas flew.
While these fleas flew, freezy breeze blew.
Freezy breeze made these three trees freeze.
Freezy trees made these trees' cheese freeze.
That's what made these three free fleas sneeze.
The first line in this example tells Linux what to name the new file (fox.socks). The typed lines that follow will become the
contents of this new file. Pressing ctrl-D tells Linux that the file is done, and the cat command transfers your typing to the new
If you have a bunch of related files scattered in your home directory, why not create a directory for them? Use the mkdir
command as follows:
$ mkdir cooking
This creates a new directory named cooking in the current directory, into which you can move all those recipes for easy retrieval.
For more information on the mkdir command, see the
The Teucrian rout) caught Suero on the side. displeased with them," wrote
Nelson, "and certainly with reason;" and "You're a plucky boy. You ain't
one of the milk-and-water sort," said
adarsh (25 Aug 2012, 16:23)
i need bacis command to create directories files in linux
Deep (02 Feb 2012, 02:16)
It's awesome Site for linux........
daivd (11 Oct 2011, 15:53)
Copy the files /etc/php.ini and /etc/vimrc into your misc directory?
Vishalkin (06 Oct 2011, 01:25)
How to create a new directory and copy files from existing directory to new
Ezra Heskey (17 Aug 2011, 02:26)
i need some introduction notes on linus please
Thank you in advance
rohit (10 Aug 2011, 11:45)
can we make directory using cat command.if.yes then how to do it?
Majed (08 Aug 2011, 03:45)
it's easier to remember the mkdir command if you remember that mk stands
for make and dir for directory
alex (20 Mar 2011, 18:07)
nice work, thank you for this site
abhinav (29 Jan 2011, 06:40)
I used the echo command as told by you above. It does make a file in my
current directory but when i open it in any text editor (i tried gedit,
kate, openoffice, vim), the file seems empty. There is no text written in
it. I use Ubuntu 10.10.
Can you tell me what am I doing wrong here ?
Linux won't support .exe, so you need to search for Linux compatible
Amrish (07 Oct 2010, 00:10)
my usb modem has .exe file to install, but linux mint never initiates it
(unlike windows)...how to install any software in linux...plz help !
gandhi (04 Oct 2010, 05:10)
how to create linux file,
which commend used.
cool as an Ice cream..... (07 Sep 2010, 05:04)
could you give more examples..... please.... I'm not really that familiar,
so I need more examples..
thank you God bless...
I welcome your comments. However... I am puzzled by many people
who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn
all you can, ask questions if you like. But don't ask me to send what you already have. :-)
NO SPAM! If you post garbage, it will be deleted, and you will be banned.