The linux cat command connects the file and prints to the standard output device

  • 2020-06-12 11:36:37
  • OfStack

preface

The cat command is used to connect files and print to a standard output device (screen or > fileName to another file), the following article will explain this command in detail, interested friends below 1 to have a look.

Command classification: file management

cat syntax format


cat [ parameter ] [ The file name ] 
cat [-AbeEnstTuv] [--help] [--version] fileName 

parameter


-A, --show-all  Is equivalent to  -vET
-b, --number-nonblank  Number non-null output lines 
-e  Is equivalent to  -vE
-E, --show-ends  At the end of each line  $
-n, --number  Number all lines of output 
-s, --squeeze-blank  Does not print multiple empty lines 
-t  with  -vT  equivalent 
-T, --show-tabs  Will jump   Character display as  ^I
-u ( Be ignored )
-v, --show-nonprinting  use  ^  and  M-  Quote, except  LFD  and  TAB  outside 
--help  Display this help information and leave 

The sample

Display the entire file once and add the line number


cat -n config.js

Create 1 file from keyboard (only create files, not edit)


cat > newFile

Several files were merged into one file


cat file1 file2 > newFile

conclusion


Related articles: