- To create a file
- To display the contents of a file
- To combine two or more files
cat > test-file.txt(to create a file)
cat test-file.txt(to display the contents of a file)
cat test-file.txt file-to-combine.txt(will combine both files and display it on screen)
cat test-file.txt file-to-combine.txt > combinedcontent.txt( will combine the first two files and will put its contents in combinedcontent.txt )
Step By Step:
- open a new terminal and issue the following command
- paste this on the terminal
Ctrl+Dto save and exit. You have successfully created a file.
- now issue the following command to see the contents of this file.
cat command is used to create, concatenate and display files. Typing cat existing-file.txt will display the contents of existing-file.txt on screen, assuming that this file already exists. You can use cat > new-file.txt to create a new file and to enter text into it.