《循序漸進LINUX》筆記

基礎知識、服務器搭建、系統(tǒng)管理、性能調優(yōu)、集群應用

1、swap物理內存兩倍


2、根分區(qū)5G

3、/boot 100M

4、查看系統(tǒng)硬件信息:

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、系統(tǒng)模式

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、分區(qū)備份和還原: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、開啟路由轉發(fā)功能:/etc/sysctl.conf

net.ipv4.ip_forward=1

sysctl -p


34、route



35、yum 常規(guī)用法


用戶端口1024以后

36、chkconfig --list sshd

chkconfig --level 35 xx off


37、不響應ping


禁止組合鍵重啟


限制歷史記錄:/etc/profile HISTSIZE=30


38、iptables

iptables -L -n? 列出規(guī)則

iptables -t nat -L -n

清除規(guī)則:iptables -F iptables -X? iptables -Z


39、ssh配置詳解


chkconfig --level 345 sshd on

40、vsftp搭建


41、修改系統(tǒng)內核值:/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? 系統(tǒng)性能分析


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主配置文件



群集文件系統(tǒng):GFS、OCFS2



LVS:NAT? TUN? DR


?著作權歸作者所有,轉載或內容合作請聯系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容