Linux is a very useful command

Source: Internet
Author: User

"Determining whether a user exists, or new if not present"user= ' grep ' ^admin: '/etc/passwd '
If [-Z ' $user '];then
Groupadd Admin
useradd-d/home/admin-s/bin/bash-g Admin Admin
echo ' 123456 ' | passwd--stdin Admin
echo ' 123456 ' | passwd--stdin Root
Fi

"Adding File system space"Umount/homee2fsck-f/dev/mapper/volgroup-lv_homeresize2fs-p/dev/mapper/volgroup-lv_home 10gmount/homelvreduce-l 10g/dev/mapper/volgroup-lv_homevgdisplaylvextend-l +210.5g/dev/mapper/volgroup-lv_rootresize2fs-p/dev/mapper/ Volgroup-lv_root
"vi Common Commands": 50,70 s/^/# Notes 50 to 70 rows: 0, $d Delete all content:%s/r//g Remove the DOS mode of carriage return ^m:%s/^ (. *) n1/1$/Delete duplicate lines: <<comment code ... COMMENT Comment Paragraph
" View the file size in the current directory, from the big to the small arrangement " du-sh * | sort-nr | head

"Multi-IP, gateway configuration"/sbin/ifconfig eth0:1 192.168.13.122 netmask 255.255.255.0 up/sbin/route del default GW 192.168.12.1/sbin/route add Defau Lt GW 192.168.12.1
"Sync Time" /usr/sbin/ntpdate 192.168.12.1;/sbin/hwclock-w

" cancel your mail in/var/spool/mail/root tips "echo "unset mailcheck" >>/etc/profile

"No password Login"Ssh-keygen create public keys and keys.
Ssh-copy-id Copy (append) the public key of the local host to the Authorized_keys file on the remote host.
Ssh-copy-id also sets the appropriate permissions for the remote host user home directory (home) and ~/.ssh, and ~/.ssh/authorized_keys
you need to ensure that the configuration in/etc/ssh/sshd_config is: Authorizedkeysfile. Ssh/authorized_keysStep 1: Create a public key and key on the local host with Ssh-key-gen
[Email protected]$ ssh-keygen-t RSA
Step 2: Use Ssh-copy-id to copy the public key to the remote host
[Email protected]$ ssh-copy-id-i ~/.ssh/id_rsa.pub [email protected]
[Note: Ssh-copy-id appends the key to the. Ssh/authorized_key on the remote host.]
Step 3: Log in directly to the remote host
[Email protected]$ ssh [email protected]

"Test disk IO"Read performance test# time DD iflag=direct,nonblock if=/dev/sda2 of=/dev/null bs=8k count=8388608

because/dev/sda2 is a physical partition, the read to it will produce io,/dev/null is a pseudo device, which is equivalent to a black hole, of which the device does not produce IO, so the IO of this command only occurs in/ DEV/SDB1 is also equivalent to the read capability of the test disk.

Write Test# time DD oflag=direct,nonblock if=/dev/zero f=/opt/iotest bs=8k count=8388608 because/dev/zero is a pseudo-device, it produces only a stream of empty characters, it does not produce Io, so the IO is concentrated in the of file, the of file is used only for writing, so this command is equivalent to the write capability of the test disk. read/write Test# time DD iflag=direct,nonblock oflag=direct,nonblock if=/dev/sda2 f=/opt/iotest bs=8k count=8388608
"MySQL Installation"Create a MySQL installation directory and database storage directory[[email protected] rhel5~] #mkdir-P/usr/local/mysql//install MySQL[[email protected] rhel5~] #mkdir-P/usr/local/mysql/data//Storage databasecreate MySQL users and user groups[[email protected] Rhel5~]groupadd MySQL[[email protected] rhel5~]useradd-r-g MySQL MySQLinstall MySQL#tar-zxv-f mysql-5.5.10.tar.gz#cd mysql-5.5.10#cmake.-dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/usr/local/mysql/data-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dextra_charsets=all-denabled_local_infile=1#make#make Install
Installing the configuration JDKtar zxvf jdk1.6.0_25.tar.gz-c/export/servers/Vi/etc/profileAdd the following:Export java_home=/export/servers/jdk1.6.0_25Export Java_bin=/export/servers/jdk1.6.0_25/binexport path=\ $PATH: \ $JAVA _home/binExport Classpath=.:\ $JAVA _home/lib/dt.jar:\ $JAVA _home/lib/tools.jarexport java_opts= "-djava.library.path=/usr/local/lib-server-xms1024m-xmx2048m-xx:maxpermsize=256m- Djava.awt.headless=true-dsun.net.client.defaultreadtimeout=60000-djmagick.systemclassloader=no- dnetworkaddress.cache.ttl=300-dsun.net.inetaddr.ttl=300 "export java_home java_bin PATH CLASSPATH java_opts
the killing of all processesPs-ef | grep $ |grep-v grep |awk ' {print $} ' |xargs kill-9

"Uninstalling OpenJDK"
View FirstRpm-qa | grep javaUninstall:rpm-e--nodeps java-1.6.0-openjdk-devel-1.6.0.0-1.45.1.11.1.el6.x86_64rpm-e--nodeps java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64rpm-e--nodeps java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.x86_64Compulsory discharge:Rpm-qa | grep software name | While read line, do rpm-e--allmatches--nodeps $line;
Soft Links:ln-s/export/servers/jdk1.6.0_25/bin/jar/usr/bin/jarln-s/export/servers/jdk1.6.0_25/bin/javac/usr/bin/javacSource/etc/profileView:java-version

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.