zoukankan      html  css  js  c++  java
  • 基础篇--文件操作

    关于Linux下各个文件夹的作用:

    /usr:安装软件的目,共享库,还有一些文件

      /usr/bin:众多应用程序

      /usr/sbin:超级用户的一些管理程序

      /usr/doc:Linux文档

      /usr/local:本地的很多文件

    /etc:各种配置文件

    /var:各种服务日志文件

    注:/bin--/usr/bin;  /sbin--/usr/sbin;  /lib--/usr/lib;  /lib64--/lib64

    一些命令:

    pwd命令:查看当前目录

    ls:列出文件及文件夹

    cd:目录跳转

    [root@localhost ~]# pwd
    /root
    [root@localhost ~]# ls
    anaconda-ks.cfg  command.txt  file.txt  initial-setup-ks.cfg  rhel.iso
    [root@localhost ~]# ls -l
    total 2097168
    -rw-------. 1 root root       1186 May 22 03:19 anaconda-ks.cfg
    -rw-r--r--. 1 root root         28 May 23 17:43 command.txt
    -rw-r--r--. 1 root root         18 May 23 17:46 file.txt
    -rw-r--r--. 1 root root       1237 May 22 03:22 initial-setup-ks.cfg
    -rw-r--r--. 1 root root 2147483648 May 22 03:31 rhel.iso
    [root@localhost ~]# ls -A
    anaconda-ks.cfg  .bash_profile  command.txt  .dbus                 rhel.iso
    .bash_history    .bashrc        .config      file.txt              .tcshrc
    .bash_logout     .cache         .cshrc       initial-setup-ks.cfg  .viminfo
    [root@localhost ~]# cd /home/
    [root@localhost home]# pwd
    /home

    touch命令:创建文件(默认权限与umask值有关)

    mkdir命令:创建文件夹

    cp命令:复制(cp file1 file2;cp file1 file2 file3 dir;cp -r dir1 dir2;)

    mv命令:移动(mv file1 file2;mv file1 file2 file3 dir)

    rm命令:删除(rm file1;rm -f file1 file2 file3;rm -r dir1)

    [root@localhost test]# pwd
    /root/test
    [root@localhost test]# touch yy{1..2}.ogg
    [root@localhost test]# touch zz{1..8}.odf
    [root@localhost test]# mkdir ogg
    [root@localhost test]# mkdir -p odf/test/
    [root@localhost test]# ls -l
    total 0
    drwxr-xr-x. 3 root root 17 May 29 07:20 odf
    drwxr-xr-x. 2 root root  6 May 29 07:19 ogg
    -rw-r--r--. 1 root root  0 May 29 07:19 yy1.ogg
    -rw-r--r--. 1 root root  0 May 29 07:19 yy2.ogg
    -rw-r--r--. 1 root root  0 May 29 07:19 zz1.odf
    -rw-r--r--. 1 root root  0 May 29 07:19 zz2.odf
    -rw-r--r--. 1 root root  0 May 29 07:19 zz3.odf
    -rw-r--r--. 1 root root  0 May 29 07:19 zz4.odf
    -rw-r--r--. 1 root root  0 May 29 07:19 zz5.odf
    -rw-r--r--. 1 root root  0 May 29 07:19 zz6.odf
    -rw-r--r--. 1 root root  0 May 29 07:19 zz7.odf
    -rw-r--r--. 1 root root  0 May 29 07:19 zz8.odf
    [root@localhost test]# mv yy* ogg/
    [root@localhost test]# ls -lR
    .:
    total 0
    drwxr-xr-x. 3 root root 17 May 29 07:20 odf
    drwxr-xr-x. 2 root root 34 May 29 07:20 ogg
    -rw-r--r--. 1 root root  0 May 29 07:19 zz1.odf
    -rw-r--r--. 1 root root  0 May 29 07:19 zz2.odf
    -rw-r--r--. 1 root root  0 May 29 07:19 zz3.odf
    -rw-r--r--. 1 root root  0 May 29 07:19 zz4.odf
    -rw-r--r--. 1 root root  0 May 29 07:19 zz5.odf
    -rw-r--r--. 1 root root  0 May 29 07:19 zz6.odf
    -rw-r--r--. 1 root root  0 May 29 07:19 zz7.odf
    -rw-r--r--. 1 root root  0 May 29 07:19 zz8.odf
    
    ./odf:
    total 0
    drwxr-xr-x. 2 root root 6 May 29 07:20 test
    
    ./odf/test:
    total 0
    
    ./ogg:
    total 0
    -rw-r--r--. 1 root root 0 May 29 07:19 yy1.ogg
    -rw-r--r--. 1 root root 0 May 29 07:19 yy2.ogg
  • 相关阅读:
    国家电网 ERP系统
    小亚通SaaS ERP & 小鹅通 Education
    CRM User(Customer) Employee
    Docker ERP CRM
    OA、CRM、ERP之间的区别和联系是什么?
    基于jfinal开发的12306抢票软件
    15款优质Spring开源项目 脚手架
    Echart 跨域 Data Demo
    区块链+金融,带你直击实践应用中的需求和痛点
    thinkphp 5.0报错pcntl_signal() has been disabled for security reasons问题解决
  • 原文地址:https://www.cnblogs.com/BloodZero/p/4539285.html
Copyright © 2011-2022 走看看