Linux Tips Summary (transfer)

xiaoxiao2021-03-06  14

LINUX skills summary

Author: Linux knowledge base

1, handle special file names

Suppose there is a file name called "-aaa" in the Linux system. If we want to operate it, for example, now to delete it, if we enter the RM -AAA command in the command line according to the general deletion method, the interface will prompt us. It is an invalid option. It turns out that Due to the first character of the file name -, Linux uses the file name as an option, we can use the "-" symbol to solve this problem, for example we can enter rm - AAA command to delete the -aa file. If you are other special characters, you can add a "" symbol in front of the special character, or create the entire file with a double quotation number.

2, fix the password of the super user under Linux

If the super user will forget the password, it will not be able to enter the system and cannot manage and use the system. This kind of thing is unlikely, but in some Linux stand-alone users, especially in beginners, it is relatively easy. The general solution is to format the hard disk to reinstall the system, but this is a bit small matter. Prepare bootdisk and rootdisk two floppy disks, start from the floppy drive, start to the root disk and the shell prompt appears. To the / mnt directory of the Linux root directory, such as your Linux on the hard disk first partition, enter mount / dev / hda1 / mnt in the command line, then enter the mnT directory, change the ETC / Passwd file, enter MV / MNT / etc / passwd / mnt/etc/passwd.bak is OK; then use the command cp / etc / passwd / mnt / etc / passwd to copy the / etc / passwd file on the floppy disk into the ETC directory in the hard disk. This will not ask the super password when it is started by the hard disk. When logging in; finally use the mv / etc / passwd.bak passwd command to change the passwd file back, and then run the passwd command to reset the password.

3, directly carry out Linux installation work

Usually, when we install an operating system software, the boot disk of the system needs to be installed. However, when we install the Linux operating system, we can use the DOS software named Loadlin.exe in the system disc that use the DOS software named LOADLIN.EXE to transfer the Linux core directly into the memory, and replace the current operating system by the Linux core to take over the computer, and enter Linux Install interface. When installing Linux, we just enter loadlin E: ImageSvmlinuz root = / / dev / ramlinuz root = / dev / ramlinuz root = / / dev / ramlinuz root = / dev / ramlinuz root = / dev / ramlinuz root = / dev / ramlinuz root = / / dev / ram init = E: iMagesinitrd.img This command can be installed directly; where E is the light drive letter, E: ImageSvmlinuz is Linux core name.

4, quickly launch Linux system

As the personal computer configuration is increasing, it is no new thing to install the Linux system on your computer. Suppose how both Windows and Linux are installed on our computer, how should I start Linux? Whether you need to restart your computer each time you can guide it through LILO? In fact, if we are in DOS, there is a simple and quick start Linux method, that is, Load Linux. Loadlin.exe is an executable program under DOS, which can quickly start Linux in a pure DOS environment, and do not need to restart your computer, usually we can find this program in the CD / Kernels directory. If you don't know where this program is placed on the installation disk, you can use the "Find -Name Loadlin *" command to find. After finding it, copy it into the DOS partition, and you also need to copy a Linux kernel file you use. You can copy directly from the disc via Windows, or you can use the mcopy command in the Linux environment to copy the file COPY to DOS partition; then write a batch file for Linux.bat, the file content is as follows: C: loadinglin C: VMLinuz root = / dev / hda1 ro, we assume that loadlin.exe and vmlinuz are in the root directory of the C drive, and the root is Linux root device, and Linux is in the hard disk first partition, so the device is named / dev / hda1, RO means Readonly. When you start Linux in DOS, you can run Linux.bat. This starts the LINUX quickly and efficient, which greatly reduces the time waiting for system self-test.

5, eliminate the crash phenomenon under xwindows

If we run Linux in XWindows, due to the problem of hardware itself or improper operation, sometimes it may cause the system to suddenly lose response, that is, a crazy phenomenon we often see, in fact, this system does not crash . We can use two common methods to eliminate this phenomenon: First, use the composite keys Ctrl Alt Backspace on the keyboard to turn off the currently running task; second, first hold the Ctrl Alt F2 on the keyboard. The compound button allows the system to switch to another, then log in to the system, then execute the #ps -ax | grep startX command, which will list your XServer's process ID (PID), then enter the following in the command line The command can eliminate the crash phenomenon under XWindows: #kill -9 pid_number, finally returns the original platform through the Alt F1 compound key.

