cat command in Linux | Linux for Beginners 2021
To watch video tutorial of cat command click on
Cat is a one of most frequently used command in Linux or
Unix like operating system. Cat command allows us to create single or multiple
files, view the content of the file, concatenate files as well as redirect
output in terminal or file.
Cat command comes from its functionality to concatenate
files, it means merge things together.
Lets go ahead and run kali . first open terminal.
The most basic and common usage of the cat command is to
read the content of file.
For example we will want to display the content of
“mytextfile” file on the terminal. List the files with ls command to confirm
file the file name as you see we have two different text files and lets check
the content of “mytextfile” file with cat command.
Syntax of command is – cat file name
Cat mytextfile
The content of file is shown on screen.
If you want to add new words in this files or means wants to
append file then you use double greater then symbol -
Cat >> mytextfile
Write new lines and press ctrl + c to terminate
Lets see the content of the file again with cat command
Cat mytextfile
As you see one more line is added to the file
What happens if we use single greater then sysmbol
Cat > mytextfile
Type a new line again and ctrl +c to terminate
Lets see the content of the file again with cat command
Cat mytextfile
As you see single greater thrn sysmbol overwrites the entire
content with new line just added.
Clear screen with clear command or use ctrl+l keyboard
shortcut.
Lets see the content of the mytextfile2 this time
Cat mytextfile2
Now run cat command with both mytextfile and mytextfile2
files to see the content of both file
Cat mytextfile mytextfile2
Next lets rediredt the content of the file
Cat mytextfile2 >
mytextfile3
This command will copy the content of mytextfile2 to
mytextfil3 using single greater then sysmbol.
If mytextfile3 does not exist the command will create it
otherwise it will overwrite it. Lets see the content of the file again with cat
command
We can use double greater then symbol to append the content
of file to other-
Cat mytextfile3
>> mytextfile4
Same as previous if the file is not present it will be
created. Lets see the content of the file again with cat command
Hope you understand about cat command if you have any query
you can comment me below in comment section. Thanks for watching see you again
in next video. Bye
cat command,
cat command full form,
cat command in hadoop,
cat command in linux,
cat command in linux,
cat command in linux in hindi,
cat command in linux javatpoint,
cat command in linux to append,
cat command in linux to create a file,
cat command in linux to edit file,
cat command in linux tutorialspointcat command in unix,
cat command in linux with examples,
cat command in windows,
cat command used for,
cat commando,