A simple lnuxFAQ for linux beginners! -- Linux general technology-Linux technology and application information. For details, refer to the following section. -Create ISO under Tip1 command line
Usage: mkisofs-a-I-J-r-o filename. iso/directory
Purpose: Make all files in a directory in linux into an iso image. in addition, I have added parameters to ensure that the disc you created can also be used in windows (iso has file size restrictions...)
-Tip2: Virtual ISO method in Linux
The procedure is as follows:
1. delete/dev/cdrom and run ln-s/dev/loop7/dev/cdrom.
2. losetup/dev/loop7 xxx. iso
3. mount/mnt/cdrom
How to change Disk:
1. losetup-d/dev/loop7; to cancel this device
2. losetup/dev/loop7 yyy. iso; new iso file
-Tip3 host usage
Host can be used to query domain names, but it can get more information. host-t mx linux.com can query the MX record of linux.com and the host Name of the mail processing host. host-l linux.com will return all domain names registered under linux.com. host-a linux.com will display all Domain Name Information of this host.
-How to decompress the Tip4 *. bz2 File
You can use the tar-I or bunzip2 command.
-Common Tip5 RPM usage
Displays the progress when installing the rpm package and verifies the correctness of the package.
Use the-VL parameter:
Such as rpm-ivh ipchains-1.3.6-1.i386.rpm
You do not need to use glint or xrpm.
Directly install the rpm package through ftp
Such as rpm-I ftp://ftp.xxx.xxx
Verify all rpm packages and find the missing files
Rpm-Va
Find the rpm package of a file
For example, rpm-qf/usr/bin/who
List the descriptions of an rpm package
Such as rpm-qpi mon-0.37j-1.i386.rpm
List the file information of an rpm package
Such as rpm-qpl mon-0.37j-1.i386.rpm
-Tip6: view the services monitored by the System
Usage: netstat-ln
Explanation: "l" indicates the port information of the current system listener; "n" indicates that the port is displayed according to the port number without being converted to the port name defined in the service file; if you want to know which processes listen on each port, you can use the p parameter.
-Tip7: view the processes running by the System
Usage: ps-auxw
Description: The parameter "a" indicates that processes of all users in the system are displayed; "u" indicates the information of the output process user; and "x" indicates that there are no processes in the console; if the displayed row is truncated because it is too long, the f parameter can be used.
-Tip8 Linux Account migration
For a new account->
Ensure that the new account to be added to the system is placed in the new location, which is implemented by modifying the HOME value in the/etc/default/useradd file. for example, HOME =/home2 creates the HOME Directory of the new account under/home2.
Move an existing account to a new location->
First, copy the home directory and directory attributes of an existing account to the new location. Run the following command:
Cp-a/home/home2
Or
Cp-rpd/home/home2
Then, modify the home_directory domain of the corresponding record in the/etc/passwd file to/home2/username.
In these two steps, the old account has been moved to the new location. After the error is ensured, you can delete the old home directory of the old account to free up the space of the original file system.
-Tip9
When Linux is started, the information displayed on the screen is too late to be visible. If you are interested in the information, you can run the dmesg command to view it after it is started.
-Tip10 GRUB-guided restoration tips
Linux rescue
Sh # grub
Grub> root (hdx, y)
Grub> setup (hd0)
Restart
Or use/sbin/grub-install/dev/hdx
NOTE: If it succeeds, there will be a successful ...... here, if x is a disk, It is 0. if the linux Root partition you install is on the second hard disk, x is 1, and y is the root partition where the linux system is installed. setup (hd0) is to write GRUB to the hard disk MBR. if I know that my linux is installed on the first hard disk, but I don't know which partition It is installed on, I can enter root (hd0, and then use the [TAB] key to complete it, then you will understand.
-Tip11: Test disk Performance
Usage: hdparm-tT/dev/hd?
Example: hdparm-tT/dev/hda (test the speed of the first physical hard disk)
-Tip12: Open Intranet services to the outside world
Map port 8888 on 192.168.1.2 to port 8888 on 192.168.1.3
# Iptables-t nat-a prerouting-p tcp-m tcp -- dport 8888-j DNAT -- to-destination 192.168.1.2: 8888
# Iptables-t nat-a postrouting-s 192.168.1.0/24-d 192.168.1.2-p tcp-m tcp -- dport 8888-j SNAT -- to-source 192.168.1.3
# Iptables-a input-p tcp -- dport 8888-I eth0-j ACCEPT (add as appropriate)
-Tip13: Disable the "annoying" Linux button Beep.
Vi/etc/. inputrc Add the following line
Set bell-style none
-Tip14: graphic/text login Mode
Vi/etc/inittab
Id: x: initdefault:
X = 3: text mode x = 5: graphic mode
-Tip15 limits the amount of memory available to the system in GRUB.
Linux can only use MB of memory
Title Red Hat Linux (2.4.19)
Root (hd0, 1)
Kernel/boot/vmlinuz-2.4.19 ro root =/dev/hda2 mem = 120 M
Initrd/boot/initrd-2.4.18-14.img
-How to find the related library files of a command in Tip16
Run the ldd command in Linux and run the following command on the console:
Ldd/bin/ls
You can get the list of related library files of the/bin/ls command.
-Tip17 only column sub-directories (files)
Ls-F | grep/$
You can also set this command to alias in. bashrc (for bash), and then you only need to input sub to implement the column-only sub-directory function.
Alias sub = "ls-F | grep/$"
Similarly, ls-l | grep ^-only columns common files.
-Files and subdirectories in the Tip18 computing directory
Ls-al | wc-l
-The color directory list is displayed under Tip19 RedHat.
Ls-color displays the color directory list, where:
Blue → directory
Green → executable files
Red → compressed file
Light blue → link file
Gray → other files
Similarly, you can try ls -- color (more than above-) to see the difference between the two.
-Display the Chinese file name in the Tip20 column directory
In a Linux system without patching, we used the ls column directory to find that all Chinese file names have become? . We can use the -- show-control-chars Command Option to display.
Ls -- show-control-chars
-Tip21. change the ownership of all directories and files in the current path.
Chown-R owner [. group] *
You can also use the find command:
Find.-exec chown owner [. group] {};
-Tip22: Change the attributes of all subdirectories and files.
In the directory where you want to change the attributes, enter the following command:
Chmod-R 777 *
You can change the attributes of all the subdirectories and files below, but you should be very careful when using this command. If you enter this command in the root directory, the attributes of all your files will be changed, this will cause a lot of security problems.
-Tip22: Use the nohup command
If you want the process to be executed after you exit the system, you can use the nohup command.
For example:
Nohup tar cf/dev/tape/home &
If you log out and log on again, you can use the ps command to find that the process is still running.
-Tip23 restart
Ctrl + Alt + Del or init 6 or shutdown-r now
-Tip24: Quick file search
You can use find to find files, but it is best to use locate. The speed is fast and the number of parameters is small.
Locate filename
It is searched in a database. Therefore, remember to often use the updatedb command to update the database. Generally, we add a sentence in the crontab to let the machine update the database late at night every day.
In addition, you can use whereis to quickly find the command file.
For example:
Whereis rpm
-Tip25: Search for Linux commands
If you want to implement a certain function, but do not know what command to use. you can try the apropos command, which may help you find the command you want. for example, if you want to "Search" a file and do not know what command to use, you can run the following command:
Apropos search
-Tip26: execute multiple commands simultaneously on the same command line
Separated by semicolons. For example, compile a source file:
#./Configure; make install
-Tip2: Use gzip to compress (decompress) multiple files in the same directory
Gzip * or gunzip *
-Tip28 directly starts vi when less or more is used
Press the v Key in less or more to immediately start the vi editor and edit the file.
-Tip29 start vi in mail
If you think it is inconvenient to use mail to send and edit emails, you can enter ~ V, start vi to edit, exit vi after editing, and return to mail.
-Tip30: Observe file size changes
The watch command can be used repeatedly to execute commands. It can work with ls to observe the changes in the size of a file.
Watch ls-| file. name
-Tip31: Search for files with specific strings
For example, find the file containing the "the string you want find..." string in the current directory:
Find.-type f-exec grep "the string you want find..." {};-print
-Tip32: View strings in binary files
Strings binaryfile
-After Tip33 is reinstalled with Win 9x, lilo becomes invalid and Linux cannot be started.
You only need to start Linux with a floppy disk and run lilo once. For RedHat, run mkbootdisk to create the boot disk. For example:
Mkbootdisk -- device/dev/fd0 2.4.20
2.4.20 is a directory under/lib/modules.
-Tip34: Remove lilo information in the boot Zone
After lilo is installed, if the number or partition of the hard disk changes, the hard disk cannot be started. In this case, you only need to use a floppy disk to start DOS and then run fdisk/mbr.
-Tip35: Change DOS/Windows to the default Operating System.
RedHat uses Linux as the default Operating System of lilo, that is, boot: After the prompt is displayed, press enter to start Linux. if you want to change to DOS/Windows, modify the file/etc/lilo. conf, put the DOS Startup part in front, and run lilo again. you can also. in the conf configuration file, add Default = dos, where DOS is the DOS/Windows label.
-How to Use the. iso file in Tip36
Many Linux releases have. iso CD image files that can be used to burn CDs. We can also use them directly in Linux.
You can use the command file to know whether a file is an executable file in ELF format, a shell script file, or other formats.
File filename
-Decompress the. tar.gz file using tispo2.
The xxxx.tar.gz file uses tar with the zxvf parameter and can be decompressed once.
Tar zxvf xxxx.tar.gz
-Tip39 background running program
You can add the "&" symbol after the program to run the program in the background. For example, you want to use updatedb to update the file path database without affecting other work. You can:
Updatedb &
-Tip40 force exit X
Sometimes in X, the mouse and keyboard do not work due to program errors. In this case, don't worry, because in Linux, there is almost no vicious crash like in Win 95, you only need to press Ctrl + Alt + BackSpace at the same time to return to the character interface.
-Tip41: compressing executable files
You can use gzexe to compress executable files. The compressed executable files can still be executed directly. This method can be used to save disk space (if you really need it ).
Gzexe gawk
-Tip42: process files with special characters in the file name
If a file name is-file, if you want to delete it, typing rm-file will display invalid option, because the first character of the file name is "-", linux regards the file name as an option. You can add -- to solve this problem, such as rm ---file. if it is another special character, you can add one before the special character, or enclose the entire file name with double quotation marks.
-Tip43: Enter the directory quickly
Type cd ~ Enter the user's home directory; Type cd to enter the previous directory.
-What do you do when Tip44 wants to delete all files or dir starting?
Wrong-> rm-r/tmp /.*
Correct-> rm-r/tmp /.*
-Tip45: Modify the nic mac address
Ifconfig eth0 down
Ifconfig eth0 hw ether 00: AA: BB: CCD: EE
Ifconfig eth0 up
The above is temporary. You can add rc. local to enable it to run automatically upon startup.
-Tip46: view the NIC working status
# Mii-tool-v
Eth0: no link
Product info: vendor 00:00:00, model 0 rev 0
Basic mode: autonegotiation enabled
Basic status: no link
Capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
Advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
SIOCGMIIPHY on 'eth1' failed: Operation not supported
-Tip47: how to solve the problem of slow startup of sendmail and sm-client!
Sendmail and sm-client are slow to start because of resolution issues. The solution is to add your host name to/etc/hosts. For example, my host name is linuxbox. localdomain, there should be one in/etc/hosts
192.168.100.1 linuxbox. localdomain linuxbox
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.