linux小结

本来是记在本地txt文档中,想想还是放这里比较安全,不会丢失,故贴上,没任何技术含量,只是常用到的一些指令而已。

一、

1、NFS服务
sudo apt-get install nfs-kernel-server portmap
配置文件
/work/nfs_root *(rw,sync,no_root_squash)
重启服务
sudo /etc/init.d/nfs-kernel-server restart

2、 编译含义
2.1 预处理

3、vi
nG 光标移至第n行的行首
:n 光标移至第n行的行首
0  光标移至当前行首
$  光标移至当前行尾
n+ 光标下移n行
n- 光标上移n行
ndd 删除当前行起n行
/ 向下搜索
? 向上搜索

4、grep
例:在内核目录下查找包含“request_irq”字样的文件。
#cd /home/shengdn/project/31_system/linux-3.0.y/
#grep "request_irq" kernel/ -R
kernel/表示在当前目录的kernel子目录下查找;
-R表示递归查找它的所有子目录
#grep "request_irq" * -R

5、find
例:在内核目录下查找文件名中包含“fb”字样的文件
#cd /home/shengdn/project/31_system/linux-3.0.y/
#find -name "*fb*"
或者
#find drivers/net/ -name "*fb*"


二、

一、ssh-server相关
1、ubuntu下安装ssh-server服务(开通外网的情况下)
 sudo apt-get install openssh-server
2、确认sshserver是否启动
 ps -e | grep ssh
 如果存在ssh-agent和sshd说明ssh-server已经开启成功
3、关闭ssh-server服务
 sudo /etc/init.d/ssh stop
4、开启ssh-server服务
 sudo /etc/init.d/ssh start
5、ssh配置文件
 /etc/ssh/sshd_config

二、NFS相关
1、配置文件
 /etc/exports
2、相关配置参数
 /root/Documents/hi3531/mpp *(rw,sync,no_root_squash)
 /root/Documents/hi3531/mpp 为主机目录
 *      为客户端机器IP范围
 (rw,sync,no_root_squash)   为客户端机器对NFS服务器的权限
3、注意IP范围与权限之间没有空格,所有字符必须为英文
4、NFS服务器重启
 /etc/init.d/nfs-kernel-server restart
5、挂载
 mount -o nolock 10.16.1.234:/home/share/shengdn/app/ /lib/
   传输大文件时
 mount -t nfs -o intr,nolock,rsize=1024,wsize=1024 10.16.1.119:/home/tom/Documents /home/vmw
6、解除挂载
 umount /home/vmw

三、同时运行多个程序
如果您有一个命令将占用很多时间,您想把它放入后台运行,也很简单。只要在命令运行时按下ctrl-z,它就会停止。然后键入 bg 使其转入后台。fg 命令可使其转回前台。
常用任务管理命令
1、# jobs      //查看任务,返回任务编号n和进程号
2、# bg  %n    //将编号为n的任务转后台运行
3、# fg  %n    //将编号为n的任务转前台运行
4、# ctrl+z    //挂起当前任务
5、# ctrl+c    //结束当前任务

四、设置IP地址
ifconfig eth0 10.16.1.119 netmask 255.255.255.0
route add default gw 默认网关


insmod xxxxx.ko check_crc_enable=0

五、

六、

七、上电启动
/etc/init.d/rcs里面添加/home/dvslink &    加在rcs最后面

八、3518   arm-hisiv100nptl-linux-
    3531   arm-hisiv200-linux-

九、date  -d  10/17/2008      date  -s  10:12:13

十、could not read symbols: File in wrong format
这是linux系统未装libtool导致的,因此一定要安装libtool

十一、Linux链接文件
ln -s abc cde 建立abc 的软连接
ln abc cde 建立abc的硬连接,

十二、C程序里调用系统指令
 char cmd[128];
 sprintf(cmd,"/etc/init.d/network restart");
 system(cmd);

十三、dos2unix


十四、库
.库文件是如何产生的在linux下
静态库的后缀是.a,它的产生分两步
Step 1.由源文件编译生成一堆.o,每个.o里都包含这个编译单元的符号表
Step 2.ar命令将很多.o转换成.a,成文静态库
动态库的后缀是.so,它由gcc加特定参数编译产生。
例如:
$ gcc -fPIC -c *.c $ gcc -shared -Wl,-soname, libfoo.so.1 -o libfoo.so.1.0 *.

DYNAMIC_SONAME = $(DYNAMIC_LINKNAME).$(word 1, $(VERSION))
STATIC_LIBNAME =  lib$(LIB_NAME).a
ORTSP_OBJECTS = xmlmgr.o xmlmgr_handler.o xmlmgr_parsing.o xmlmgr_xsd.o xmlmgr_writer.o

$(CC) -shared -Wl,-soname,$(DYNAMIC_SONAME) -o $(DYNAMIC_LIBNAME) $(ORTSP_OBJECTS)
$(AR) r $(STATIC_LIBNAME) $(ORTSP_OBJECTS)

十五、文件系统(注意长指令参数之间的空格)

tftp 0x82000000 romfs.cramfs ;sf probe 0;sf erase 0x600000 0x400000 ;sf write 0x82000000 0x600000 0x400000

cp /home/tom/Documents/hi3531/rootfs_glibc/hitoe/ ../images/romfs/ -a   (网络驱动放到文件系统里)

grep stmmac /home/tom/Documents/hi3531/rootfs_glibc/ -R(搜索内容)

十六、模块操作
加载、查看、卸载模块:
# insmod hello.ko //加载hello.ko模块
# lsmod //查看当前加载模块
# rmmod hello //卸载模块,没有.ko

 

十九、现有u-boot环境变量配置
* * * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
bootcmd - u-boot找kernel
setenv bootcmd 'sf probe 0;sf read 0x82000000 0x1c0000 0x400000;bootm 0x82000000'
* * * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
bootargs - kernel找rootfs
setenv bootargs 'mem=64M console=ttyAMA0,115200 root=/dev/mtdblock4 rootfstype=cramfs mtdparts=hi_sfc:512K(fastboot),256K(bootargs),1M(logo),4M(kernel),4M(romfs),2M(user),3M(web),512K(vendor),768K(config);hinand:100M(rootfs)'
* * * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

二十、romfs目录
mount -t cramfs /dev/mtdblock5 /mnt/user
mount -t cramfs /dev/mtdblock6 /mnt/web
mount -t cramfs /dev/mtdblock2 /mnt/logo
mount -t cramfs /dev/mtdblock7 /mnt/vendor
#mount -t cramfs /dev/mtdblock7 /mnt/player
mount -t jffs2  /dev/mtdblock8 /mnt/config  -o sync

mount -t ramfs /dev/ram /var

mkdir /var/run
mkdir -p /mnt/config/log
mkdir -p /mnt/config/ppp
insmod /hitoe/stmmac.ko

二十一、strip
arm-hisiv100nptl-linux-strip

二十二、tar
解压:$ tar zxvf FileName.tar.gz
压缩:$ tar zcvf FileName.tar.gz DirName


二十三、SVN
svn://10.16.1.59/SDI

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值