Article Title: Tips for collecting and sorting Linux (2 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
1. Clear the file
:> Filename
> Filename
Echo> filename
2. You do not need to enter a password to log on using the ssh key.
Ssh-keygen-B 1024-t rsa
Ssh server "mkdir. ssh; chmod 0700. ssh"
Scp ~ /. Ssh/id_rsa.pub server :~ /. Ssh/authorized_keys
In this way, the password is not prompted and you can directly log on to the server.
Convenient operations such as file copy and Synchronization
3. vncserverq starts the specified Desktop
Vncserver: 23
4. Change the user group of the entire directory
Find.-print-exec chown group. user '{}';
Chown. group. usr-R
5. Change the prompt color
Larry taught me. Thank you, larry.
PS1 = '[e [1; 31; 44 m] root [e [0 m] @ H #'
ESC [code ;...... Codem
Replace the location of the code with the number listed below. Pay attention to the last
The letter must be m in lower case.
A text attribute
0. Discard any properties (the screen is restored to black and white)
1. Bold display
4-underline (only for monochrome display adapter)
5. flickering display
7 reverse display
8. Comparison
B foreground color
30 Black 31 red 32 green 33 yellow
34 blue 35 Red 36 Green 37 white
C background color
40 black 41 Red 42 green 43 yellow
44 Blue 45 red 46 green 47
6. View restart records
Last
7. Adjust the time according to the machine on the network
Ntpdate ntp-server
Network time protocal, ntp-server needs to enable ntpd
8. Burn ISO
Mkisofs-o X_lfs.iso-J-R 'pwd'/X_lfs
9. floating point operations
Bc
Echo "2.5*3.4" | bc
2 decimal places
Echo "scale = 2; 5/3" | bc
Dc
10. Monitor the execution result of a command
Watch-n1 command
Watch-n1 date
11. view the directories that can be mounted on the NFS Server.
Showmount-e hostname
Showmount hostname
12. Modify the time zone
In the/usr/share/zoneinfo/directory, find the expected time zone and copy and overwrite/etc/localtime.
13. View hardware information
Vi/etc/sysconfig/hwconf
14. View partition types
Df-T
15. The start parameter pci = noacpi apic = 0 can be added to the linux rescue.
16. View hard disk speed
Hdparm-tT/dev/sda
17. Check whether the computer supports VT
Egrep "^ flags. * (vmx | svm)"/proc/cpuinfo
18. Unbind files from the RPM package
Rpm2cpio rpmname. rpm | cpio -- extract -- make-directories