系列文章目录

  • 保姆级别 VMware Workstation 16 Pro 最新安装教程
  • VMware 安装CentOS 保姆级别教程
  • 一文学会CentOS 文件常用命令

如果本文对你们的开发之路有所帮助,请帮忙点个赞,您的支持是我坚持写博客的动力

前言

上一文教会了大家CentOS 安装,本文将手把手教大家熟悉CentOS 常用指令

文件 目录操作命令

cd 路径命令

命令 含义
cd /home 移动目录
cd ~ 移动到家目录
cd … 返回上一层目录
cd / 返回根目录
init 5 图形化
init 6 重启

cd /home 移动目录

[root@localhost janyxe]# cd /home/
[root@localhost home]#

cd ~ 移动到家目录

root用户,cd ~ 相当于 cd /root
普通用户,cd ~ 相当于cd /home/当前用户名

root 用户

[root@localhost home]# cd ~
[root@localhost ~]# pwd
/root

普通用户

[root@localhost ~]# su janyxe
[janyxe@localhost root]$ cd ~
[janyxe@localhost ~]$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos
[janyxe@localhost ~]$ pwd
/home/janyxe

cd … 返回上一层目录

[janyxe@localhost ~]$ pwd
/home/janyxe
[janyxe@localhost ~]$ cd ..
[janyxe@localhost home]$ pwd
/home

cd 返回根目录

[janyxe@localhost home]$ cd /
[janyxe@localhost /]$ pwd
/
[janyxe@localhost /]$

ls 显示清单命令

命令 含义
ls /dir 显示文件夹下全部文件
ls -a 显示文件的详情信息,包括显示隐藏文件
ls -l 显示当前目录及所有子目录信息

ls /dir 显示文件夹下全部文件

[janyxe@localhost /]$ ls /home/
janyxe

支持可多路径查看

[janyxe@localhost /]$ pwd
/
[janyxe@localhost /]$ ls / /home/
/:
bin   dev  home  lib64  mnt  proc  run   srv  tmp  var
boot  etc  lib   media  opt  root  sbin  sys  usr/home/:
janyxe

ls -a 显示文件的详情信息,包括显示隐藏文件

[janyxe@localhost ~]$ ls -a
.              .bash_profile  .dbus      .esd_auth      Music      Videos
..             .bashrc        Desktop    .ICEauthority  Pictures   .viminfo
.bash_history  .cache         Documents  .local         Public     .Xauthority
.bash_logout   .config        Downloads  .mozilla       Templates

ls -l 显示当前目录及所有子目录信息

[janyxe@localhost ~]$ ls -l
total 0
drwxr-xr-x. 2 janyxe janyxe 6 Apr 27 02:00 Desktop
drwxr-xr-x. 2 janyxe janyxe 6 Apr 27 02:00 Documents
drwxr-xr-x. 2 janyxe janyxe 6 Apr 27 02:00 Downloads
drwxr-xr-x. 2 janyxe janyxe 6 Apr 27 02:00 Music
drwxr-xr-x. 2 janyxe janyxe 6 Apr 27 02:00 Pictures
drwxr-xr-x. 2 janyxe janyxe 6 Apr 27 02:00 Public
drwxr-xr-x. 2 janyxe janyxe 6 Apr 27 02:00 Templates
drwxr-xr-x. 2 janyxe janyxe 6 Apr 27 02:00 Videos

vi 编辑文件命令

命令 含义
vi fileName 新建,编辑文件命令

vi fileName 新建,编辑文件命令

[janyxe@localhost ~]$ vi new.sh

vi 的两种工作模式:命令模式,编辑模式
进入vi后伟命令模式,按键盘iINS按键进入编辑模式
ESC切回命令模式
命令模式不能编辑文件,只能输入命令

  • 命令模式

  • 编辑模式

vi 命令模式命令

命令 含义
:w 保存当前文档
:q 直接退出
:wq 先保存后退出
:wq 强制先保存后退出

mv 移动命令

命令 含义
mv file /dir 移动文件
mv file file1 修改文件名
mv /dir /dir2 修改文件夹名称

mv file /dir 移动文件

[janyxe@localhost ~]$ mv new.sh new

mv file file1 修改文件名

[janyxe@localhost ~]$ cd new/
[janyxe@localhost new]$ ls
new.sh
[janyxe@localhost new]$ mv new.sh new1.sh
[janyxe@localhost new]$ ls
new1.sh

mv /dir /dir2 修改文件夹名称

[janyxe@localhost ~]$ ls
Desktop  Documents  Downloads  Music  new  Pictures  Public  Templates  Videos
[janyxe@localhost ~]$ mv new new1
[janyxe@localhost ~]$ ls
Desktop  Documents  Downloads  Music  new1  Pictures  Public  Templates  Videos

