Cat: Basically cat is a powerful command.
By using this command we are not only going to create files, but also we can view files and we can append some data into already existing files.
creation of file:
syntax:
$cat>filename
-----------------
-----------------
-----------------
press ctrl+d -to save and exit
here we can user ctrl+c also, but the problem is its going to save the file till previous line not present line.
for ex:
$cat>rakesh
line1
line2
line3 ctrl+c
then the file 'rakesh' contains line1 and line2 only, the line3 is going to miss.
To open a file we can use simply $cat filename, if the file is not in present working directory there we have to give the exact location, i.e $cat /sample/rakesh
To know the present working directory use $pwd command
To append additional data into a file we can use $cat>>filename (already existing).
Note: If we already entered some data into a file, we can't go back and edit it. for this we won't prefer cat command, and we use some editors
ex: vi editor.
By using this command we are not only going to create files, but also we can view files and we can append some data into already existing files.
creation of file:
syntax:
$cat>filename
-----------------
-----------------
-----------------
press ctrl+d -to save and exit
here we can user ctrl+c also, but the problem is its going to save the file till previous line not present line.
for ex:
$cat>rakesh
line1
line2
line3 ctrl+c
then the file 'rakesh' contains line1 and line2 only, the line3 is going to miss.
To open a file we can use simply $cat filename, if the file is not in present working directory there we have to give the exact location, i.e $cat /sample/rakesh
To know the present working directory use $pwd command
To append additional data into a file we can use $cat>>filename (already existing).
Note: If we already entered some data into a file, we can't go back and edit it. for this we won't prefer cat command, and we use some editors
ex: vi editor.