====== BASH - Commands - cat ====== **cat** is used to concatenate or write files, text or binary. ---- ===== Write a file ===== cat > list.txt type into the terminal: aaa bbb ccc Press **CTRL+D** to stop inputting and save file. * This can only be done at the start of a new line; so **** needs to be done against the last line before being able to do a **CTRL-D**. This would have created the file **list.txt**. ---- ===== Display a file ===== cat list.txt returns: aaa bbb ccc ---- ===== Concatenate multiple files ===== Create another file, named list2.txt, containing: ddd eee ---- ==== Do the concatenation ==== cat list.txt list2.txt returns: aaa bbb ccc ddd eee ---- === Concatenate to a new file === cat list.txt list2.txt > list3.txt ---- === Display this new file === cat list3.txt returns: aaa bbb ccc ddd eee ---- ===== Append to a file ===== cat >> list3.txt enter: fff ggg Press **CTRL+D** to stop inputting and save file. ---- === Display the appended file === cat list3.txt returns: aaa bbb ccc ddd eee fff ggg ---- ===== Place data between 2 files ===== cat list.txt - list2.txt > list4.txt enter: hhh Press **CTRL+D** to stop inputting and save file. ---- === Display the file === cat list4.txt returns: aaa bbb ccc hhh ddd eee **NOTE:** The **hhh** data is showing in the middle of the data from the 2 input files. ---- ===== Join split binary files ===== cat video.001 video.002 video.003 > vid.avi