2020-08-07Linux基础命令学习

这篇博客详细介绍了Linux系统中的基础命令,包括目录操作(ls, cd, pwd, mkdir, rmdir)、文件属性查看和修改(ls -l, chown, chmod)以及文件内容查看(cat, more, less, head, tail)。还提到了Linux链接的两种类型——硬链接和软链接,并概述了计算机硬件的五大单元。博主强调了理解并熟练使用这些命令对于Linux用户的重要性。" 89959332,6500023,TCP非阻塞connect详解及应用,"['TCP套接字', '网络编程', '并发处理', '错误处理', '操作系统差异']

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Linux常用的基础命令笔记

Linux 目录相关的命令

ls (列出目录)

  • -a:全部的文件,连同隐藏文件(开头为.的文件)一起列出来
  • -l:长数据串列出,包含文件的属性与权限等等(常用)。

cd 命令

  • 绝对路径 /

  • 相对路径 相对于当前路径 cd…

  • [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-IVYrSZNn-1596786838645)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20200807100505817.png)]

    pwd 显示当前所在目录

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-oH4ExpxL-1596786838652)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20200807101815340.png)]

    mkdir 创建一个目录

    [root@centos7 /]# cd home #创建目录
    [root@centos7 home]# ls
    csl  cslstudy  csl.txt  test
    [root@centos7 home]# mkdir test1
    [root@centos7 home]# ls
    csl  cslstudy  csl.txt  test  test1
    [root@centos7 home]# mkdir test2/test3/test4/
    mkdir: cannot create directory ‘test2/test3/test4/’: No such file or directory
    [root@centos7 home]# mkdir -p test2/test3/test4  ##创建多级目录
    [root@centos7 home]# ls
    csl  cslstudy  csl.txt  test  test1  test2
    [root@centos7 home]# cd test2
    [root@centos7 test2]# ls
    test3
    [root@centos7 test2]# cd test3
    [root@centos7 test3]# ls
    test4
    [root@centos7 test3]# 
    
    

    rmdir 删除一个目录

    [root@centos7 test3]# cd /home
    [root@centos7 home]# ls
    csl  cslstudy  csl.txt  test  test1  test2
    [root@centos7 home]# rmdir test1
    [root@centos7 home]# ls
    csl  cslstudy  csl.txt  test  test2
    [root@centos7 home]# rmdir test2
    rmdir: failed to remove ‘test2’: Directory not empty
    [root@centos7 home]# rmdir test2/test3/test4
    [root@centos7 home]# ls
    csl  cslstudy  csl.txt  test  test2
    [root@centos7 home]# rmdir -p test2/test3/test4
    rmdir: failed to remove ‘test2/test3/test4’: No such file or directory
    [root@centos7 home]# mkdir test2/test3/test4
    [root@centos7 home]# rmdir -p test2/test3/test4
    [root@centos7 home]# ls
    csl  cslstudy  csl.txt  test
    

    rmdir仅能删除空的目录,如果下面存在文件,需要删除文件,递归删除多个目录 -p参数即可

cp 复制文件或者目录

[root@chendashuai test]# cd ..
[root@chendashuai home]# ls
csl  cslstudy  csl.txt  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值