Files Creation(Cat, Touch, Tee, VI)

FILES Creation 

There are four  Ways to create a file

  1. cat
  2. touch
  3. tee
  4. vi

  'CAT '   


cat>file.txt ---------------------- >>> Creating file
  • this is hari
  • im from hyd

cat file.txt    ---------------------- >>> For viewing created file
  • this is hari
  • im from hyd

cat>>file.txt    ---------------------- >>> Append data to existing file ( >> )
  • iam working as qa engineer

cat file.txt 
  • this is hari
  • im from hyd
  • iam working as qa engineer

   TOUCH  

touch - for creating for multiple empty files


touch file1,file2,file3    ---------------------- >>> Creating file with Touch Keyword
  • -rw-r--r-- 1 haritaraka12078 haritaraka12078    0 May 31 13:53 file1,file2,file3

 


touch file1 file2 file3
  • -rw-r--r-- 1 haritaraka12078 haritaraka12078    0 May 31 13:53 file1,file2,file3
  • -rw-r--r-- 1 haritaraka12078 haritaraka12078    0 May 31 13:54 file1
  • -rw-r--r-- 1 haritaraka12078 haritaraka12078    0 May 31 13:54 file2
  • -rw-r--r-- 1 haritaraka12078 haritaraka12078    0 May 31 13:54 file3


touch file{7..9}    ---------------------- >>> Creating file sequence order

  • -rw-r--r-- 1 haritaraka12078 haritaraka12078    0 May 31 13:57 file7
  • -rw-r--r-- 1 haritaraka12078 haritaraka12078    0 May 31 13:57 file8
  • -rw-r--r-- 1 haritaraka12078 haritaraka12078    0 May 31 13:57 file9 


   TEE   

tee tee1 tee2 tee3        ---------------------- >>>copy same data to all files

    • hari
    • hari
    • taraka
    • taraka
    • prabhu
    • prabhu

 ---------------------- >>>cat tee1

  • hari
  • taraka
  • prabhu

 ---------------------- >>> cat tee2

  • hari
  • taraka
  • prabhu

 ---------------------- >>> cat tee3

  • hari
  • taraka
  • prabhu 


   VI - Visual Editor 

vi prabhu_file ---------------------- >>>Creating file

  • i - Insert
  • enter the data
  • esc
  • :wq - For save & Exit