Is it possible to run a gedit command in the terminal that will create a text file automatically and save it in my desired file extension?

For example, if I run:

gedit file.txt

by default, it will open a null document named file.txt.

But all I want is to write and save texts to file.txt automatically so that it wont be NULL.

what should I type in the terminal?

Write a shell script that creates the file for you, then opens it using gedit.

If you just wanna create file without any contents use the command that is meant for it. :)
Use "mkfile", or simply "touch" if you don't wanna complicate things.
If you want to write something in the file use redirection.
Finally, next time you might wanna use Unix Shell Scripting forums.. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.