Untitled Document
cat Command

cat command when used with filename display the entire contents for file on terminal . cat command is used to create files as well . Lets see examples on cat command -

1. Basic example -

Run the cat command to display the content of file - user.txt on your terminal .

   cat user.txt

2. Display The line number along with contents

Run the cat command with -n option and it will display the liner number along with the contents of line .This is helpful for the programmer or developer to debug a script in case of failure .

   cat -n user.txt 

3. Display the non printing character of file -

-v option displays the non printing character of file . Run the below command - .

   cat -v user.txt 

4. Line End Indicator -

when we invoke cat command with -E option , it will display $ symbol at the end of each line in a file . This is helpful when we look for end of line in debugging the scripts.

   cat -E user.txt 

5. Creating file using cat command -

we can create a file using cat command , type the below lines on your terminal and you will get a file sample.txt in your current working directory .Invoke cat command with > along with filename and start writing your contents . After wring your contents press [ctrl-d] as EOF and it will create a file for you .
   cat > sample.txt [Enter]
   hello user
   You have created a file 
   Using cat command  [Enter]
Untitled Document