Can I replace a running program in Linux?

Source: Internet
Author: User
Can I replace a running program in Linux-general Linux technology-Linux programming and kernel information? For more information, see below. Today, a friend asked "Can I replace a running program in Linux ?", In the past, I vaguely remembered that it was okay in Linux (but not in Windows), So I casually replied "OK ". Result A friend sent an execution result: (test is running)

# Cp test2 test
Cp: cannot create regular file 'test': Text file busy

It seems that the program is occupied and cannot be overwritten. So I did a few more experiments:

(1) first rm deletes the running test, and then cp test2 test has no error.

(2) Change the name of the mv to the running test, and then cp test2 test is normal.

I checked the information and analyzed it. I found a satisfactory explanation. Cp does not change the inode of the target file. In fact, its implementation is as follows:
QUOTE:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.