• linxu_basic


    #--------------------Linux Basic-----------------------------------------------
    #file name : linux_basic
    #author : LGP
    #date : 2018-07-11
    #contact : lgp_0615@163.com
    #------------------------------------------------------------------------------

    #-------------------generic symbo----------------------------------------------
    / : root directory (cd / )
    ~ : user directory (cd ~ )
    ./ : current directory (cd ./ )
    .. : up directory (cd .. )
    !cmd : invoke last command (!cd )
    & : run job in background (dve & )

    #-------------------create a user----------------------------------------------
    adduser user_name : only root user can do
    passwd user_name : set the password for user
    su root|user: change the user (su liugaopeng )
    id : according the user id
    #newgrp training : change the user group to training

    #------------------file operation----------------------------------------------
    man : manual (man cd )

    ls : list the directory and files (ls )
    ls -a : list all includes hidden directory and files (ls -a )
    ls -l : format list (ls -l )
    ll : format list (ll )
    ll -a : format list includes hidden directory and files (ll -a )
    ll -t : list format time (ll -t )
    ls -r : list format inverted (ls -lrt )

    cd : change directory to the /home/user (cd )
    cd ~ : ~means the /home/user/ directory (cd ~ )
    cd dir_path : go to the dir_path directory (cd ../.. )

    pwd : present working directory (pwd )

    mkdir : create a directory (mkdir dir )
    touch : create a file (touch file )
    vi : create a file (vi file )
    gvim : create a file (gvim file )
    #chmod : change r/w/x property (chmod 777 file/dir )
    #chmod 777 dir/file : 更改文件的权限(owner - rwx, group - rwx, others - rwx )
    chmod a+x file : 给文件添加可执行的权限 (a: all include owner, group, others )
    #chmod [ugoa] + [rwx] file|dir

    #chown user : group files|directory :更改文件或者目录的所有值和所属组


    cat file : look at the file context on terminal (cat file )
    more file : view the file (more file )
    less file : view the file like vim or vi (less file )

    cp file1 file2 : copy file1 to file2 (cp file1 file2 )
    cp -r dir1 dir2: copy directory recursively (cp -r dir1 dir2)
    cp -f ~~ ~~ : copy compulsive (cp -f file1 f2 )

    mv file1 file2 : move (or rename) file1 to file2 (mv file1 file2 )

    wc : word count
    wc file : count lines words and characters (wc file )
    wc -w file : count word of file (wc -w file )
    wc -l file : count line (wc -l file )

    rm file : remove file (rm file )
    rm -r dir : remove dir* (recursively) (rm -r dir )
    rm -f file : remove file (force) (rm -f file )
    rm -rf dir : enforced to remove dir* (rm -rf dir )

    diff -ruNa file/dir : difference of dile1/dir1 (diff -ruNa file1 file2)

    ln -s file link : create a symbolic link to file (ln -s linux_basic lb )

    grep pattern file : search pattern matched in file (grep qixin linux_basic )
    grep error sim.log grep warning com.log
    grep -r pattern dir : search pattern incursively in directory (grep -r qixin linux )

    find / -name file_name : search the file from / directory (find /etc -name '*con' )
    find / -size +100M : search the file > 100M

    #------------------pack files -----------------------------------------------------------------------
    #tar -cvf file.tar files : create a tar file (tar -cvf linux_cmd.tar linux_cmd )
    #tar -xvf file.tar : extract a tar file (tar -xvf linux_cmd.tar )
    #tar -czvf file.tar.gz files : create a gzip file
    #tar -xzvf file.tar.gz : extract a gzip file
    #tar -cjvf file.tar.bz2 files : create a bzip2 file
    #tar -xjvf file.tar.bz2 : extract a bzip2 file

    gzip file : create a file.gz file (gzip linux_cmd )
    gzip -d file.gz : extract a file.gz file

    #----------------------------install rpm package ----------------------------------------------------
    rpm -qa : query all installed RPM packages
    rpm -ivh RPM.rpm: install RPM package

    ./configure
    make
    make install

    > : (grep ERROR com.log > error.log )
    >> : Adder the sim.log error to the error.log (grep ERROR sim.log >> error.log )
    cat > file : sample the standard input and put them into the file

    cmd | grep pattern : search pattern in cmd output (rpm -qa | grep vim )
    cat /etc/passwd | grep /bin/bash | wc -l
    man ls | col -b > ls_man.txt
    grep ERROR sim.log | tee -a error.log

    #---------------------------process manage--------------------------------------------------------------
    ps : display the current active process
    top : display all process of the OS
    kill pid : stop the pid process
    killall proc: stop all of the proc process
    bg : list the suspended job in background
    fg : resume the last suspended job in foreground

    #----------------------------system info----------------------------------------------------------------
    gnome-terminal : open a new terminal
    date : display system time
    date +%Y%m%d
    date +%s
    date +%N

    cal : display calendar
    uptime :
    w : display who logon and what are doing
    whoami : print effective userid
    uname -a : display all OS system info

    which cmd : show the full path of the cmd (which pwd )
    exit : user shell quit
    echo $path : show the variable
    clear : clear the info on the terminal
    history : show the command history
    !cmd : invoke the last cmd
    make : invoke Makefile
    make clean; make sim; make com;

    cat /proc/cpuinfo : show CPU information
    cat /proc/meminfo : show memory information

    df : report file system disk space usage
    du -b|k|m file|dir : estimate file space usage
    du -s file|dir : summary
    du -sm file|dir

    #--------------------------network info-----------------------------------------------------------------
    ping host|IP : ping IP address and print the result
    hostname : display system host name
    ifconfig -a : configure the network

    #---------------------------hot key---------------------------------------------------------------------
    ctrl + c : stop the current command
    ctrl + z : suspend the job and put it into background
    'fg' can be used to resume the job free the license and take it soon
    ctrl + d : exit current shell,equal exit command

    终端中的复制和粘贴:按住左键拖拽选择复制,按中键粘贴

    shift + ctrl + t : 新建标签页
    shift + ctrl + w : 关闭标签页

    shift + ctrl + n : 新建窗口
    shift + ctrl + q : 关闭终端

    shift + ctrl + +/- : 放大/缩小终端/图表

  • 相关阅读:
    ASP.NET
    ASP.NET
    MSSQL
    ASP.NET
    HTML+CSS+JS
    HTML+CSS
    ASP.NET、WinForm、C#
    MSSQL
    WinFrom
    线性代数应该这样学一
  • 原文地址:https://www.cnblogs.com/godlovepeng/p/9480789.html
Copyright © 2020-2023  润新知