The other day I needed to migrate a directory containing a lot of files from one location on my Linux server to another. दूसरे दिन मैं एक स्थान से मेरा लिनक्स सर्वर पर फ़ाइलों का एक बहुत दूसरे युक्त निर्देशिका प्रवास की जरूरत है. There are a number of ways I could do this. रास्ते मैं यह कर सकता है की एक संख्या हैं. Using a simple cp command could have done the trick. एक साधारण सी.पी. कमांड का प्रयोग चाल कर सकता था. However, as the data I was copying was a database and I wanted to make sure that the copying was done perfectly, I looked on the Internet and found a brilliant one line bash solution for this. हालांकि, के रूप में डेटा मैं नकल एक डेटाबेस था और मुझे यकीन है कि पूरी तरह से नकल किया गया था बनाना चाहते थे, मैं इंटरनेट पर देखा और एक प्रतिभाशाली इस लाइन के लिए एक पार्टी की योजना बनाई समाधान मिल गया.
I wanted to move the contents of the directory /var/lib/mysql to /opt/mysql . मैं निर्देशिका की सामग्री को स्थानांतरित / var / lib / में mysql / चाहता था ऑप्ट mysql /. First I changed to the directory /var/lib/mysql : पहले मैं निर्देशिका में बदल / var / lib mysql /:
# cd /var/lib/mysql # Cd / var / lib / mysql
Then I ran the following one liner to do the magic for me. फिर मैं बाद एक जहाज मेरे लिए जादू कर भाग गया.
# tar cf – * | ( cd /opt/mysql; tar xfp -) # राल - * cf | (सीडी / opt / mysql, राल xfp -)
I used the command shown above to copy my database files. मैं अपने डेटाबेस फ़ाइलों की प्रतिलिपि ऊपर दिखाए गए आदेश थे. What it does is it compresses the entire contents of the current directory, changes to the location of the destination directory ( /opt/mysql in this case), and then extracts the archive. क्या ऐसा होता है यह वर्तमान निर्देशिका की पूरी सामग्री compresses, गंतव्य निर्देशिका के स्थान में परिवर्तन (/ opt / इस मामले में mysql), और फिर अर्क संग्रह.























2 Responses 2 प्रतिक्रियायें
Stay in touch with the conversation, subscribe to the बातचीत के साथ संपर्क में रहो, की सदस्यता लें RSS feed for comments on this post आरएसएस के इस पोस्ट पर टिप्पणियों के लिए फ़ीड . .
Continuing the Discussion चर्चा सतत