标签:log 中间 idc == rgs lis 输入 ida logs
[root@oldboyedu-40 /]# mkdir /data
[root@oldboyedu-40 /]# ls
bin dev lib media proc selinux tmp
boot etc lib64 mnt root srv usr
data home lost+found opt sbin sys var
touch /data/oldboy.txt [root@oldboyedu-40 /]# cd /data 切换到/data目录 [root@oldboyedu-40 data]# touch oldboy.txt 在/data目录下创建oldboy.txt文件 [root@oldboyedu-40 data]# ls 查看 oldboy.txt
vi/vim 快速到最后一行的快捷键 G
在当前行下面插入一个空行 并进入到编辑模式
[root@oldboyedu-40 data]# vi oldboy.txt 编辑/data下的oldboy.txt文件 I am studying linux 按小写字母I进入编辑模式,编写完成后 ~ 按esc键输入:wq 保存并退出 ~ "oldboy.txt" 1L, 20C written [root@oldboyedu-40 data]# cat oldboy.txt I am studying linux
方法2
[root@oldboyedu-40 ~]# echo oldboyedu oldboyedu [root@oldboyedu-40 ~]# echo oldboyedu >>/data/oldboy.txt [root@oldboyedu-40 ~]# [root@oldboyedu-40 ~]# cat /data/oldboy.txt I am studying linux. oldboyedu [root@oldboyedu-40 ~]# ##追加===把内容文字放到文件的末尾 [root@oldboyedu-40 ~]# echo lidao.blog >>/data/oldboy.txt [root@oldboyedu-40 ~]# cat /data/oldboy.txt I am studying linux. oldboyedu lidao.blog
方法3(了解) -向一个文件中追加多行
cat >>/data/oldboy.txt<<EOF I am oldboy teacher. EOF
[root@oldboyedu-40 data]# cp oldboy.txt /tmp 注意是在/data目录下操作的命令 [root@oldboyedu-40 data]# ls 查看/data下是否还存在oldboy.txt文件 oldboy.txt [root@oldboyedu-40 data]# cd /tmp 切换到/tmp目录 [root@oldboyedu-40 tmp]# ls oldboy.txt test.txt yum.log
[root@oldboyedu-40 /]# mv /data /root [root@oldboyedu-40 /]# ls bin dev home lib64 media opt root selinux boot etc lib lost+found mnt proc sbin srv [root@oldboyedu-40 /]# cd /root [root@oldboyedu-40 ~]# ls anaconda-ks.cfg data install.log install.log.syslog
[root@oldboyedu-40 /]# cd /root 进入到/root目录 [root@oldboyedu-40 ~]# ls 查看/root目录下的文件 anaconda-ks.cfg data install.log install.log.syslog [root@oldboyedu-40 ~]# cd /root/data/ 进入到/root目录下的/data目录 [root@oldboyedu-40 data]# rm oldboy.txt 在/data目录下删除oldboy.txt文件 rm: remove regular file `oldboy.txt‘? y 是否删除文件oldboy.txt 按y 是 [root@oldboyedu-40 data]# ls 查看/data目录下的文件
退出到上一级目录: cd ..
[root@oldboyedu-40 data]# cd /root/ 切换到/root目录 也可以使用 cd .. [root@oldboyedu-40 ~]# ls anaconda-ks.cfg data install.log install.log.syslog [root@oldboyedu-40 ~]# rm -fr /root/data 强制删除/root下的data目录 [root@oldboyedu-40 ~]# ls anaconda-ks.cfg install.log install.log.syslog
tset
liyao
oldboy
请给出输出test.txt文件内容时,不包含oldboy字符串的命令。
方法1
[root@oldboyedu-40 /]# grep "old" /data/test.txt oldboy [root@oldboyedu-40 /]# grep -v "old" /data/test.txt test liyao
方法2
[root@oldboyedu-40 /]# head -n2 /data/test.txt test liyao
方法3
[root@oldboyedu-40 /]# sed ‘/oldboy/d‘ /data/test.txt test liyao
方法4
[root@oldboyedu-40 /]# awk ‘/oldboy/‘ /data/test.txt oldboy [root@oldboyedu-40 /]# awk ‘!/oldboy/‘ /data/test.txt test liyao
方法5
[root@oldboyedu-40 /]# awk "NR==1,NR==2" /data/test.txt test liyao
[root@oldboyedu-40 /]# mkdir -p /oldboy/test
方法1
[root@oldboyedu-40 ~]# cp /mnt/test.txt /tmp/ cp: overwrite `/tmp/test.txt‘? y^C [root@oldboyedu-40 ~]# \cp /mnt/test.txt /tmp/
方法2
[root@oldboyedu-40 ~]# which cp alias cp=‘cp -i‘ /bin/cp [root@oldboyedu-40 ~]# /bin/cp /mnt/test.txt /tmp/
方法1
[root@oldboyedu-40 ~]# head -30 ett.txt|tail -11 20 21 22 23 24 25 26 27 28 29 30
方法2
[root@oldboyedu-40 ~]# sed -n ‘20,30p‘ ett.txt 20 21 22 23 24 25 26 27 28 29 30
方法3
[root@oldboyedu-40 ~]# awk ‘NR==20,NR==30‘ ett.txt NR后面跟两个等(=)号 20 21 22 23 24 25 26 27 28 29 30
方法4
[root@oldboyedu-40 ~]# grep -A10 "20" ett.txt 20 21 22 23 24 25 26 27 28 29 30
方法5
[root@oldboyedu-40 ~]# awk ‘NR>=20&&NR<=30‘ ett.txt 20 21 22 23 24 25 26 27 28 29 30
[root@oldboyedu-40 oldboy]# find /oldboy/ -type f -name "*.sh"|xargs cat oldboy oldboy oldboy [root@oldboyedu-40 oldboy]# find /oldboy/ -type f -name "*.sh"|xargs sed ‘s#oldboy#oldgirl#g‘ oldgirl oldgirl oldgirl [root@oldboyedu-40 oldboy]# find /oldboy/ -type f -name "*.sh"|xargs sed -i ‘s#oldboy#oldgirl#g‘ [root@oldboyedu-40 oldboy]# find /oldboy/ -type f -name "*.sh"|xargs cat oldgirl oldgirl oldgirl
本博文中所使用的系统版本为: CentOS release 6.9 (Final) 内核版本为: 2.6.32-696.10.1.el6.x86_64 linux正在持续学习中
标签:log 中间 idc == rgs lis 输入 ida logs
原文地址:http://www.cnblogs.com/dzc-/p/7743978.html