Cat

From Unix SME

Command name:

 cat/

Description:

 To view the files and concatenate the contents of the file together. Quickly creates readable files and views the contents.  
 concatenates the contents from various files, and redirects the contents of the file to a terminal or files.

Syntax:

 cat [OPTION] [file]  
 cat/ect/password

Use case:

 to display text files
 read text files
 create a new text file 
 file  concentration
 modifying file
 combining text or binary files

Examples:

 1. [user@host ~]$ cat path/to/file  "This is used to view the file."
 2. [user@host ~]$ cat file1 file2  "This will show you text in the file."
 3. [user@host ~]$ cat -n file_name  "This will give you the line numbers of a file. For example, you are writing a code and you want to see the numbers lines, and code written. "
 4. [user@host ~]$ cat > newfile_name  "To create a file named newfile_name and you will be able to add text to the file."
 5. [user@host ~]$ cat file1.txt file2.txt > merged_file.txt   "This is used to merge 2 files."
 6. [user@host ~]$ cat -s file_name    "Will suppress and empty lines in an output. For example, if you are writing a code and you have many empty lines you can suppress that empty line down to one to display the code that is written."
 7. [user@host ~]$ cat *.c "This is used to view c-file text only."
 8. [user@host ~]$ cat --help  "This will show usage and syntax for cat."
 9. [user@host ~]$ cat -E "filename"  "This displays $ at the end of code lines."
 10.[user@host ~]$ cat >foo.txt "This allows you to create a file and start writing in it. If you want to add more to the file you can do the same command but add a >, For example, >>foo.txt"