Friday, March 6, 2020

LINUX - UNIX - AIX commands -3 Ways to Create a Text File Quickly Through the Linux Terminal

3 Ways to Create a Text File Quickly Through the Linux Terminal

  • The cat command
  • The touch command
  • The standard redirect symbol

Here i am showing only the cat command:

The cat Command:
The cat command is very helpful when dealing with text files in Linux. It helps you in achieving three basic purposes:

  • Creating a text file
  • Printing contents of a text file in your Terminal
  • Printing contents of a text file to another text file

Creating a text file:
Enter the following command in your Terminal:
$ cat > filename.txt

After entering this command, the next prompt will not appear; rather the cursor will display for you to enter the text for the file you just created
Once you have entered all the text, hit enter to move to the next line and then use the Ctrl+D control to tell the system that you are done with entering the text. The usual command prompt will then appear for you to move on with further operations.

Printing contents of a text file in your Terminal:
Through the cat command, you can then view the contents of the file as follows:

$ cat filename.txt
Printing contents of a text file to another text file:

$ cat filename.txt > $ cat filename1.txt

No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...