6. Quickly close Linux system

The old version of the Linux / UNIX system must first run the shutdown command, and then turn off the power, but the latest version of the Linux / UNIX system has made great improvements in this respect, no need to shut down before. Because the new version of the system draws on the technology of the mainframe, the anti-electric log type file system can be automatically tracked to save user data, automatically synchronize the file system, and the user can turn off the power, thus achieving the quick shutdown system. .

7, clever use RM command

We know that in the Linux character interface, you can use the RM command if you want to delete a file, and remove a directory to use the RMDIR command. However, because the rmdir command can only delete a blank directory, if there is a file below a directory, you can only use the RM command to delete the file in the directory, so it usually requires RMDIR and RM two commands to cooperate with us. Remove a complete directory completely. But use this method to deal with a few subdirectory, if a directory contains several subdirectories, and this several subdirectory contains several grade catalogs, and then use this method, don't exhale you. . Now we can use the RM command with the -R parameter to delete a non-empty directory, for example, enter a command such as RM -R BBB in the command line, indicating that the system will remove all the files contained in the BBB directory and the subdirectory. 8, make good use of virtual operators

When we log in into the Linux system, if you press the Alt F2 button on the keyboard, then we can see a shell prompt, in fact, this is the second virtual operator. Typically, newly installed Linux systems have four virtual operators, we can use composite keys Alt F1, ALT F2, Alt F3, Alt F4 to access them. The most frequent frequency using the virtual operator is, when a program is missing, or when the Linux system suddenly loses the response, it can switch to other virtual operators to log in to enter the process task.

9, increase the virtual cache

If the SWAP (swap space) on your computer is not enough, as long as there is a space on our hard disk, we can use these remaining spaces, we can use the command directly: MKSWAP / DEV / HDA (assuming Linux drive is / dev / hda), swapon / dev / hda; to automatically start SWAP, you can add the new partition to the ETC / FSTAB, and you will work with the original SWAP. Check the size of SWAP with "free", Linux supports up to 16 swap partitions, each swap partitions up to 128M, and there is no big file to be established when there is no free partition. The following is a series of commands:

#dd if = / dev / zero of = swapfile bs = 1024 count = 8192

#mkswap swapfile 8192

#Sync

#SWapon SwapFile

10, clever use Tab key

Everyone knows when entering a command in the Linux character interface, sometimes you need to enter a lot of characters, if you often enter characters one by one, it is more cumbersome. Assuming that the typed characters are sufficient to determine the next unique file, we only need to press the TAB key on the keyboard to automatically replace the remainder of the file name, for example, to put the file DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD DCC .tar.gz is unpackage, when we type in the TAR XVFZ / CCC / D in the command line, if the file is the only file in this directory, you can press the Tab key on the keyboard directly. When the command will be automatically fuffed as: TAR XVFZ /CCCC/ddddddddddddddddddddddddddddddddddddddddddd to improve the input efficiency.

11, multi-purpose copy and paste to improve the operating speed

After the Linux system is installed, each time you start to the character interface, you will automatically run a GPM program. After the program runs, you can use the mouse to copy and paste it. The specific practice is to press and hold the left mouse button to highlight the place where you want to copy. At this time, the area that has been highlighted has been copied, and then the content of the right mouse button will be pasted in the location where the cursor is located. If we run the Linux system under xwindow, copy and paste operations are the same as in a normal Win9X system. 12, speed up Linux access data

If we want to quickly improve the hard disk read data under Linux, you can do some settings under Linux, let Linux work in 32-bit input and output mode and DMA channel mode. When setting, enter the 32bit transfer mode in the Linux command interface, enter the 32bit transfer mode, enter command / sbin / hdparm -dl / dev / hda to open the DMA transmission mode, then enter the command / sbin / hdparm -kl / dev / hda to make the hard disk still maintain the above settings after RESET, and we can improve Linux's read discs to more than 1 times.

转载请注明原文地址:https://www.9cbs.com/read-49219.html

New Post(0)