Linux Basic Commands Assignment
Assignment Part-3
Playing with files
1. Create a file like nano file1.txt
o Edit some data and then save the file
Edited and saved file
2. Now we will copy date from file1 to new file2
o cp file1.txt file2.txt
o Then see the output of file2.txt, cat file2.txt
o Give screenshot
Copied data to file2.txt
3. Now we will move the file2.txt to new folder /home
o mv file2.txt /home
o Then go to home directory and check ls, file exits or not?
o Given screenshot
File moved to the home directory
4. Then we create a new file3.txt and file4.txt in home directory and add
content in it.
o Now do echo “Hello I am newline” > file3.txt and provide the
output of file3.txt
o Now do echo “Hello I am newline” >> file4.txt and provide the
output of file4.txt
o Tell the different between both step you follow and the reason
behind it
The main difference is that ‘>’ its will override the existing data
and ‘>>’ will append the data
5. For remove a file or directory you can use the below two commands
o To delete a file – rm <any_filename>
File4 is deleted
oTodeleteadirectory-rmdir<any_directoryname>
Deleted the folderm directory.