zoukankan      html  css  js  c++  java
  • 常用Linux操作命令

    # --------------------- Linux basic ------------------------------
    
    # file name: linux_basic
    # author   : 
    # date     : 2014-3-25
    # contact  : QQ : 
    #            email : 
    # summary  : Linux basic command operation 
    
    # -------------------- Linux basic -------------------------------
    
    # ------ generic symbol ------------------------------------------
    /             : root directory
    ~             : usr directory
    ./            : current directory path
    ..            : up directory path
    !cmd          : invoke last command
    &             : run job in background
    
    # --- create a linux user and group -----------------------------
    adduser user_name : you must have root privilege
    passwd user_name  : set the password for the user
    su user_name      : change user account and need the user password
    whoami            : display the user name
    
    # ------ file operation -----------------------------------------
    man cmd       : manual and input "q" to quit man command
    
    ls            : list the directory and files
    ls -a         : list all includes hidden directory and files
    ls -l         : format list  
    ll -a         : format list 
    
    cd            : change directory to the /home/user
    cd ~          : ~ means the /home/user directory
    cd dir_path   : go to the dir_path directory
    
    pwd           : present working directory
    
    mkdir dir     : create a directory
    touch file    : create a file
    vi file       : vi editor
    gvim file     : gvim editor
    
    chmod 777 dir                    : change r/w/x property 
    chmod a+x file                   : file will be executed by all
    chmod [ugoa]+[rwx] file|dir
    chown user:group files|directory : change file owner and group
    chgrp gourp_name files           : change file group
    
    cat  file     : look at the file context on terminal
    more file     : view the file
    less file     : view the file like gvim or vi
    
    cp -f file1 file2      : copy file1 to file2
    cp -r dir1 dir2        : copy directory recursively
                           
    mv file1 dir|file2     : move (or rename) file1 to file2
                           
    wc file                : count lines words and characters
    wc -w file             : count word of file
    wc -l file             : count line  
                           
    rm file                : remove file
    rm -r dir              : remove dir* (recursive)
    rm -f file             : enforced to remove file (force)
    rm -rf dir             : enforced to remove dir*
    
    ln -s file link: create a symbolic link to file
    
    grep pattern file      : search pattern matched in file
    grep error sim.log     :
    grep -r pattern dir    : search pattern incursively in directory
    
    find / -name file_name : search the file from / directory
    find /etc -name '*con*':
    find / -size +100M :
    
    #------ pack files -------------------------------
    tar -cvf file.tar files         : create a tar file
    tar -xvf file.tar               : extract a tar file
    tar -czvf file.tar.gz files     : create a gzip file
    tar -xzvf file.tar.gz           
    tar -cjvf file.tar.bz2 files    : create a bzip2 file
    tar -xjvf file.tar.bz2
    
    gzip file                       : create a file.gz file
    gzip -d file.gz                 :
    
    # ------ install rpm package ---------------------
    rpm -qa           : query all installed RPM packages
    rpm -ivh RPM.rpm  : install RPM package
    
    ./configure
    make
    make install
    
    grep ERROR cmp.log > 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 ----------------------------
    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
    su root|usr   : change the usr
    exit          : usr 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 cpl; make sim  :
    
    cat /proc/cpuinfo : show CUP 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  : display directoy in cd command
    

      

  • 相关阅读:
    Java之内部类
    java之对象的前世今生
    java之继承
    java之接口
    何为大学 大学何为?
    丁香般的姑娘
    MySQL创建数据库与创建用户以及授权
    CentOS6.8手动安装MySQL5.6
    linux 修改myql 编码配置等信息参考
    Centos6.8 Mysql5.6 安装配置教程
  • 原文地址:https://www.cnblogs.com/ioveNature/p/6611451.html
Copyright © 2011-2022 走看看