Linux快捷键

generic symble

  • cd /: root directory
  • cd ~:usr directory
  • cd ./: current directory path
  • cd ..: up directory path
  • ! + cmd(cd/p): invoke last command
  • cmd+&: run job in background

file operation

  • man+cmd: manual
  • ls: list the diretory and files
  • ls -a: list all includes hidden directory and files
  • ls -l: format list
  • ll: format list
  • cd : change directory to the /home/user
  • cd dir_path: go to the dir_path directory
  • pwd: present working directory
  • mkdir dir: crate a directory
  • touch file: creat a file
  • vi file: vi editor
  • gvim file: gvim editor
  • chmod+777(可执行状态)+dir/file name: change r/w/x property
  • cat file: look at the file context on terminal
  • more file: view the file
  • less file: view the file like gvim or vi
  • cp file1 file2: copy file1 to file2
  • co -r dir1 dir2: copy directory recursivety
  • mv file1 dir/file2: move (or rename) file1 to dir/file2
  • wc file: count lines words an characters
  • wc -w file: count word of file
  • wc -l file: count line
  • rm fileL remove file
  • rm -r dir: remove dir
  • rm -f file: enforced
  • rm -rf dir: enforced
  • ln -s +file name + link name: crate a symbolic link to file(链接脚本用)
  • grep + pattern+file name: search pattern matched in file
  • grep error sim.log:
  • grep -r pattern dir: search pattern incursively in directory
  • find / -name file: search the file from / directory (fine /etc -name '*con*')
  • fine /+path+ -size +100M(路径下大于100M的)

pack files

  • tar -cvf file_name.tar file_name: crate a tar file
  • tar -xvf file.tar: extract
  • tar -czvf file_name/ tar.gz file_name
  • tar -xzvf file_name/ tar.gz file_name
  • tar -cjvf file_name/ tar.bz2 file_name: bzip2
  • tar -xjvf file_name/ tar.bz2 file_name
  • gzip file_name: gz
  • 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(把error放到文件里)

  • grep ERROR sim.log >> error.log(原来的和现在的都放进去)

  • cat > file_name: sample the standard input and put the into the file

  • cmd | grep pattern: search pattern in cmd output

  • rpm -qa |grep vim(前面命令输出是后面命令的输入)

  • cat /etc/passwd | grep /bin/bash |wc -l

  • grep ERROR sim.log | tee -a error.log

  • man ls | col -b > ls_man.txt

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

  • data
  • data + \Y\m\d
  • data + \s
  • data + \N
  • cal: display calendar
  • uptime
  • w: display who logen 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 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 resule
  • 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
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容