• 03_directory-related commands


    1. Category of directory
        The shell working directory.
        The current directory which refers to the shell working directory.
        HOME directory:
            root : /root
            Average user : /home/USERNAME
    2. The cd command
        Change the shell working directory / Change the current directory to DIR.
        e.g :
            cd or cd~ : Switch to the current user's home directory.
            cd ~USERNAME :     Switch to the home directory of the specified user.
            cd - : Switch back and forth between the previous directory and the current directory.
            . : The current directory.
            .. : The parent directory of the current directory.
        Environment variables related to the cd command:
            PWD : Used to save the current directory.
                The pwd command is used to read the value of the PWD environment variable. 
            OLDPWD : Used to save the previous directory.
                That's why you can switch back and forth between the previous directory and the current directory.
                cd- is equivalent to cd $OLDPWD.

    3. The ls command : List contents of the specified directory.
        Execution result of ls command with the option of -l : 
            -rw-r--r-- 1 root root 44800 Aug 14 14:32 install.log
                The leftmost one : refers to the file type.
                The next nine : refers to the file access authority.
                The next digital 1 :  The number of a file is hard linked.
                the first root : The owner of the file.
                the second root : The group of the file.
                44800 : The size of the file.
                Aug 14 14:32 : The last time the file was modified.
                install.log : the file name.

    1. mkdir
        1.1 mkdir用来创建目录的:在这里目录和文件是一回是
        [root@bogon tmp]# mkdir test/abc  
            如果test存在:创建成功
            如果abc存在,则不会创建新的替换,且会报错。
            如果test不存在:创建失败
        -p, --parents : no error if existing, make parent directories as needed
            [root@bogon tmp]# mkdir test/abc
            如果test不存在,先创建test,后创建abc
                如果abc存在,则不会创建新的替换,且不会报错。
        -v, --verbose : print a message for each created directory
    2. rmdir : remove empty directories
    3. tree : list contents of directories in a tree-like format.  

  • 相关阅读:
    Django之Orm的各种操作
    python面试题---收藏的笔记
    jQuery中$.each()方法的使用
    Django 之 路由URL,视图,模板
    高级FTP服务器开发
    选课系统
    ATM
    开发一个简单的python计算器
    学习PYTHON之路, DAY 8
    学习PYTHON之路, DAY 7
  • 原文地址:https://www.cnblogs.com/liujun5319/p/9600765.html
Copyright © 2020-2023  润新知