Linux 学习

远程登录Linux(05)

文本方式远程: putty   SecureCRT  winSCP  SshClient
图形方式远程:Xmanager  Xming

ifconfig
ps -ef | grep ssh
df -H
env

关机重启(09)
poweroff
shutdown -h now
shutdown -h 10
shutdown -h 20:25

shutdown -r now
reboot

文件目录命令
目录浏览:   cd    dir   ls    ll     pwd
文件浏览:   cat  (>  >>)    more   less    head     tail
目录操作:   mkdir   rmdir
文件操作:   touch  rm   cp    mv   ln   tar   gzip   gunzip  stat  echo

find     grep  who/w   whereis     whatis


find  /tmp/  -name a.txt
rpm -qa|grep httpd
who |grep tty1
stat dm.txt
dmesg


软件包安装(12)
rpm -qa | grep httpd
rpm -q httpd
rpm -ql httpd

rpm -ivh httpd.rpm
rpm -Uvh httpd.rpm
rpm -Fvh httpd.rpm
rpm -e httpd

mount /dv/cdrom /mnt

打包(13)
tar -cvf test.tar  *
tar -zcvf test.tar.gz  *
tar -tf  test.tar

tar -xvf test.tar
tar -zxvf test.tar.gz

gzip  gunzip

系统信息类命令(13)
date   cal  clock

dmesg  df   du   free  w   last

df -H
du /tmp

echo $SHELL
history


用户与组管理(14)
/etc/passwd
/etc/shadow
/etc/group


useradd   userdel   passwd  usermod
groupadd groupdel groupmod
id

useradd -g stuff -G root stuff
userdel -r stuff
id stuff

文件系统(15)
u(user)    g(group)    o(other)    a(all)
SUID     GUID     SBIT
- d l s p c b
x(1)   w(2)   r(4)


chmod   chown  umask

文本编辑器VI(18)
H    M   L   G   ^   $

dd   yy   p
:  r  filenae
/    n    N

:s/old/new
:%s/old/new/g


:%s/old/new/gc


:set nu

网络基础(19)
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network
/etc/host.conf
/etc/hosts
/etc/resolv.conf
/etc/services

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.10
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
NETWORK=192.168.1.0
BROADCAST=192.168.1.255

NETWORKING=yes
HOSTNAME=linux.jnrp.cn
GATEWAY=192.168.1.1

127.0.0.1  localhost.localdomain  localhost
192.168.1.10 centos


nameserver 192.168.1.1
nameserver 61.134.1.4
search jnrp.cn
domain jnrp.cn

/etc/rc.d/rc.local

ifconfig  ifup  ifdown  hostname  route netconfig
ping  traceroute  netstat  curl  wget 


route -n
route add -net netaddr netmask gw ipaddr dev
route add default gw ipaddr
route del -net netaddr netmask gw ipaddr dev
netstat -ant
curl --head www.163.com


进程管理(20)
ps    top
kill  killall  nice renice  nohup
fg   bg   jobs 
setup  ntsysv  chkconfig

ps -aux
ps -ef
ls -R / >list &
kill -9 927
killall xinetd

CTRL + C
CTRL + Z

chkconfig --list


邮件服务器(22)
EXTMail


LAMP综合(24)
Apache      /etc/httpd/conf/httpd.conf
PHP           /etc/php.ini
MySQL       /etc/my.cnf

htpasswd -c /etc/httpd/conf/httppwd  testUser
htpasswd /etc/httpd/conf/httppwd  testUser

基于用户/用户组的认证
基于虚拟主机(IP/端口)的网站

MySQL主从服务器(29)
主: 
vi /etc/my.cnf

server-id=1
log-bin
binglog-do-db=备份库名
binglog-ignore-db=不备份库名

从:
vi /etc/my.cnf
server-id=2
master-host=192.168.1.9(主IP)
master-user=admin(账号)
master-password=7758521(密码)
master-port=3306(端口)
replicate-do-db=booboo(库名)

mysql> show slave status\G


Slave start
Slave stop
Reset slave
Show slave status
Show master status

WEB同步(29)
vi /etc/rsyncd.conf

uid=root
gid=root
use chroot = no
max connections =20
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsync.lock
log file=/var/log/rsyncd.log

[web]
path=/var/www/html/bbs/
ignore errors
read only=yes
hosts allow=192.168.1.0./24
hosts deny=0.0.0.0/32


/usr/bin/rsync --daemon


#!/bin/sh
while true
do
    /usr/bin/rsync -av 192.168.1.3::web /bbs/ >/dev/null 2>&1
    sleep 20
done

rsync -vzrtopg 192.168.1.3::web /bbs/

/usr/bin/nohup /bin/sh /usr/local/webserver/tb.sh 2>&1 > /dev/null &

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted @ 2016-12-10 20:04  ParamousGIS  阅读(339)  评论(0编辑  收藏  举报