Linux Command Summary
1. Save new partition information to/etc/fstab
Fstb:echo/dev/xvdb1/mnt ext3 defaults 0 0 >>/etc/fstab
2.%s/old/new/g replaces all occurrences of the string in the body with the string new old
3. SSH Production key tool ssh-keygen-t RSA
Default password Save file:./.ssh/authorized_keys
The default generated private key file is: Id_rsa, public key is Id_rsa.pub
4. Find commands
Chattr
find/proc/-name exe | Xargs Ls-l | Grep-v Task |grep deleted| awk ' {print $11} ' | awk-f/' {print $NF} ' | Xargs killall-9
5. The set IC does not consider case when looking
6. Mkdir-p can create subdirectories where the parent directory does not exist:
For example, create Mkdir-p/a/b/c (b directory does not exist)
7, Netstat-ano | Find ":"//windows cmd find native link 22 port process
8. SSH shortcut keys
CTRL + U delete all characters in front of the cursor equal to VIM D shift+^
Ctrl + K Delete all characters after cursor equals vim d shift+$
CTRL + A moves the cursor to the beginning of the command line equivalent to Vim shift+^
CTRL + E moves the cursor to the end of the command line at the equivalent of vim shift+$
9, when there is no root authority, use Sudo-i to enter the password of the normal user can get root permissions, so you can change the root password
10, Linux empty the last command to view the login record
Echo >/var/log/wtmp
echo >/var/log/btmp
11. Linux Modification $PS 1
Vim/etc/profile:export ps1= ' \n\[\e[21;31mwupeng:\e[m \ t----> [\[email protected]\h Path: \w]\n\n\$ '
SFTP usage
1, mainly used to transfer files, including uploading files (from the computer to the remote host), download files (from the remote host to the computer)
2, Link development port for 55431:sftp-oport=55431 [email protected]//Here-oport must immediately after the SFTP
Download the file Test.cpp in the remote current directory to the project folder in your local current directory:
Get test.cpp./project/
Transfer the iOS files in the local/home/liu/software/directory to the/home/xudong/blog/directory of the remote login host:
put/home/liu/software/rhel_5.5_x86_64.iso/home/xudong/blog/
Linux Iptables
1, iptables modification steps:
1./etc/rc.d/init.d/iptables Save
2, service iptables restart
3. Command
#iptables-D iptables-d INPUT 2
# iptables-t nat-a prerouting-p tcp--dport 80-j REDIRECT--to-ports 8080//natively port mapping
#iptables-N testssh--Custom chain name
#iptables-A testssh-s 192.168.10.10/32-j ACCEPT
#iptables-A input-p TCP--dport 22-j testssh--Apply A custom chain to the INPUT chain
#iptables-I INPUT 9-p tcp--dport 3306-j mysqlaccept inserted before 9th, 9th becomes 10th.
4. Backup the current configuration
Iptables-save > Iptables.rules
5. Restore Configuration
Iptables-restore Iptables.rules
6, access to the 3306 port of the intranet MySQL server by accessing the 63306 port of the public network IP
Iptables-t nat-a prerouting-p tcp--dport 63306-j DNAT--to-destination 192.168.1.2:3306
Iptables-t nat-a postrouting-d 192.168.1.2-p tcp--dport 3306-j SNAT--to 192.168.1.1
Linux Host Port tool: RINETD
wget HTTP://WWW.BOUTELL.COM/RINETD/HTTP/RINETD.TAR.GZ&&TAR-XVF RINETD.TAR.GZ&&CD rinetd
Sed-i ' s/65536/65535/g ' rinetd.c (Modify port range)
Mkdir/usr/man&&make&&make Install
Vi/etc/rinetd.conf:
0.0.0.0 6379 Redis link address 6379// Add port mapping
Logfile/var/log/rinetd.log //Add Log
RINETD //start
Linux Boot Process
1. The user turns on the power of the PC, the BIOS post, and starts with the boot device (usually the hard disk) set up in the BIOS;
2 Boot program installed on the device LILO or grub starts booting Linux;
3. Boot the kernel first, then execute the INIT program, the INIT program calls the Rc.sysinit and RC programs, Rc.sysinit and RC;
4. Return to Init when the task of initializing and running the service is completed;
5.init started the Mingetty, opened the terminal for users to log on the system;
6. After successful login, the user enters the shell, which completes the whole boot process from boot to login.
This article is from the "Frog Technology Archive" blog, so be sure to keep this source http://frogtwo.blog.51cto.com/3805708/1936516
In the Linux command Rollup update