Linux experience sharing: cp command

  

On how to pass the file back to the local, my original idea is to package it as a tar file, but this will inevitably lead to shrinking disk space. For example, my VPS disk size is 30G, then I can only download 15G data at most, because a 15G compression package will be generated after packaging. Also copying files directly to /var/www will have similar drawbacks. If you cut it, you can't make it. And manually moving the files away, it makes people feel very uncomfortable. If you directly set the incoming under /var/www? Too unsafe! Because /var/www is accessible to anyone.

There is no way to make the best of both worlds. At first I wanted to write a bash script, so I started to watch the bird's linux textbook. I didn't expect to look at it and found something more interesting. One line of commands solves the problem.

The Linux cp command is very powerful and can create files similar to the shortcuts in Windows. However, this file does not point to the shortcut function, but has the same permissions and capabilities as the source file.

Start my attempt: cp -s -r /root/.mldonkey/incoming/files/*.* /var/www/downloads/failed because although a shortcut file was created, at http:\\\\ The access in the ip\\ directory is empty, and apache may not recognize the soft shortcut.

cp -l -r /root/.mldonkey/incoming/files/*.* /var/www/downloads/Success! It can now be downloaded directly from the http:\\\\ip\\ directory! And does not take up extra disk space. Before copying df -hl view, use 6%. After copying, it is still 6%.

After executing once, add \\ to the command to skip the default -i parameter without confirming each override action. Trying the ln command to generate a link between the two directories can be done once and for all, but unfortunately the hard link cannot be pointed to the directory, and apache does not recognize the soft link. So is your box perfect? Is it perfect? What do you want to toss next? Remember: How to verify file integrity.

md5sum is a default attachment component in linux, just use md5sum /root/.mldonkey/incoming/files/*.* > /var/www/downloads/XXXX.md5

The contents are normal under GBK. However, the generated md5 file is completely absolute path 囧, I did not seem to have parameters about the absolute path relative path, if you want to use it locally, you can only use the notepad to open the edit and delete the path.

But after a little bit of getting started, linux is really a very good system. I feel that everything is in control, not like Win, facing a small box of colorful, but I don't understand how it works inside. When something goes wrong, it can't be solved if it can't be solved.

Copyright © Windows knowledge All Rights Reserved