cat command is one of the most frequently used command in Linux. It is used to read the contents of the file and print on the standard output i.e. the terminal. Other uses of cat commands are to create new files, combine files and copy files.


cat [option]… [file]…

Here are some ways we can use the cat command:

  1. Create a new file. It can create empty file as well. It is also used to read the contents of the file.
  2. Read multiple files at the same time.cat2
  3. Concatenate multiple files into a new file.cat3
  4. Copy contents from on file to another. If the file already exists then it will overwrite the file. If the file doesn’t exist, then a new file will be created.cat4
  5. Append the contents of one file to another. You can append the contents of multiple file as well.cat6cat5

Various parameters can be used with cat command:

  1. -n: number all output lines.
  2. -b: numbers nonempty output lines.
  3. -e: displays $ at the end of each line.cat7
  4. -s: suppress repeated empty output lines.cat8



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s