zoukankan      html  css  js  c++  java
  • 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.  

  • 相关阅读:
    猿辅导-去除数组中数量大于k的数
    OSI体系结构各层协议
    京东-学生合唱队分组
    146-LRUCache
    76-最长上升子序列
    无序数组中三个数字乘积最大值
    38-字符串的排列
    35-复杂链表的复制
    208-Implement Trie(Prefix Tree)
    69-求一个整数的平方根
  • 原文地址:https://www.cnblogs.com/liujun5319/p/9600765.html
Copyright © 2011-2022 走看看