Skip to content Skip सामग्री के लिए


Bash one liner – how to compress, move, and extract a directory पार्टी की योजना बनाई एक लाइनर - कैसे जमना, के लिए कदम है, और एक निर्देशिका निकालें

लिनक्स

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), और फिर अर्क संग्रह.

Posted in पोस्ट में Linux लिनक्स . .

Get Simple Help tutorials just like this one in your email inbox every day - for free! बस अपने ईमेल इनबॉक्स के लिए मुफ्त हर दिन - में यह एक तरह सरल सहायता ट्यूटोरियल जाओ! Just enter your email address below: बस नीचे अपना ईमेल पता दर्ज करें:

You can always opt out of this email subscription at any time. तुम हमेशा इस ईमेल सदस्यता से बाहर किसी भी समय विकल्प चुन सकते हैं.

2 Responses 2 प्रतिक्रियायें

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

Continuing the Discussion चर्चा सतत

  1. More secure CLI file copy « Linux & Stuff अधिक सुरक्षित CLI फाइल कॉपी «लिनक्स और सामग्री linked to this post on May 28, 2009 28 मई 2009 को इस पोस्ट के लिए लिंक

    [...] in Uncategorized Interesting post from Simplehelp where the following command is recommended to copy a large database from one location to [...] Simplehelp से Uncategorized दिलचस्प पोस्ट में [...] जहां निम्न कमांड को एक स्थान से एक बड़े डाटाबेस की नकल की सिफारिश की है [...]

  2. How to setup slow query logging in MySQL | TuxWire : The Linux Blog सेटअप को कैसे धीमी MySQL में प्रवेश प्रश्न | TuxWire: लिनक्स ब्लॉग linked to this post on September 22, 2009 22 सितम्बर 2009 को इस पोस्ट के लिए लिंक

    [...] Bash one liner – how to compress, move, and extract a directory [...] [...] मार एक लाइनर - कैसे जमना, के लिए कदम है, और एक निर्देशिका में निकालने के [...]



Some HTML is OK कुछ HTML है ठीक है

or, reply to this post via या, इस पोस्ट के माध्यम से जवाब trackback Trackback . .