总结

本文主要介绍了一些常见的CentOS 文件常用命令
如果本文对你们的开发之路有所帮助,请帮忙点个赞,您的支持是我坚持写博客的动力。

一文学会CentOS 文件常用命令相关推荐

  1. centos中常用命令

    centos中常用命令 一:使用 CentOS 常用命令查看 cpu 如果觉得需要看的更加舒服 grep "model name" /proc/cpuinfo | cut -f2 ...

  2. CentOS 7 常用命令集合

    CentOS 7 常用命令集合 常用命令 热键操作 Tab按键---命令补齐功能 Ctrl+c按键---停掉正在运行的程序 Ctrl+d按键---相当于exit,退出 Ctrl+l按键---清屏 添加 ...

  3. 【CentOS】常用命令

    [CentOS]常用命令 常用命令: 1.cd : 切换当前目录 2.ls :列出文件( ls -all 列出所有目录和文件及其属性 ) 3.查找命令 //查找制定目录或者文件 find / -nam ...

  4. Linux Log文件常用命令

    笔记:Log文件常用命令 tail tail -f xxx.log 显示最新出现的log tail -f xxx.log | grep 'xxx' 显示最新出现的带有检索词的log tail -f - ...

  5. hdfs上文件常用命令

    hdfs上文件常用命令 为了每次执行Hadoop的时候,不必须要前者加上hadoop的安装的绝对路径,要做的事情就是将其安装路径加入到PATH中,这样就可以直接执行hadoop命令. 如下: vim ...

  6. CentOS最常用命令及快捷键整理

    全栈工程师开发手册 (作者:栾鹏) 架构系列文章 先给一个linux命令查询网站:http://man.linuxde.net/?mqpqfm=0tw5h2 整理了Linux常用命令及快捷键. 常用命 ...

  7. CentOS 7常用命令

    常用命令 文件与目录操作 命令 解析 cd /home 进入 '/home' 目录 cd .. 返回上一级目录 cd ../.. 返回上两级目录 cd - 返回上次所在目录 cp file1 file ...

  8. Linux 文件 常用命令

    目录操作 cd:目录切换 用于切换当前工作目录至 dirName(目录参数). 其中 dirName 表示法可为绝对路径或相对路径.若目录名称省略,则变换至使用者的 home 目录 (也就是刚 log ...

  9. CentOS 7 常用命令大全

    常用命令 文件与目录操作 命令 解析 cd /home 进入 '/home' 目录 cd - 返回上一级目录 cd -/- 返回上两级目录 cd - 返回上次所在目录 cp file1 file2 将 ...

最新文章

  1. 你是否真的了解全局解析锁(GIL)
  2. java round number,Java Number Math 类
  3. Matlab 接受字符串并转为符号表达式,inline函数,匿名函数形式的方法汇总
  4. Salesforce 开发整理(十)项目部署总结
  5. LIBCMTD.lib与libcpmtd冲突的解决方法。
  6. Android 后台发送邮件 (收集应用异常信息+Demo代码)
  7. 前端获取checkbox复选框的值 通过数组形式传递
  8. 格式化Curl返回的Json字符
  9. 端口映射内网穿透——网络通
  10. java springboot点餐外卖源码
  11. Spring框架学习第二部分
  12. HCIP考试-华为证书安全方向已取得
  13. 9 ,zk 架构模型
  14. 崔老哥python scrapy爬虫框架入门
  15. bilibili账号申诉中心_B站的申诉渠道究竟在哪啊
  16. Git 报错:The ECDSA host key for gitlab.xx.net has changed, and the key for the corresponding.......
  17. Java实现 LeetCode 400 第N个数字
  18. Redis应用详解(一)分布式锁
  19. HYOJ 284 坦克大战
  20. Google新作synthesizer:Rethinking Self-Attention in Transformer Models

热门文章

  1. js本地刷新和局部刷新
  2. m=m++到底发生了什么
  3. 软件工程实训有必要吗_软件工程专业有没有必要考研
  4. process monitor解决网络问题一则
  5. 阿里云的认证是不是最好的?考起来难不难?
  6. GAN之父离开苹果重返谷歌,SpaceX最新估值达1250亿美元,美国官方公布UFO进展,今日更多大新闻在此...
  7. 2019年春节春晚红包大战战报!30亿!
  8. 正则表达式 匹配中文,英文字母和数字及_长度详解
  9. 24个国外优秀的网页页眉设计欣赏
  10. 软件测试概念-PIE模型