1 抓包
tcpdump port 5060 and host 192.168.1.180
tcpdump -i ethx -w 1.pcap -s 0
2. 查看硬盘使用情况
df ./
3.查看进程的cpu,内存等
top
4.查找含有某字符串的文件
grep -rn "hello,world!" *
查找多个字符串
grep -E 'H|ok'
5.修改日期
date -s "2016-03-23 19:21:00"
6.查询文件的路径
locate tnsnames.ora
7.查看文件大小
ls -lht
8.查看文件夹大小
du -sh *
9.查看进程
ps -ef|grep sip_gw
杀死进程 pkill -9 opensips
10. 进程间复制 粘贴
tcp contains "http" | 显示payload中包含"http"字符串的tcp封包。 |
16 获取linux版本
grep "thermcontact" */*.in
ifdown eth0 停止第一块网卡 ifup eth1 启用第二块网卡 26 预留端口避免占用 sysctl net.ipv4.ip_local_port_range="15000 61000" 27 修改系统 timeout时间 sysctl net.ipv4.tcp_fin_timeout=30 28 网卡没配置好前 查看mac地址 dmesg | grep eth |
vi /etc/iproute2/rt_tables
200 eth0 #add eth0 196.2.9.4
210 eth1 #add eth1 196.2.10.4
215 eth2 #add eth2 196.2.11.4
220 bond0 #add bond0 196.2.15.4
vi /etc/rc.d/rc.local
//此处196.2.10.1为默认网关,故不用配置虚拟地址路由
ip ro add default via 196.2.10.1 dev eth1 proto kernel src 196.2.10.4 table eth1
ip ru add from 196.2.10.4 table eth1
30 mysql 启不来 Starting MySQL..The server quit without updating PID file (/home/mysql/data/localhost.localdomain.pid).
杀掉残存的mysql 进程
31 查看环境变量
echo $JAVA_HOME
32 添加自启动
ubuntu: vi /etc/rc.loal
redhat vi /etc/rc.d/rc.local
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=yourname //在这修改hostname
# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
127.0.0.1 yourname //在这修改hostname
#hostname ***** //*****为修改的hostname
34 替换字符串
%s#abc#def#g(用def替换文件中所有的abc)
35 解决scp ssh 缓慢
scp -o GSSAPIAuthentication=no
36 解决vi 中上下左右按键变为ABCD
apt-get remove vim-common
apt-get install vim
38 安装64位虚拟机虚拟机中点击虚拟机-安装VMware-tools
sudo ./vmware-install.pl
一直按回车
安装完成之后reboot
40 更改语言环境
auto eth0
iface eth0 inet static
address 192.168.3.90
gateway 192.168.3.1
netmask 255.255.255.0
11上登陆,运行
mysql > flush privileges;
mysql > show master status;
12上
mysql > stop slave;
mysql > change master to master_host='196.2.9.11',master_user='slave',master_password='omp@123!',master_log_file='updatelog.000001',master_log_pos=199;
其中:最后两项根据196.2.9.11上运行show master status;结果填写
启动slave
mysql > start slave;
mysql > show slave status\G
48ubuntu下按tab键出现warning: setlocale: LC_CTYPE: cannot change locale (zhCN.UTF-8";)的解决办法
在文件尾部添加一语句:
export LC_ALL=C
然后重启
49 查看静态库/动态库中的函数
linux
nm -g --defined-only libopencv_imgproc.a
nm -D libsubtitle_service.so
windows
dumpbin /exports libxxx.a
50. ubuntu更新源
记得DNS设置为本地电信的DNS,不然apt-get 会超级慢!!
cp/etc/apt/sources.list /etc/apt/sources.list.bak
vi /etc/apt/sources.list
输入
deb http://mirrors.sohu.com/ubuntu/ precise main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ precise-security main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://ppa.launchpad.net/fcwu-tw/ppa/ubuntu YOUR_UBUNTU_VERSION_HERE main
deb-src http://ppa.launchpad.net/fcwu-tw/ppa/ubuntu YOUR_UBUNTU_VERSION_HERE main
51. 安装软件出现问题 pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
apt-get update 一下 再装