《循序渐进LINUX》笔记

基础知识、服务器搭建、系统管理、性能调优、集群应用

1、swap物理内存两倍


2、根分区5G

3、/boot 100M

4、查看系统硬件信息:

cat /proc/meminfo

cat /proc/cpuinfo

查看磁盘信息: fdisk -l

软盘:/dev/fdx

U盘:/dev/sdax

光驱:/dev/cdrom


挂载软盘、U盘、光盘:mount -t vfat /dev/sda1 /mnt/usb


umount

5、etc :passwd shadow  group gshadow fstab  inittab


6、dev设备


7、proc设备


8、系统模式

9、修改默认:/etc/inittab    id:3:initdefault:


10、shutdown -r now   shutdown -h now  shutdown +5 "close"

      halt    reboot

11、通配符

12、时间


修改时间


前两天时间:date -d "2 days ago" +%Y-%m-%d

13、转超级用户:su -

clear

14、who


who -bu显示登录信息


15、显示登录信息:w


16、uname -a

uptime

dmesg

last

17、free -m

18、ps -ef

19、mkdir -p

more -c 10 xxx.txt

cat

diff -c x1.txt x2.txt

grep -i 忽略大小写

touch

20、硬链接、软链接ln -s


file 显示文件类型

21、find / -path "\usr\sbin" -prune -o -name "main.c" -user ixdba -type f -mtime +2 -print -exec rm {} \;


find / \(-path /var/log -o -path /usr/bin\) -prune -o -name "main.c" -print


find / -size 0 -type f -exec ls -al {} \;



22、split -b 10M access accessbak

split -b 10M -d -a 3 acc accbak


23、zip -9r /opt/xx.zip /etc


unzip xx.zip -d /etc


gzip


bzip


24、tar zcvf xx.tar.gz /etc

tar jcvf xx

tar zxvf 


tar zxvf   解压      tar cxvf 压缩

25、分区备份和还原:dd


cpio一种备份形式

26、df -h

df -hT

df -hiT

27、du -sh

fsck 修复磁盘

sync

eject


28、挂载磁盘镜像


mount -o loop -t iso9660  xx.iso /dix

mount -t nfs -o ro ip:/xx /mt

29、配置网卡信息


ifconfig eth0 down

ifconfig eth0 up

30、scp


31、netstat -rn

netstat -tnlup

traceroute


32、vi指令


lsmod:查看加载的模块

modprobe 装载模块


33、开启路由转发功能:/etc/sysctl.conf

net.ipv4.ip_forward=1

sysctl -p


34、route



35、yum 常规用法


用户端口1024以后

36、chkconfig --list sshd

chkconfig --level 35 xx off


37、不响应ping


禁止组合键重启


限制历史记录:/etc/profile HISTSIZE=30


38、iptables

iptables -L -n  列出规则

iptables -t nat -L -n

清除规则:iptables -F iptables -X  iptables -Z


39、ssh配置详解


chkconfig --level 345 sshd on

40、vsftp搭建


41、修改系统内核值:/etc/sysctl.conf

kernel.shmall=2097152

kernel.shmmax=4294967295

fs.file-max=6553600

kernel.shmmni=4096

kernel.sem=250 32000 100 128

net.ipv4.ip_local_port_range=1024 65000

net.core.rmem_default=4194304

net.core.rmem_max=4194304

net.core.wmem_default=262144

net.core.wmem_max=262144

sysctl -p

42、修改用户的文件限制?????


rc.local

43、/etc/passwd解读

44、/etc/shadow


45、/etc/group  /etc/gshadow


46、/etc/login.defs 用户定义默认配置:


/etc/default/useradd


.bash_profile

47、groupadd


useradd -g group1 -G g2,g3,g4

su - xxx

groupdel

useradd 


48、usermod


49、useradd -g xx -G xxxx -d /xx/xxxx llll

useradd -u 888 -s /bin/bash -G xx,xx -c "sdfsdf"


chmod u=rwx,g+x,o+r xx.log

chmod u-r,g-r,o-r xx.log

50、ext3文件误删除恢复:e2fsprogs\ext3grep

51、pstree -c -p mysql  显示父进程、子进程


>/dev/null 2>&1

52、raid


sar


52、vmstat 2 3  系统性能分析


53、cpu性能分析:sar -u 2 3  

sar -P ALL 2 3


54、iostat -c


uptime的三个值不要大于CPU个数



55、free -m

free -m -s 5


watch -n 2 -d free :高亮显示变动,每两秒


si so不用太高

sar -r 2 3


56、sar -d 2 3  磁盘IO分析



vmstat -d 2 3


57、sar -n DEV 2 3 当前网卡运行状况



RS232心跳


heartbeat



ha主配置文件



群集文件系统:GFS、OCFS2



LVS:NAT  TUN  DR


©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容