Skills accumulated in Linux over the past five years (2) -- system (I)

Source: Internet
Author: User
Skills accumulated over the past five years in Linux (2) -- system (I) This article mainly introduces some skills in Linux. The author JHGao & lt; gaopenghigh@gmail.com & gt; has been in touch with Linux for five years now, just like everyone else, it's hard to get involved. Occasionally, I will take the approach... to play with the skills accumulated in Linux over the past five years (2) -- system (I) This article mainly introduces some Linux system skills. Author: JH Gao It has been five years since I first came into contact with Linux. like everyone else, I have to deal with it. Once in a while, I will record the method. now I will briefly summarize it. Therefore, the command function can be used by man. I only list what I think is commonly used. Www.2cto.com 1. when an error occurs in the/etc/fstab file, the system cannot start normally. in this case, you can start the file to enter the single user mode, while in the change mode, the root directory "/" is read-only, you can use the following command to remount "/" to "read/write": Shell Code [root @ linux] # mount-n-o remount, rw/-n: mount but do not change/etc/mtab-o: options 2. partprobe -- do not restart to use the new partition table partprobe: reinitializes the kernel in memory of the partition table. after changing the partition settings, the system prompts you to restart to change the partition table in the kernel. you can use partprobe to avoid restarting. 3. the ubuntu system switches between the two KDM instances. If you have installed GNOME and KDE at the same time, you sometimes need to switch between the two DMMs: Shell code sudo dpkg-reconfigure tpd 4. increase swap space. create a new partition or file B. use mkswap to write special c. add a new record d to/etc/fstab. activate the swap partition. run swapon-a or swapon [SWAPFILE] e. an example of using the swapon-s command to check the status of the swap partition: shell code dd if =/dev/zero of =/swapfile bs = 1 M count = 100 mkswap/swapfile vi/etc/fstab... swapon-a 5. convert ext2 to ext3 Shell code tune2fs-j/dev/sdax 6 without formatting. an example of binding an Eni to multiple IP addresses: the system is CentOS and the network adapter is eth0, If you only need to set one additional IP, create the file/etc/sysconfig/network-scripts/ifcfg-eth0: 0, and set IP information in the file. If you need to set an IP segment, create the file ifcfg-ethX-rangeX: ifcfg-eth0-range0: Shell code DEVICE = eth0-range0 BOOTPROTO = static HWADDR = 08: 00: 27: 24: C2: 72 ONBOOT = yes IPADDR_START = 192.168.56.20 IPADDR_END = 192.168.56.30 NETMASK = 255.255.255.0 and then restart the Network 7. change the hostname search order and modify/etc/nsswitch. conf (modify this file to implement more functions, such as querying the query sequence of group, passwd, and networks. For more information, see the man manual.) 8. the lsof command can list all open files. The most common function of this command is to find the "lost" space. For example, we can use the df command to see that the/home partition is only 1 GB, but the result of using the du command should be 5 GB, which is often caused by the deletion of some files, but the file handles of these deleted files have not been released. Run the Shell code lsof | grep-I deleted to check which files have been deleted but the file handle has not been released. kill or restart the response process to retrieve the "lost" space. Sometimes, lsof can restore objects that are accidentally deleted. for specific methods, please google. 9. the directory length is never 0, because it always contains two items:. and. The length of a symbolic link refers to the number of characters contained in the path name. because the path name contains at least one character, the length is not 0. 10. to create a folder named "-f", The Command mkdir-f will inevitably fail, and the Shell code mkdir ---f can be created successfully. 11. use "cd-" to switch between the two recently used directories 12. difference between su and su-: When su is executed, the new shell inherits the current shell environment. su-simulates the actual root login session 13. quickly clear history Shell code export HISTSIZE = 0

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.