
- Unix Commands Reference
- Unix - Tutorial Home
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
cat - Unix, Linux Command
NAME
cat - Concatenate and print the content of files.
SYNOPSIS
cat [Options] [File]...
DESCRIPTION
Cat command concatenate FILE(s), or standard input, to standard output. With no FILE, or when FILE is -, it reads standard input.
OPTIONS
Tag | Description |
---|---|
-A, --show-all | equivalent to -vET |
-b, --number-nonblank | number nonblank output lines |
-e | equivalent to -vE |
-E, --show-ends | display $ at end of each line |
-n, --number | number all output lines |
-s, --squeeze-blank | never more than one single blank line |
-t | equivalent to -vT |
-T,--show-tabs | display TAB characters as ^I |
-u | (ignored) |
-v, --show-nonprinting | use ^ and M- notation, except for LFD and TAB. display this help and exit |
--help | display this help and exit |
--version | output version information and exit |
EXAMPLES
Create two sample files
#sample.txt This is a sample text file
#sample1.txt This is a another sample text file
To display content of a file.
$ cat sample.txt This is a sample text file
To display content of all txt files.
$ cat *.txt This is a another sample text file This is a sample text file
To concatenate two files.
$ cat sample.txt sample1.txt > sample2.txt $ cat sample2.txt This is a sample text file This is a another sample text file
To put content of a file in a variable.
$ variable_content = 'cat sample.txt'Print
Advertisements