码迷,mamicode.com
首页 > 其他好文 > 详细

2018-03-27

时间:2018-03-27 18:53:25      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:Linux命令

一、环境变量PATH
环境变量位置:/etc/profile
临时增加环境变量的目录:
PATH=$PATH:/tmp/

二、cp 命令
cp命令是cp –i 命令的别名
cp /etc/passwd /tmp/1.txt
cp –r /tmp/wang/ /tmp/linux
!$上一条命令的最后一个参数
拷贝目录时,如果目标目录存在,则会将原目录拷贝到目标目录下,若目标目录不存在时,则会按照指定名字命名目标目录。
[root@locher tmp]# cp -r abcd abce
[root@locher tmp]# ls
abcd
abce
ks-script-3Lg3mY
systemd-private-47ddd8faf7bb4c5080a98abf35cfb57e-chronyd.service-ZNYG1x
systemd-private-47ddd8faf7bb4c5080a98abf35cfb57e-vgauthd.service-Gx3uzU
systemd-private-47ddd8faf7bb4c5080a98abf35cfb57e-vmtoolsd.service-BTzvbe
yum.log
三、mv命令
移动 改名字
mv 文件名1 文件名2 改名
目标目录不存在时,相当于改名
[root@locher ~]# mv /tmp/abcd/123/ /tmp/abcd/987
[root@locher ~]# ls /tmp/abcd/
234 987 cde
四、文档查看
cat 查看文件内容
tac 倒序查看文件内容
-a 查看文件中所有字符
-n 显示行号
cat 文件1>>文件2 将文件1追加到文件2中去
more
wc -l查看文件行数
[root@locher ~]# cat /etc/passwd >> anaconda-ks.cfg
[root@locher ~]# wc -l anaconda-ks.cfg
90 anaconda-ks.cfg
[root@locher ~]# cat /etc/passwd >> anaconda-ks.cfg
[root@locher ~]# wc -l anaconda-ks.cfg
109 anaconda-ks.cfg
[root@locher ~]# more anaconda-ks.cfg
空格向后翻,crtl +b 向前看
less:空格向后翻,crtl +b 向前看
crtl + F向后看 支持上下键,按“q”退出
按“/”搜索 “n”继续显示搜索到的内容shift+n 想前看
按“?”搜索,从最后开始搜索和/相反shift +g 末行 g首行
less可以实现more的所有功能
[root@locher ~]# less anaconda-ks.cfg
head
head 文件名 默认查看文件的前十行
head –n 2 指定查看前两行
技术分享图片
tail
tail 文件名 默认查看文件的最后十行
tail –n 2 指定查看后两行
tail -f 查看动态文件
技术分享图片

2018-03-27

标签:Linux命令

原文地址:http://blog.51cto.com/13645684/2091701

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!