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
  • 相关阅读:
    微信转发或分享朋友圈带缩略图、标题和描述的实现方法
    apache一个IP多个站点的配置方法
    微信网页扫码登录的实现
    laravel take(3) 读取最近三条信息
    微信卡劵、微信卡包,必须是认证订阅号或认证服务号
    CSS3 去除苹果浏览器按钮input[type="submit"]和input[type="reset"]的默认样式
    使用laravel5.4结合easywechat进行微信开发--基本配置
    Class 'QrCode' not found ? 和 laravel 生成二维码接口(Simple QrCod)
    windows redis的启动 和 Laravel中Redis的使用
    改变checkbox的默认样式
  • 原文地址:https://www.cnblogs.com/BloodZero/p/4539285.html
Copyright © 2011-2022 走看看