As we mentioned above, cp command is a command to create copy of files and directories. Here are some samples of cp command that might useful in day-to-day operation. This is a very basic cp usage. To copy a file name myfile. From example above, myfile.
To copy multiple file at the same time, we can just put the files behind the copy command which separated by space. Copying a directory is a little bit tricky. You need to add -r or -R option to do it. This option is a must whether the directory is empty or not. One more thing to note is that you need to remove the trailing slash behind the directory name. Copying file means you must have some space on the storage to store the copied files. To do this, we can use -l option. It marked by the same inode, But please note, hardlinks cannot be created into directories.
Same with its original file. There is another type of links called softlinks or symbolic links. We use -s option to do this. Creating symlinks only can be done in current directory.
Once I manage to be there, I can run cp -s command above. This site uses Akismet to reduce spam. Learn how your comment data is processed. If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? Related Posts. Could you pls elaborate? Try it out. Ajay Many thanks for sharing. Got something to say?
Join the discussion. Cancel reply Have a question or suggestion? As before, this is a dangerous command, so be careful. With this command, if you have duplicate filenames, you will definitely lose data during the move operations. By Alvin Alexander. Last updated: November 27, A Linux shell script that shows find and tar with multiple image filenames. Unix find command: How to move a group of files into the current directory.
0コメント