• 三、基本命令


    三、基本命令

    1、cd 命令

    [root@iZbp1g3zb15nr77gr5reegZ /]# cd /usr					#进入单层目录	
    [root@iZbp1g3zb15nr77gr5reegZ usr]# cd ..					#退出所在目录
    [root@iZbp1g3zb15nr77gr5reegZ /]# cd /usr/bin				#进入多层目录
    [root@iZbp1g3zb15nr77gr5reegZ bin]#clear					#清除命令行窗口
    

    2、ls 命令

    [root@iZbp1g3zb15nr77gr5reegZ usr]# ls						#查看当前目录下面的内容
    bin  etc  games  include  lib  lib64  libexec  local  sbin  share  src  tmp
    [root@iZbp1g3zb15nr77gr5reegZ usr]# ls -ll					#查看当前目录下面的内容(列表形式)
    total 84
    dr-xr-xr-x.  2 root root 20480 Nov 30  2021 bin
    drwxr-xr-x.  2 root root  4096 Apr 11  2018 etc
    drwxr-xr-x.  2 root root  4096 Apr 11  2018 games
    drwxr-xr-x.  4 root root  4096 Apr 26  2020 include
    dr-xr-xr-x. 29 root root  4096 Apr 26  2020 lib
    dr-xr-xr-x. 39 root root 20480 Apr 26  2020 lib64
    drwxr-xr-x. 22 root root  4096 Apr 26  2020 libexec
    drwxr-xr-x. 13 root root  4096 Apr 26  2020 local
    dr-xr-xr-x.  2 root root 12288 Sep 18 21:38 sbin
    drwxr-xr-x. 77 root root  4096 Apr 26  2020 share
    drwxr-xr-x.  4 root root  4096 Apr 26  2020 src
    lrwxrwxrwx.  1 root root    10 Apr 26  2020 tmp -> ../var/tmp
    [root@iZbp1g3zb15nr77gr5reegZ usr]# ls -al		#查看当前目录下面的所有内容包括隐藏文件(列表形式)
    total 92
    drwxr-xr-x. 13 root root  4096 Apr 26  2020 .
    dr-xr-xr-x. 18 root root  4096 Sep 19 14:50 ..
    dr-xr-xr-x.  2 root root 20480 Nov 30  2021 bin
    drwxr-xr-x.  2 root root  4096 Apr 11  2018 etc
    drwxr-xr-x.  2 root root  4096 Apr 11  2018 games
    drwxr-xr-x.  4 root root  4096 Apr 26  2020 include
    dr-xr-xr-x. 29 root root  4096 Apr 26  2020 lib
    dr-xr-xr-x. 39 root root 20480 Apr 26  2020 lib64
    drwxr-xr-x. 22 root root  4096 Apr 26  2020 libexec
    drwxr-xr-x. 13 root root  4096 Apr 26  2020 local
    dr-xr-xr-x.  2 root root 12288 Sep 18 21:38 sbin
    drwxr-xr-x. 77 root root  4096 Apr 26  2020 share
    drwxr-xr-x.  4 root root  4096 Apr 26  2020 src
    lrwxrwxrwx.  1 root root    10 Apr 26  2020 tmp -> ../var/tmp
    

    3、pwd 命令

    [root@iZbp1g3zb15nr77gr5reegZ usr]# pwd					#查看当前所在目录
    /usr
    
    

    4、mkdir 命令

    [root@iZbp1g3zb15nr77gr5reegZ home]# mkdir lzb					#创建目录
    [root@iZbp1g3zb15nr77gr5reegZ home]# mkdir -p lzb2/test/output	#创建多级目录
    [root@iZbp1g3zb15nr77gr5reegZ home]# ls -ll
    total 8
    drwxr-xr-x 2 root root 4096 Sep 19 16:48 lzb
    drwxr-xr-x 3 root root 4096 Sep 19 16:50 lzb2
    

    5、rmdir 命令

    [root@iZbp1g3zb15nr77gr5reegZ home]# rmdir lzb						#移除单个文件夹
    [root@iZbp1g3zb15nr77gr5reegZ home]# rmdir -p lzb2/test/output		#移除多层文件夹
    

    6、cp 命令

    [root@iZbp1g3zb15nr77gr5reegZ home]# cp Maven.md test	#拷贝文件到指定文件夹
    [root@iZbp1g3zb15nr77gr5reegZ home]# cp Maven.md test		
    cp: overwrite ‘test/Maven.md’? y						#如果文件夹中已经存在,则输入y可以重写
    [root@iZbp1g3zb15nr77gr5reegZ home]# 
    
    

    7、rm 命令

    [root@iZbp1g3zb15nr77gr5reegZ test]# rm Maven.md 		#移除文件
    rm: remove regular file ‘Maven.md’? y
    [root@iZbp1g3zb15nr77gr5reegZ home]# rm -f test			#强制移除文件
    [root@iZbp1g3zb15nr77gr5reegZ home]# rm -r tset/test01/test02	#移除多层文件
    rm: remove directory ‘tset/test01/test02’? y
    

    8、mv 命令

    [root@iZbp1g3zb15nr77gr5reegZ home]# mv Maven.md tset/		#移动文件到指定文件夹
    [root@iZbp1g3zb15nr77gr5reegZ home]# mv tset test03			#重命名文件夹
    
  • 相关阅读:
    Python使用MINIMAX实现自动吃豆人
    计算机诞生历史小故事
    oracle数据库 表中有数据,通过plsql 工具 连接 查询全表,却查不到数据
    前端基础:防抖与节流
    CycloneDDS配置详细说明中文版(三)
    【714. 买卖股票的最佳时机含手续费】
    Tkinter实现聊天气泡对话框
    React学习笔记
    C语言实现学生管理系统(顺序表版)
    PTA_乙级_1006
  • 原文地址:https://blog.csdn.net/weixin_48312484/article/details/127039182