![]() If you have a file named a.txt, and you want a copy of that file named b.txt: $ lsĪ.txt b.txt If you're not familiar with the ls command, ls "lists" all the contents of a directory.īy default the cp command uses your current directory as the path. To copy a file, pass the file you want to copy and the path of where you want to copy the file to. The basic form of this command takes an input source (or sources) that you want to copy (files or directories) and a destination to copy the files or directories to: cp source_file target_file How to copy a file to the current directory To view the documentation or manual for the cp command, run man cp at your terminal: $ man cpĬp source_file. The cp command is a relatively simple command, but its behavior changes slightly depending on the inputs (files vs directories) and the options you pass to it. To copy files or directories in Unix-based operating systems (Linux and MacOS), you use the cp command.
0 Comments
Leave a Reply. |