:14,16s/this/that/g 从第14行到16行的this替换成that
:%s/this/that/gc 检查访问模式替换
查看时间
date
date +%F 查看当前时间
date +%F --date="1 days ago"
date +%F --date="1 day ago"
date +%F --date="1 day"
date +%F --date="1 days"
设置时间
date -s 2014-07-14设置当前时间
//date -s 2014/07/14
date -s 11:40
clock -wwrite同步时间
查看当前命令的历史
history
history -w 保存当前操作的历史命令
//~/.bash_history
history -c 清除当前操作的历史记录
查看当前系统支持的语言
locale
locale -a 查看所有
locale -a | grep zh 查看支持中文件格式
//管道过滤
cat txt | grep hello 查看txt这个文件里面带有hello这个单词的行
linux系统运行级别run level
0 关机
1 单用户模式,没有网络,没有服务,主动获得root权限
2 多用户模式,有服务,没有网络
3多用户模式,有服务,有网络,服务器模式
4保留
5图形界面,x11
6重启
配置角本
/etc/inittab
id:5:initdefault
init 0
shutdown -r +1010分钟后重启
![]()
shutdown -h now 现在关机
halt 也是关机
halt -p -f 强制关机,直接掉电
reboot 重启
init 6
init + runlevel
ctrl + F2-F7 进入字符界面
stdin stdout stderr
标准输入标准输出标准出错
0 1 2
重定向
默认情况下是标准输出重定向清空该文件
echo "hello world" > txt 如果txt不存在,将会被创建
标准出错重定向
echo "hello world" 2> txt
(ls && fjdkslf) 2> txt 只把标准出错重定向
把标准出错和标准输出都重定向
(ls && fjdksfj) &> txt
追加
echo "hello world " >> txt 不会清空该文件
错误追加
(ls && fdkfjdk) 2>> txt
(ls && fdkfdjf) &>> txt
网络配置
192.168.110.254
//网段网络ip
IP 网络IP
网关路由器--》交换机 没有外网转发功能
子网掩码255.255.255.0 如果255固定,0可变
DNS解析把域名转成具体的服务器IP
如何查看本地有无网卡
ping 127.0.0.1
ping得通证明有网卡,如果ping不通,证明没有网卡
查看网线有没有连接
mii-tool eth0 (网卡接口名字)eth0 eth1
[root@upl ~]# mii-tool eth1
eth1: negotiated 100baseTx-FD, link ok
//no link
关掉网络管理后台进程
service NetworkManager stop // restart start
配置主机IP
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/bofangqi/article-71751-3.html
我们不针对美国