linux上使用vi时常用的命令
1、简单的查找并替换为新的字符串
:%s/查找的字符串/新的字符串/g
eg:查找“liliang” 并将其替换为“liangli”
:%s/liliang/liangli/g
其中“\”为转义符
eg:查找“li/liang” 并将其替换为“liliang”(即把被查找字符串中的斜杠去掉)
:%s/li\/liang/liliang/g
2、查找命令
顺序查找字符串
/字符串
逆序查找字符串
?字符串
n 按第一、二命令的顺序继续查找下一个字符串
N 按第一、二命令的相反的顺序继续查找下一个字符串
3、行号
添加行号
:set number (:set nu)
不显示行号
:set nonumber (:set nonu)
4、光标移动
将光标移动到指定的行数
:行数
将光标移动到文本的开始处
gg
将光标移动到文本的末尾
G (我习惯shift + g)
5、每个字符的使用说明(从其他地方拷贝过来的,有些没验证,红色是我经常用到的)
a 在当前位置之后添加
A 在当前行的末尾添加
^a 没有使用
b 上一个单词的开头
B 上一个单词的开头,忽略标点符号
^b 上移一屏
c 覆盖...
C 覆盖到行末尾
^c 终止插入模式,在命令模式没有用
d 删除... 后面跟其它键,非常有用
D 删除到行末尾
^d 下移半屏,如果在插入模式下则移到上一个移动宽度(ShiftTab)处
相关文档:
add user:
[root@localhost ~]# useradd test
[root@localhost ~]# passwd test
add user to a group:
e.g. add nexus to admin
useradd -g admin nexus
default role:
[root@localhost ~]# useradd -D
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=no
de ......
1、升级系统
yum check-update
yum update
2、安装一些常用的工具
yum install ntp iptraf sysstat screen subversion wget bzip2 nfs-utils vim-common
3、设置每天自动核准时间
# crontab -e
0 * * * * /usr/sbin/ntpdate 210.72.145.44
:wq
4、安装一些开发包
# yum install make gcc gcc-c++ libjpeg-devel ......
// Linux Device Driver Template/Skeleton with mmap
// Kernel Module
#include <linux/module.h>
#include <linux/init.h>
#include <linux/version.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#inclu ......
一、登陆
1.进入linux
2.用户名: root
3.口令:123456
4.mysql 用户名 root 密码 123456
二、启动mysql与apache服务
1.启动mysq数据库:/usr/local/mysql/bin/./mysqld_safe --user=mysql &
2.停止mysql数据库:/usr/local/mysql/bin/mysqladmin -u root -p shutdown
3.启动apache: /usr/local/apache2/bin/./ap ......
本来想用 kernel-module-ntfs-2.6.18-53.el5-2.1.27-0.rr.10.11.i686这种格式的包,但发现系统内核 2.6.18-164.2.1.el5.plus
根本找不到对应的文件,所以只好使用 ntfs-3g.
安装很简单,直接从http://www.ntfs-3g.org/index.html 下载最新的文件,
#wget http://www.ntfs-3g.org/ntfs-3g-2009.4.4.tgz
# ......