Posts

Showing posts from September, 2017

Basic Cat Command Examples in Linux

The cat (short for “concatenate“) command is one of the most frequently used command in Linux/Unix like operating systems. cat command allows us to create single or multiple files, view contain of file, concatenate files and redirect output in terminal or files. In this article, we are going to find out handy use of cat commands with their examples in Linux. General Syntax cat [OPTION] [FILE]... 1. Display Contents of File In the below example, it will show contents of  /etc/passwd  file. # cat /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin narad:x:500:500::/home/narad:/bin/bash 2. View Contents of Multiple Files in terminal In below example, it will display contents of  test  and  test1  file in terminal. # cat test test1 Hello everybody Hi world, 3. Create a File with Cat Command We will create a file called  test2  file with below command. # cat >test2 Awaits input from user, type desired text and press CTRL+