一緒にlinuxを勉強しましょう

6224 ワード

1. linux  
    /dev       
    /boot          
    /lib       
    /bin        (     )
    /sbin           
    /usr       
    /var          (    /mysql   )
    /mnt       (u )
    /home       
    /root       
    /etc         
    /opt         

2. -  #        

3. ~  #    ( root  cd ~    root    , gyk  cd ~    gyk    )

4. w  #           

5. :
    vim aa.txt  #       ,    ,    
    touch aa.txt  #       (   ,   )
    mkdir      
    -p  #     
        mkdir -p /tmp/python_test/tests.py
        mkdir -p ./a/c ./b/d  #          

6. :
    rm
    -f  #     
    -r  #     
    rm -rf *  #             

7. :
    mv     ,       
    mv aa.txt bb.py  #    
    mv ./aa.txt tmp  #  aa.txt   tmp    

8. :
    cat aa.txt  #     (         ,       )
    more aa.txt #              , enter      
    head -10 aa.txt #    10 
    tail 4 aa.txt  #    4 
        
    ls  #                
        -l  #       
        -a  #       (     )
        -h  #     

9.    :
    useradd alex  #
    passwd alex  #     

10.  /  path
    1.   echo $PATH    path  
    /usr/local/sbin:
    /usr/local/bin:
    /usr/sbin:
    /usr/bin:
    /root/bin

    2. linux  python3     ,    ?
            /opt/python3/bin/python3.6

      path
    PATH=/opt/python3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
        

11. whoami  #       

12. which python2  #          

13. linux      
    1.       
        echo $PS1
        ### [\u@\h \W]\$

    2.     
        PS1="[\u@\h \w \t]\$"

14. set nu  #     (        )

15. echo 
    echo "aa.txt" > aa.txt  # echo   
    echo "nihaoa" >> aa.txt  # echo  

16.   
    cp aa.txt bb.txt  #   aa.txt bb.txt
    cp ./opt/aa.txt ./tmp/bb.txt  #   aa.txt /tmp  bb.txt
    cp -r           #