INTRODUCTION

The cat command is available in Linux operating system to view the file contents of text file, you can print the file contents on Linux shell by using cat command. Also you can view or combine the several files to one file. This command can be used for the files only it does not accept the directory.

SOLUTION

Syntax of cat command:

`
$cat [options] [Lecture_1.txt ]

Examples:

View text file contents:

[haider@LX1 LinuxBasics]$ cat Lecture_1.txt 

Output:

Linux is a 100{1c918b003a0fec779e46518dd4d8df22f3dc554de918030f5a1a0cfd93cb28be} free operating system which is specially designed for multitasking,
multi-user networks that is similar to UNIX. Its means Linux is not UNIX. Linux
was designed specifically for the low hardware base systems like 386(x86 Intel CPU)
platform and released under GNU (General Public License) means
100{1c918b003a0fec779e46518dd4d8df22f3dc554de918030f5a1a0cfd93cb28be} free for public.
[haider@LX1 LinuxBasics]$ cat Lecture_2.txt

Output:

History of Linux
It is developed by a talented student who wrote a source code and then shares it with
the world to let everyone have the same excitement as he is. He was right
about that. Many programmers interested to try and they compiled and
improved the source code and gave him feedback.

Combine the output of two files:

[haider@LX1 LinuxBasics]$ cat Lecture_1.txt Lecture_2.txt

Output:

What is Linux?
Linux is a 100{1c918b003a0fec779e46518dd4d8df22f3dc554de918030f5a1a0cfd93cb28be} free operating system which is specially designed for multitasking, multi-user networks that is similar to UNIX. Its means Linux is not UNIX. Linux was designed specifically for the low hardware base systems like 386(x86 Intel CPU) platform and released under GNU (General Public License) means 100{1c918b003a0fec779e46518dd4d8df22f3dc554de918030f5a1a0cfd93cb28be} free for public.
History of Linux
It is developed by a talented student who wrote a source code and then shares it with
the world to let everyone have the same excitement as he is. He was right
about that. Many programmers interested to try and they compiled and
improved the source code and gave him feedback.

Combine both files together in one file:

[haider@LX1 LinuxBasics]$cat Lecture_1.txt Lecture_2.txt > Lectures_Liberary.txt

You notice we used greater than sign (>) in combine command, we will learn the input and output redirection in our next coming lectures.

Now have a look to newly created file:

[haider@LX1 LinuxBasics]$cat Lectures_Liberary.txt

Output:

What is Linux?
Linux is a 100{1c918b003a0fec779e46518dd4d8df22f3dc554de918030f5a1a0cfd93cb28be} free operating system which is specially designed for multitasking, multi-user networks that is similar to UNIX. Its means Linux is not UNIX. Linux was designed specifically for the low hardware base systems like 386(x86 Intel CPU) platform and released under GNU (General Public License) means 100{1c918b003a0fec779e46518dd4d8df22f3dc554de918030f5a1a0cfd93cb28be} free for public.
History of Linux
It is developed by a talented student who wrote a source code and then shares it with
the world to let everyone have the same excitement as he is. He was right
about that. Many programmers interested to try and they compiled and
improved the source code and gave him feedback.

Don’t forget to say Thanks. It’s Free :).

Next: Create New Directory/Folder in Linux


If you like this Post, please give us your valuable feedback by pressing Vote Up / Vote Down Button. Thanks.

[thumbs-rating-buttons]


Similar Posts