Question

The Output of the following Commands: 1. Output of the cp -v /etc/host 2. Output of...

The Output of the following Commands:

1. Output of the cp -v /etc/host

2. Output of the mv -v /tmp/myfile ~

3. Output of the rm -v file.txt

4. Output of the rmdir -v data

5. Output of the rm -v file.txt

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) cp command is used to copy files from source to destination and follows a syntax like:

cp [options] source destination

Command syntax given in question is incorrect for cp. Following correct syntax:

If we use "cp -v /etc/hosts ~" it will copy hosts file from /etc to your home directory (specified by tilde ~ symbol)

[opc@oel7cloud ~]$ cp -v /etc/host
cp: missing destination file operand after ‘/etc/host’
Try 'cp --help' for more information.
[opc@oel7cloud ~]$
[opc@oel7cloud ~]$ cp -v /etc/hosts ~
‘/etc/hosts’ -> ‘/home/opc/hosts’
[opc@oel7cloud ~]$

2) mv command is used to move/rename files or directory in Linux/Unix. Its syntax is similar to cp command as shown below:

mv [options] source destination

Here we created a file named myfile and then used "mv -v /tmp/myfile ~" which will move myfile from /tmp to your home directory (given by tilde ~ symbol)

[opc@oel7cloud ~]$ touch /tmp/myfile
[opc@oel7cloud ~]$ mv -v /tmp/myfile ~
‘/tmp/myfile’ -> ‘/home/opc/myfile’
[opc@oel7cloud ~]$

3) rm command is used to remove/delete files. Its syntax us given below:

rm [options] filepath

I've created a file named file.txt and then executed "rm -v file.txt" which removed the file as shown in the message.

[opc@oel7cloud ~]$ touch file.txt
[opc@oel7cloud ~]$ rm -v file.txt
removed ‘file.txt’
[opc@oel7cloud ~]$

4) rmdir command is used to remove/delete a directory. Its syntax us given below:

rmdir [options] directorypath

I've created a driectory named data using mkdir command. I then executed "rmdir -v data" which deleted data directory as also shown in the message.

[opc@oel7cloud ~]$ rmdir -v data
rmdir: removing directory, ‘data’
[opc@oel7cloud ~]$

5) " rm -v file.txt" is same as shown above in point 3. Please refer the same.

Add a comment
Know the answer?
Add Answer to:
The Output of the following Commands: 1. Output of the cp -v /etc/host 2. Output of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT