杂记连载之Linux开发命令(续)


free命令查看系统内存使用情况。

top -- displaylinux tasks.

在进程挂掉或系统不稳定等情况下常使用。

 

ranlib命令 -- 生成索引以加快对文件的访问 ranlib file.只有-v -h参数

you may use nm-s to list this index.

an archive withsuch an index speeds up linking to the library and allows routines in thelibrary to call each other without regard to their placement in the archive.

在打包静态库文件时常使用。

 

$make2>&1 | tee xxx.log

编译并保存打印信息。shell中定义0表示标准输入,1表示标准输出,2表示标准出错信息输出。2>&1表示把2设备信息重定向到1设备,tee是创建文件并保存信息的工具。

tee -- copystandard input to a file, and also to standard output.

 

time - time asimple command or give resource usage

The  time command runs the specified programcommand with the given arguments.  Whencommand finishes, time writes a message to standard output giving timingstatistics about this program run.

可以使用time命令检测程序的执行效率问题。

 

printk保存在/var/log/messages

dmesg --print orcontrol the kernel ring buffer

显示开机信息。kernel会将开机信息存储在ring buffer中。开机信息亦保存在/var/log目录中名称为dmesg的文件里。

在驱动程序中添加打印信息,在系统加载驱动时就可使用dmesg测试系统是否正确加载驱动。

使用dmesg查看最后几行

dmesg |tail -n x

dmesg –n 8 可将所有级别的信息打印出来

 

killall -9process

9是一个信号代码,用来结束一个进程。

HUP信号,一般来说程序在收到这个信号后都会去重新读取配置信息。你可以发一个HUP消息给进程,再很多进程中,收到HUP消息就表示要求进程重新读取配置。

使用kill发HUP命令给进程,假设进程号为n:

kill -HUP n

可以使用kill及killall命令测试程序的信号处理能力。

 

取消网络接口的静态ip地址

ifconfig eth00.0.0.0

路由表项的操作(对象为静态路由表项,Linux-2.2之后的内核中维护多张路由表)

route add -net192.168.1.0 netmask 255.255.255.0 dev eth1

route del -net192.168.1.0 netmask 255.255.255.0 dev eth1

route deldefault netmask 0.0.0.0 dev xxx


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值