Common Linux command - 持续更新

查看那个进程占用了xxx端口
lsof -i:xxx
查看进程号为xxx的进程在哪里
ps -ef|grep xxx

ps -aux

然后用kill杀掉

kill 3268

kill -9 $(ps -ef | grep peidalinux)

同步时间:

vi /etc/crontab

0 */60 * * * root hwclock --hctosys

0 */2 * * * root ntpdate us.pool.ntp.org;hwclock -w

配置DNS:
vi  /etc/sysconfig/network-scripts

DNS1=202.96.209.5

重启网卡,然后在 /etc/resolv.conf就有了

VSFTPD:

yum install vsftpd

---

vi /etc/vsftpd/vsftpd.conf

groupadd test
  mkdir /tmp/test
useradd -G test �Cd /tmp/test �CM usr1

passwd usr1

--

chmod 777 /tmp/

service vsftpd start


setenforce 0

service iptables stop

----------------------------------------------------------------------------------

./config 在配置时出现错误,是可以再解决问题后在重新配置的


编辑文件的方法:
nano /var/www/html/info.php
vi /var/www/html/info.php

rm -rf /var/spool/mail/用户名

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
系统安装前准备:
# more /var/log/messages    //检查有无系统级错误信息,没有系统error
           # dmesg     //检查硬件设备是否有错误信息,没看到error
           # ifconfig    //检查网卡设置是否正确,有ip即可
           # ntsysv     //关闭不需要的服务,<空格>选择,设置完成后重启系统
           # crontab �Ce
           加入:
                 */5 1 * * * ntpdate 210.72.145.44 > /dev/null 2>&1                  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
linux rpm 查找:
http://www.filewatcher.com/m/rrdtool-1.2.27-3.el5.i386.rpm.475404-0.html
http://rpm.pbone.net/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
yum独立源的建立已经查找:
http://zhumeng8337797.blog.163.com/blog/static/100768914201182785336268/
搜索关键字: vi /etc/yum.repos.d/Dag.repo###定义第三方源

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
设置时间time clock:
http://www.t086.com/article/4386
 修改/etc/sysconfig/clock文件的内容为:
 修改/etc/sysconfig/clock文件的内容为:
 ZONE=”Asia/Shanghai”
 UTC=false
 ARC=false
date -s "2008-08-08 12:00:00"

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

查找命令:
updatedb
find / -name snmp

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
快速启动命令:
service nagios restart && service httpd restart && service snmpd restart

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
linux常用rpm zip包下载:
http://rpm.pbone.net/
http://mirrors.163.com/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
查询OS:
cat /etc/issue
uname -a

日志信息:
/var/log
/etc/syslog.conf

查询设备信息:
dmesg
lspci
dmesg

设备模块信息:
modinfo bnx2
lsmod | grep bonding
http://www.cnblogs.com/mydomain/archive/2013/04/16/3023323.html
在centos 6.3中没有了modprobe.conf 和 modules.conf文件取代的是在/etc/modprobe.d/dist.conf
echo 0 > /sys/class/net/bond0/bonding/mode

rpm包安装卸载:
rpm -ivh lifekeeper
rpm -e lifekeeper

安装软件后,有对应的模块可以查看:
lsmod | grep lifekeeper

卸载模块和对应的依存模块:
rmmod bnx2
rmmod bnx2x

从新加载模块:
insmod bnx2
有些是:modprobe bnx2x
具体的案例:
http://www.cnblogs.com/mydomain/archive/2013/04/16/3023323.html
modprobe -r vmxnet (去除模块)
modprobe mybridge
service network restart

查看软件安装的目录:
rpm -ql lifekeeper
fcitx 安装到 /opt/fcitx

查看安装软件注册的服务:
chkconfig --list | grep lifekeeper | more
ps -aux | grep lifekeeper
Service NetworkManager stop
Chkconfig NetowrkManager off
chkconfig --level 235 httpd on

查看软件对应的模块:
lsmod | gerep lifekeeper

查询设备比如网卡的状态:
mii-tool eth0

DNS 解析:
vi /etc/host.conf
 order hosts,bind
 multi on
vi /etc/hosts
 1.1.1.1 gate.devin.com gate
vi /etc/resolv.conf
 nameserver 202.96.20.5
 search localdomain

重新启动service的另外方法:
/etc/rc.d/init.d/network restart
 
安装桌面环境:
yum groupinstall -y   "Desktop"   "Desktop Platform"   "Desktop Platform Development"  "Fonts"  "General Purpose Desktop"  "Graphical Administration Tools"  "Graphics Creation Tools"  "Input Methods"  "X Window System"  "Chinese Support [zh]" "Internet Browser"

网卡通过DHCP获取IP:
dhclient eth0

升级系统:
yum -y upgrade
yum卸载命令:
yum -y remove sendmail

yum search php-

查看进程是否存在:
ps -ef | grep LifeKeeper
netstat -ano | grep 5901


格式化硬盘:
首先是我们的能查看到这个硬盘通过fdisk -l 命令 和 df   -h
df -hl

然后通过mkfs.ext3 /dev/sdb1
最后挂在 mount -t ext3 /data
分区命令:
fdisk /dev/hdb

查看当前文件夹大小
du -sh
du -h

Liunx中启动脚本放置:
vi /etc/fstab
vi /etc/fc.local
vi /etc/inittab
echo '/etc/init.d/zabbix_agentd_ctl start &' >>/etc/rc.local
创建快键方式

#ln -s /etc/init.d/zabbix_server_ctl /usr/bin/zabbix_server_ctl
启动Server和Agentd(可以通过start stop restart操作)
#zabbix_agentd_ctl start
#zabbix_server_ctl start


查询CentOs的版本:
lsb_release -a
uanme -a
cat /etc/issue
lsb_release -a


system-config-network

进程检查:
ps -ef | grep
lsof -i | grep rpc

查询网卡速率:
ethtool eth0

Configure是一个可执行脚本,它有很多选项,在待安装的源码路径下使用命令./configure �Chelp输出详细的选项列表。

其中--prefix选项是配置安装的路径,如果不配置该选项,安装后可执行文件默认放在/usr /local/bin,库文件默认放在/usr/local/lib,配置文件默认放在/usr/local/etc,其它的资源文件放在/usr /local/share,比较凌乱

修改hostname:
vi /etc/sysconfig/network
init 6

Host 连接:
vi /etc/hosts.allow

SQL service:
service mysqld start

shell> mysqladmin -u root password "newpwd"
mysqladmin -u用户名 -p旧密码 password 新密码


解压命令:
tar -jxvf msmtp-1.4.31.tar.bz2

关闭selinux:
setenforce 0
vi /etc/selinux/config(也有人说是/etc/sysconfig/selinux文件,其实两个之间是链接关系,随便改其中一个,另一个也改了)
SELINUX=disable 禁用SeLinux
SELINUX=enforcing 启用SeLinux

将用户加入组:
useradd -g lingdao lingdao

linux下的service的目录:
cd /etc/init.d/

zabbix 删除客户端的服务:
zabbix_agentd.exe -d

配置Linux LAMP环境:
https://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-centos-6.2-lamp
https://www.howtoforge.com/apache_php_mysql_on_centos_7_lamp
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-centos-7


查询服务的状态:
lostat :10051


你可能感兴趣的:(linux,common,summary,commonds)