2018-11-10 13:13:07 +00:00
|
|
|
|
---
|
|
|
|
|
layout: page
|
2018-11-10 21:05:37 +00:00
|
|
|
|
category-page: intermediate
|
2018-11-12 10:47:50 +00:00
|
|
|
|
category-title: Intermediate commands
|
2018-11-10 21:05:37 +00:00
|
|
|
|
tags: cat content file show concatenate
|
2018-11-10 13:13:07 +00:00
|
|
|
|
author: Fabiano Fenini
|
2018-11-10 21:05:37 +00:00
|
|
|
|
title: cat
|
2018-11-18 22:31:01 +00:00
|
|
|
|
previous-page: pages/cmd/interm/caffeinate.html
|
2018-11-18 20:38:56 +00:00
|
|
|
|
next-page: pages/cmd/interm/chroot.html
|
2018-11-10 13:13:07 +00:00
|
|
|
|
---
|
2018-11-12 10:47:50 +00:00
|
|
|
|
The <code>cat</code> command can be easily associated to the word “concatenation” but
|
2018-11-10 21:05:37 +00:00
|
|
|
|
it doesn’t have that only function: in fact, cat command gives us the possibility to create
|
2018-11-12 10:47:50 +00:00
|
|
|
|
files and also to display them.<br>
|
|
|
|
|
|
2018-11-16 19:47:01 +00:00
|
|
|
|
The name stands for <i>catenate</i>.<br>
|
2018-11-10 13:13:07 +00:00
|
|
|
|
|
2018-11-12 10:47:50 +00:00
|
|
|
|
<h3>Usage</h3>
|
2018-11-10 13:13:07 +00:00
|
|
|
|
|
2018-11-10 21:05:37 +00:00
|
|
|
|
The default cat command syntax is:
|
2018-11-10 13:13:07 +00:00
|
|
|
|
|
|
|
|
|
<pre>
|
2018-11-10 21:05:37 +00:00
|
|
|
|
cat [flags] [--] [file1] [file2] [file...]
|
2018-11-10 13:13:07 +00:00
|
|
|
|
</pre>
|
|
|
|
|
|
2018-11-12 10:47:50 +00:00
|
|
|
|
Where [flags] are the <code>cat</code> flags, read below for more info, [--] indacates that the
|
2018-11-10 21:05:37 +00:00
|
|
|
|
following parameters won't be considered as flags, while the file parameters indicates
|
|
|
|
|
the names of one or more files to concatenate.
|
|
|
|
|
Between the names of two files is possible to use the shell redirection symbol ">",
|
2018-11-12 10:47:50 +00:00
|
|
|
|
in order to redirect the output to the file considered.<br><br>
|
2018-11-10 13:13:07 +00:00
|
|
|
|
|
2018-11-12 10:47:50 +00:00
|
|
|
|
<h3>Flags</h3>
|
2018-11-10 21:05:37 +00:00
|
|
|
|
Here are some of the most common cat flags:
|
2018-11-10 13:13:07 +00:00
|
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
|
<li> <b>-n</b>: Display the line numbers of a file </li>
|
|
|
|
|
<li> <b>-e</b>: Display "$" at the end of the line and also where there is a gap between paragraphs </li>
|
|
|
|
|
<li> <b>-T</b>: Display TAB characters </li>
|
|
|
|
|
</ul>
|