What's the easiest way to create a file in Linux terminal?
相关问题
- Is shmid returned by shmget() unique across proces
- What is the best way to do a search in a large fil
- how to get running process information in java?
- JQ: Select when attribute value exists in a bash a
- Spring Integration - Inbound file endpoint. How to
Use touch
haha! it's easy! try this:
for
permission denied
error usesudo
command as:How to create a text file on Linux:
touch
to create a text file:$ touch NewFile.txt
cat
to create a new file:$ cat NewFile.txt
The file is created, but it's empty and still waiting for the input from the user. You can type any text into the terminal, and once done CTRL-D will close it, or CTRL-C will escape you out.
>
to create a text file:$ > NewFile.txt
nano MyNewFile vi MyNewFile NameOfTheEditor NewFileName
In case you guys are trying to create a new file, but it says:
'File does not exist'
, it's simply because you are also accessing a directory, which does not exist yet. You have to create all non existent directories first, using themkdir /path/to/dir
command.I like the nano command-line editor (text):