Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)
Is there any way to create a file in my Linux terminal?

1 Answer

0 votes
by (36.8k points)

It Depending on what the file should contain:

  • touch /path/to/file for an empty file
  • somecommand > /path/to/file for a file containing the output of some command.
  •   eg: grep --help > randomtext.txt
  •       echo "This is some text" > randomtext.txt
  • nano /path/to/file or vi /path/to/file (or any other editor emacs,gedit etc)

It will open the existing file for editing or creates & opens an empty file to enter, if it doesn't exist

Want to be a Linux expert? Come and join this Linux course

Related questions

0 votes
1 answer
0 votes
1 answer
asked Dec 12, 2020 in Linux by blackindya (18.4k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...