Ubuntu cleanup command & amp; backup

Source: Internet
Author: User

Ubuntu cleanup command & backup although linux does not have so much garbage and disk fragments in windows! However, some unnecessary temporary files will remain! Or the N old kernel after multiple upgrades! Find some methods to clear the spam from the internet! Www.2cto.com 1, a very useful cleaning command: sudo apt-get autoclean sudo apt-get clean sudo apt-get autoremove these three commands mainly clean up and upgrade the cache and useless packages. 2. Clear the cache files of opera firefox: ls ~ /. Opera/cache4 ls ~ /. Mozilla/firefox /*. default/Cache 3: Clear the isolated packages in Linux: You can run the gtkorphan sudo apt-get install gtkorphan-y command on the GUI: deborphan sudo apt-get install deborphan-y 4, uninstall: tracker is usually the first option to delete a tracker when I install ubuntu. It not only produces a large number of cache files, but also affects the boot speed. So you can delete it in Suntory. 5. Delete unnecessary kernels: Do not delete any errors. Remember !! Open the terminal knock command: dpkg-get-selections | grep linux has image is the kernel file to delete the old Kernel File: sudo apt-get remove Kernel File Name (such as: linux-image-2.6.27-2-generic) kernel to delete, the space has been released. The space should be-MB. Finally, do not forget to look at the current kernel: uname-a Appendix: package management temporary file directory: package in the Code:/var/cache/apt/archives not downloaded in the Code: /var/cache/apt/archives/partial you can also install the ubuntu tweak tool. The following link describes how to back up the system: Open the terminal and enter the following command: 1. Become the root user: sudo su 2. Go to the root directory: cd/. Then, the following is the complete command I used to back up my system: tar-cvpzf/media/sda7/backup. tgz -- exclude =/proc -- exclude =/lost + found -- exclude =/mnt -- exclude =/sys -- exclude =/media/. Next, Let's explain it a bit: tar is the backup program c-create a backup document v-detailed mode, the tar program will Output all information on the screen in real time. P-Save the license and apply it to all files. Z-use 'gzip 'to compress the backup file to reduce the size of the backup file. F-indicates the path where the backup file is stored./media/sda7/backup. tgz indicates the backup file name in this example. The backup file is backed up in another partition, that is, the original WIN partition. Because my root directory does not have enough space, I only need to back up it elsewhere. Let's take a look at the directory we want to include. We don't want to back up everything, because some directories are useless. Make sure that you do not want to include the file, otherwise you will get a very strange result. You do not need to back up anything in the/mnt directory, unless you have other partitions attached to it or you insist on backing up. You must also ensure that no resources are stored in the/media Directory (for example, any CD or mobile storage media). Otherwise, remove/media. * The last parameter is the directory we want to save. We want to save everything and use/as the root directory. Then we will restore the system backup in the future: Warning: Please, for God's sake, please be careful here. If you do not understand what you are doing, it is very likely to overwrite your important data, so please be very careful! Now, let's continue with the example above. We created a backup file named backup. tgz in the directory of another partition (sda7. One of the wonderful things in Linux is that it can be restored when the system is running, without the need to start a CD or any other mess. Of course, if your system has crashed, you must choose to use live CD, but the results are still the same. You can even remove all the files in the Linux system when it is running. But I won't tell you that command! Now, let's get down to the truth. This is the command I want to use. If your backup is not in the same position as mine, modify/media/sda7 accordingly: tar-xvpzf/media/disk/backup. tgz-C/if you are using bz2 compressed: tar-xvpjf/media/disk/backup.tar.bz2-C/

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.