Exercise: Playing with files -Part2

  1. Create a file like nano file1.txt
    1. Edit some data and then save the file
  2. Now we will copy date from file1 to new file2
    1. cp file1.txt file2.txt
    2. Then see the output of file2.txt, cat file2.txt
    3. Give screenshot
  3. Now we will move the file2.txt to new folder /home
    1. mv file2.txt /home
    2. Then go to home directory and check ls, file exits or not?
    3. Given screenshot
  4. Then we create a new file3.txt and file4.txt in home directory and add content in it.
    1. Now do echo “Hello I am newline” > file3.txt and provide the output of file3.txt
    2. Now do echo “Hello I am newline” >> file4.txt and provide the output of file4.txt
    3. Tell the different between both step you follow and the reason behind it
  5. For remove a file or directory you can use the below two commands
    1. To delete a file – rm <any_filename>
    2. To delete a directory – rmdir <any_directoryname>
Open chat
Hello 👋.
Tell me, how can I help you?