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
You can use
touch
command, as the others said:To write on file on command line, you can use
echo
orprintf
:Maybe you can have problems with permissions. If you are getting the following error:
bash: filename: Permission denied
, you need to usesudo bash -c 'echo "Foo" > filename'
, as described here: https://askubuntu.com/questions/103643/cannot-echo-hello-x-txt-even-with-sudoYou can use the
touch
command to create a new empty file.http://linux.about.com/library/cmd/blcmdl_touch.htm
1st method
2nd method
3rd method
To view the file contents