文章分类 -  linux

linux
摘要:1、ifconfig -a如果只显示eth0的网络配置,则命令如下: ifconfig eth0如果想显示eth0的IP地址:ifconfig eth0 | grep "inet addr | awk -F[:" "] + '{print $4}'2、ping用于检查网络上某台主机是否为活动状态或是否发生故障。ping -c 5 www.163.com通常关心ping通时间和有无丢失包。3、netstatnetstat 命令的功能是显示网络连接、路由表和网络接口的信息,可以让用户得知目前都有哪些网络连接正常在运作。参数:-A:显示任何关联的协议控制 阅读全文
posted @ 2013-08-18 15:15 haiwei.sun 阅读(508) 评论(0) 推荐(0)
摘要:1、手动修改配置网卡文件 首先检查网卡是否正常安装:lspci | grep Ether dmesg | grep error vi /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0 #表示设定网卡的名称,它要跟文件名称对应。BOOTPROTO=none #是否启动时IP取得的协议,这里是固定的(此值也可以为static),如果是动态主机的话,要改成dhcpHWADDR=00:14:22:1B:71:20 #网卡的mac地址,可以用ifconfig来取值。IPV6INIT=yes #表示支持IPv6,no表示不支持IPV6_AUTOCON 阅读全文
posted @ 2013-08-18 13:35 haiwei.sun 阅读(147) 评论(0) 推荐(0)
摘要:lsb_release -a如果centos没有此命令、可以通过 yum -y install redhat-lsb来安装。查看系统已载入的相关模块:lsmod | grep ip_vs在Linux下查找PCI设置lspci | grep Ether 阅读全文
posted @ 2013-08-18 13:15 haiwei.sun 阅读(125) 评论(0) 推荐(0)
摘要:查看系统内核主要时为了掌握其版本号,为安装LVS等软件做准备,可以用命令 uname -a 来查看。简化的参数命令为:uname -r如果要查看系统时32位的还是64位的,可以用如下命令:ls -1F / | grep /$此命令会查找是否有 /lib64的目录,有则系统为64位,无则表示系统为32位。大家记住,64位的CPU系统构架可以安装32位或64位的系统,而32位的CPU构架只能安装32位的系统。另一种常见方法时通过file命令来判断系统中的文件是32位还是64位的,以此作为判断系统的依据:file /sbin/init 阅读全文
posted @ 2013-08-18 13:03 haiwei.sun 阅读(440) 评论(1) 推荐(0)
摘要:vmstat是一个相当全面的性能分析工具,可以观察到系统的进程状态、内存使用情况、虚拟内存的使用情况、磁盘的I/O、中断、上下问切换、CPU的使用情况等性能信息。vmstat 1 4其中:Procs r:等待运行的进程数 b:处在非中断睡眠状态的进程数 w:被交换出去的可运行的进程数。-------------------Memoryswpd:虚拟内存使用情况(单位:kb)free:空闲的内存(单位:kb)buff:用作缓存的内存数(单位:kb)-------------------Swapsi:从磁盘交换到内存的交换页数量(单位:kb/秒)so:从内存交换到磁盘的交换页数量(单位:kb/秒) 阅读全文
posted @ 2013-08-18 12:56 haiwei.sun 阅读(181) 评论(0) 推荐(0)
摘要:1、平均负载的概念有时候觉得系统响应很慢,胆识又找不到原因,这时就要查平均负载了,看它是否有大量的进程在排队等待。特定时间间隔内运行队列中的平均进程数可以反映系统的繁忙程度,所以我们通常会在自己的网站或系统变慢时第一时间查系统的负载,即CPU的平均负载。2、查看平均负载uptimewtop 阅读全文
posted @ 2013-08-18 12:36 haiwei.sun 阅读(96) 评论(0) 推荐(0)
摘要:用dd命令可以把指定的输入文件复制到指定的输出文件中,并且在复制过程中可以进行格式转换。1、复制交换文件的时候:dd if=/dev/zero of=/swapfile bs=1024 count=655362、制作驱动盘的时候,如,将硬盘上的驱动文件复制到一个软驱中:dd if=rhel40.img of=/dev/fd0 bs=10k或者dd if=mptlinux-3.02.68-1-rhel4.i686.dd of=/dev/fd0 bs=10k3、制作ISO镜像的时候dd if=/dev/cdrom of=/root/cd1.isodd参数说明:if=file 输入文件名,默认为标准 阅读全文
posted @ 2013-08-18 12:24 haiwei.sun 阅读(212) 评论(0) 推荐(0)
摘要:命令:du -sh 目录名来查看,如下du -sh /root命令显示结果为:1.2M /root检查是否有分区使用率use%过高,如发现某个分区空间接近用完,可以进入该分区的挂载点,用以下命令找出占用空间最多的文件或目录,然后按照从大到小的顺序,正好可以找出系统中占用最多空间的前十个文件或目录:du -cks * | sort -rn | head -n 10 阅读全文
posted @ 2013-08-18 12:12 haiwei.sun 阅读(168) 评论(0) 推荐(0)
摘要:1)查看硬盘及分区信息,如下:fdisk -l2)检查文件系统的磁盘空间占用情况,如下df -h3)查看硬盘的I/O性能:如下iostat -d -x - k 1 10其中,iostat是含在套装sysstat中的,在centos下可以用命令 yum -y install sysstat来安装,通过如下命令查看iostat的返回结果,以我的生产环境下的MySql数据库为例说明:iostat -d -x -k 1 5 阅读全文
posted @ 2013-08-18 12:04 haiwei.sun 阅读(1140) 评论(0) 推荐(0)
摘要:命令:free -m此命令只在Linux下有效,在FreeBSD中没有此命令。total:内存总数used:已经使用的内存数free:空闲的内存数shared:多个进程共享的内存总额-buffers/cache:(已用)的内存数,即 used-buffers-cached+buffers/cache:(可用)的内存数,即 free+buffers+cached结论:可用内存=free + buffers + cached 阅读全文
posted @ 2013-08-18 11:56 haiwei.sun 阅读(125) 评论(0) 推荐(0)
摘要:具有相同core id的CPU是同一个core的超线程。 Any cpu with the same core id are hyper-threads in the same core.具有相同physical id的cpu是同一个CPU封装的线程或核心。Any cpu with the same physical id are threads or cores in the same physical socket.物理CPU个数如下所示:cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l每个物理CP 阅读全文
posted @ 2013-08-18 11:24 haiwei.sun 阅读(270) 评论(0) 推荐(0)
摘要:http://prodigyu.com/301安装所需组件yum list | grep libpyum install libp*wget ftp://ftp.lmd.ens.fr/pub/devil/devel/sources/1.2/libpcap-0.9.8.tar.gz安装iftopwget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gztar zxvf iftop-0.17.tar.gzcd iftop-0.17./configuremakemake install安装完后使用命令iftop -i eth 阅读全文
posted @ 2012-03-06 16:08 haiwei.sun 阅读(910) 评论(0) 推荐(0)
摘要:转自:http://www.centos.bz/2011/07/php-cron-job-linux-crontab/PHP计划任务:如何使用Linux的Crontab执行PHP脚本发表于225 天前 ⁄ FAQ ⁄ 评论数 5文章目录[隐藏]一、在Crontab中使用PHP执行脚本二、在Crontab中使用URL执行脚本我们的PHP程序有时候需要定时执行,我们可以使用ignore_user_abort函数或是在页面放置js让用户帮我们实现。但这两种方法都不太可靠,不稳定。我们可以借助Linux的Crontab工具来稳定可靠地触发PHP执行任务。 下面介绍Crontab的两种方法。一、在C.. 阅读全文
posted @ 2012-03-05 13:47 haiwei.sun 阅读(839) 评论(0) 推荐(0)
摘要:关闭SELinux的方法: 修改/etc/selinux/config文件中的SELINUX="" 为 disabled ,然后重启。 如果不想重启系统,使用命令setenforce 0/etc/init.d/network restart 注: setenforce 1 设置SELinux 成为enforcing模式 setenforce 0 设置SELinux 成为permissive模式 在lilo或者grub的启动参数中增加:selinux=0,也可以关闭selinux#------------------------------------------------ 阅读全文
posted @ 2012-02-09 13:33 haiwei.sun 阅读(2367) 评论(0) 推荐(0)
摘要:http://blog.sina.com.cn/s/blog_44c831df0100lfyp.html今天安装Apache到/usr/local目录下,安装之后不能启动服务,提示未识别的服务,找了找方法记录下:vi /etc/rc.d/rc.local增加:/usr/local/httpd/bin/apachectl start注册为Servicecp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpdvi httpd找到:#!/bin/sh另起一行,增加:# chkconfig: 345 70 30# description: Apa 阅读全文
posted @ 2011-12-30 13:56 haiwei.sun 阅读(2989) 评论(0) 推荐(1)
摘要:# CentOS-Media.repo## This repo is used to mount the default locations for a CDROM / DVD on# CentOS-6. You can use this repo and yum to install items directly off the# DVD ISO that we release.## To use this repo, put in your DVD and use it with the other repos too:# yum --enablerepo=c6-media [co... 阅读全文
posted @ 2011-12-29 11:17 haiwei.sun 阅读(2207) 评论(0) 推荐(0)
摘要:# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client. You should use this for CentOS updates# unless you are manually picking other mirrors.## If the mirr. 阅读全文
posted @ 2011-12-29 11:15 haiwei.sun 阅读(2256) 评论(0) 推荐(0)
摘要:中科大(http://centos.ustc.edu.cn/)的镜像站里面有Centos 6.0 镜像了。先备份一下/etc/yum.repos.d/CentOS-Base.repo#mv /etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.bak然后把/etc/yum.repos.d/CentOS-Base.repo文件改为# CentOS-Base.repo # # This file uses a new mirrorlist system developed by Lance Davis for Cent 阅读全文
posted @ 2011-12-29 11:13 haiwei.sun 阅读(2285) 评论(0) 推荐(0)
摘要:端口是由某些程序所启动的,所以要关闭某些端口时,可直接将某个程序关闭。关闭时可以使用kill命令。不过,毕竟不是正常的解决之道,因为kill指令通常具有强制关闭某些程序的功能,若想正常关闭该程序,可利用系统提供的scripts来关闭。1、stand alone 与 Super daemon 是直接执行该服务的执行文件,让该执行文件直接加载到内存中运行,用这种方式来启动可以让该服务具有快速响应的优点。一般来说,用这种服务启动scripts都会放置到/etc/init.d/目录下,所以通常可以使用/etc/init.d/sshd restart之类的方式来启动这种服务。2、Super daemon 阅读全文
posted @ 2011-12-26 20:44 haiwei.sun 阅读(350) 评论(0) 推荐(0)
摘要:1、列出在监听的网络服务 netstat -tunl2、列出已连接的网络联机状态 netstat -tun3、删除已建立或在监听中的连接 netstat -tunp kill -9 13247(PID) 阅读全文
posted @ 2011-12-26 20:23 haiwei.sun 阅读(199) 评论(0) 推荐(0)

返回顶部