linux+小技巧

route add default gw 192.168.0.1
查找未关闭句柄
lsof | grep app|wc -l
 
./configure --disable-lua --disable-mad --disable-avcodec --disable-swscale
 
拷贝文件到远程
scp vsp_client.arm.elf [email protected]:/work/vsp_client.arm.elf
 
远程命令操作
ssh [email protected] ls /work
 
重启系统
shutdown -r -t 0 now
shutdown -h -t 0 now
查看进程
ps -ef | grep StreamMG
ps -mC testnum /* 查看进程线程数 */
UTC转CST时间
cp -rf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
重启网络服务的命令是service network restart
或者/etc/init.d/network restart
重启smb
service sma restart
/etc/init.d/samba start
ldconfig命令详细介绍 动态链接库管理命令
要是在默认搜寻目录(/lib和/usr/lib)以及动态库配置文件/etc/ld.so.conf内所列的目录下,搜索出可共享的动态链接库(格式如前介绍,lib*.so*),进而创建出动态装入程序(ld.so)所需的连接和缓存文件.缓存文件默认为/etc/ld.so.cache,此文件保存已排好序的动态链接库名字列表.
linux下抓包命令
tcpdump -c 20 src 192.168.0.126
 
 
ldd **.so /*查询so文件依赖的库*/
 
mn *.a|grep ** /* 查找.a中的接口 */
 
ifconfig -a /* 增加网络接口 */
ifconfig eth0 auto
dhclient eht0
 
grep -r "**" ./  查询当前目录下所有文件中是否包含有"**"
 
find . -name *.sh |xargx grep "**"   查询所有的 包含字符串"**"的*.sh 文件
 
cat /proc/partitions  查找挂载的块设备
lsusb 查找usb设备
 
 
lsof |grep xxx.so找出pid,
 
pmap -x pid /*  查询运行文件依赖的库加载地址 */
 
nm **.so /* 查询so文件的接口 */
 
   
如果加载so时某个函数找不着的定位方法
1.nm **.so >tyb.txt
2.vi tyb.txt
  搜索找不到的字符串,找到地址
3.mn -C -D **.so|grep 上一步找到的地址
  找到对应的函数
 
    
    
    
    
  • ldd TestCppProgram (Shows you where your program is getting it's libraries from. An early-on careful inspection of this would've quickly let me to my problem!)
  • ldd -d -r TestCppProgram (Shows you any undefined symbols. There shouldn't be any undefined symbols for an executable, but there will be for a shared lib if it depends on another shared lib. Somebody please correct me if I'm wrong)
  • nm TestCppProgram | c++filt (displays unmangled symbol information)
  • nm TestCppProgram (Displays mangled symbol information. Ie: You should be able to find stuff like ZN12CppProgramC1Ev in here. In my problem above, I found which line number the undefined symbol in question was on, and then looked it up in the unmangled version to see what function it was trying to resolve. It let me know, but it didn't really help me find out what my problem was.)
  • readelf -d TestCppProgram (Shows library dependencies. similar to ldd.)

    你可能感兴趣的:(linux,function,service,NetWork,library)