![]() This will preserve the files permissions/ownership while showing progress. Take a look at man pv to learn more about it.Īnother option, as DoR suggests in this answer, is to use rsync instead: $ rsync -ah -progress source-file destination-file pv is just like cat, but if you redirect it's output stream somewhere else, it will print progress information to stdout instead. ![]() (where cat just reads a file and prints it to stdout). cp basically does nothing fancier than cat source > destination Without arguments, as you see above, > redirects a program's standard output to a file. The > redirection operator redirects program output to a file. Every program has all three, so to speak. There are three important streams of data in a unix-like system: stdout (standard output), stderr (standard error) and stdin (standard input). You may need to Install pv (alternatively, type sudo apt-get install pv) on your system. ![]() This is what it looks like: pv my_big_file > backup/my_big_fileġ38MB 0:00:01 100% Simultaneously, it prints information about the progress to the terminal when you do that. In this example, pv basically just outputs the file to stdout*, which you redirect to a file using the > operator. Files copied this way will have the same permissions as if you'd created them yourself and will belong to you. Note: this method will lose the file's permissions and ownership. While cp hasn't got this functionality, you can use pv to do this: pv my_big_file > backup/my_big_file
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |