cenos之文件
来源:互联网 发布:windows 10 无法开机 编辑:程序博客网 时间:2024/06/05 20:34
1:vim编写文件并保存
进入cenos7后,右键,打开Terminal,输入 su ,回车,进入root用户,【root@localhost conf】#,输入yum -y install vim
成功安装后,输入vim进入vim编辑器【正常模式】。进入后,点击电脑上的"insert"键【进入编辑模式】,才可输入内容,否则,你在键盘上的输入是无效的。输入完内容 后,点击键盘上的Esc键,又重新回到正常模式,输入:,进入命令模式,现在要保存已写好的文本,输入 w test1【test1为自己给要保存文件的命名,可随意命名】,输入q,则退出vim.
如果要查看刚刚自己写的文件,输入 cat test1,即可以看到了,如果要对文件进行修改,输入vim test1【test1为文件名】,修改完后,在:后输入write,点击回车,即保存完成。【还有另一种方式,退出vim后,输入cat test3(test3是不存的),进入后可编辑,最后直接输入wq,同时完成了,写,和退出,在输入cat test3,也是可以查看自己在test3中编辑的文章的】【当然,如果我们编辑后,不想保存的话,可在进入编辑模式后【按键盘上的insert建】,输入q! 表示直接退出】
【如果想退出root权限用户,可按Ctrl+D键,即可退出到你登入的用户[helloword@localhost Desktop]$ 】
2:查看文件中的内容:
3:jiang一个文件中的内容复制到另一个中?
eg:复制 usr/test04中的内容到usr/test05:
:vim usr/test05【打开test05】---》进入命令模式:r!cat usr/test04,保存并退出,完成了把test04的内容复制到test05.
4:创建一个目录:
[root@localhost Desktop]# mkdir usrou //会在桌面生成一个usrou的文件夹
[root@localhost Desktop]# mkdir usrou/file //会在usrou下生成file文件夹
5:查看目录下文件
[root@localhost Desktop]# ls usr //会输出usr目录下的所有文件,同理,ls usr/bin/ 会输出usr/bin下的所有文件。
46echo:显示输入的文本内容
5:查看文件路径:
[ouyang@localhost Desktop]$ find $PWD -name "shell01.sh" 【“”的shell01.sh为自己的文件名】
7:移动文件位置
8更改文件名:mv oldfilename newfilename
【root@localhost Desktop】echo -e "\e[1;31m This is red word\e[0m" 【注:-e 与 “”之间有空格,否则没有效果出现;2:引号内部后面的[0m:代表颜色作用行数,0一样,1就有两行,........】
[helloword@localhost Desktop]$ echo -e "\e[3;31mThis is what color\e[0m"
This is what color
[helloword@localhost Desktop]$ echo -e "\e[13;31mThis is what color\e[0m"
This is what color
[helloword@localhost Desktop]$ echo -e "\e[13;31mThis is what color\e[2m"
This is what color
[helloword@localhost Desktop]$ echo -e "\e[13;31mThis is what color\e[0m"
This is what color
[helloword@localhost Desktop]$ echo -e "\e[13;31mThis is what color\e[0m"
This is what color
[helloword@localhost Desktop]$ echo -e "\e[13;31mThis is what color\e[1m"
This is what color
[helloword@localhost Desktop]$ echo -e "\e[13;31mThis is what color\e[0m"
【优秀博客链接:http://blog.csdn.net/felix_f/article/details/12433171】
echo -n :不要自动换行
[helloword@localhost Desktop]$ echo
[helloword@localhost Desktop]$ echo -n
[helloword@localhost Desktop]$
【优秀博客链接:http://blog.163.com/bobile45@126/blog/static/96061992201391335835172/】
prinf:输出【1:加上\n才会换行】
[helloword@localhost Desktop]$ printf "Hello,word\n"
Hello.word
【1:注意观察,应该不难理解】
the first program printd'ouyang,fang'
[helloword@localhost Desktop]$ printf "the first program printd'%d+%d=%d'\n" 1 2 3
the first program printd'1+2=3'
- cenos之文件
- cenos
- cenos记录
- cenos 防火墙
- 在cenOS下安装apache出现-bash: /etc/init.d/httpd: 没有那个文件或目录
- 在cenOS下安装apache出现-bash: /etc/init.d/httpd: 没有那个文件或目录
- 在cenOS下安装apache出现-bash: /etc/init.d/httpd: 没有那个文件或目录
- 在cenOS下安装apache出现-bash: /etc/init.d/httpd: 没有那个文件或目录【转载】
- CenOS 下安装OpenVPN
- cenOs vsftp配置
- cenos 安装openvas
- CenOS内核编译
- CenOS U盘安装
- CenOS下安装jdk
- CenOS 安装ssh服务
- cenos oracle11g 安装
- CenOS 6.5 + Win7 安装
- cenos 端口开放设置
- HDU 6242/2017CCPC哈尔滨 Geometry Problem 【随机化+计算几何】
- 用图说什么是爬虫
- C++:三羊献瑞
- 类方法和实例方法
- centos7安装mysql
- cenos之文件
- logging 日志的学习
- 关于跳马
- 编程练习(3)
- 关于Java的一些很小很小的知识
- 辗转相除法最简单最通俗证明
- img 图片下方2px缝隙解决方法
- python安装小结
- ros学习笔记--rviz的常见问题