User Tools

Site Tools


tutorials:linux_essential_commands

This is an old revision of the document!


Linux Essential Commands

  • man: manual page.
    • Explains how to use a shell command.
    • man <COMMAND>: For example, to find out how to use man, type man man
  • ls: list directory content
  • cd: change directory
  • pwd: print working directory
  • wc: count word, line, character, and byte
  • head: display first 10 lines of a file
  • tail: display the last part of a file
  • cat: concatenate and print the file
  • more: display output one screen at a time
  • cp: copy file
    • cp <SOURCE> <DESTINATION>
  • mv: move file (can be use as changing file name)
    • mv <SOURCE> <DESTINATION>
  • rm: remove file (like delete)
    • rm -r: remove directory (like rmdir)
  • chmod: change file modes or Access Control Lists
    • (u,g,o): user, group, other
    • (r,w,x): read, write, execute
  • chown: change file owner or group
  • mkdir: make directories
  • rmdir: remove directories
  • ssh: OpenSSH SSH client (remote login program)
    • ssh usrname@ip_adress
  • scp: secure copy (remote file copy program)
    • scp <SOURCE> USRNAME@IP:<DESTINATION>
    • scp USRNAME@IP:<SOURCE> <DESTINATION>
    • -p: 保留原始檔案權限&修改日期等, -r: 複製整個資料夾
  • 2>&1: send STDERR to STDOUT (0:STDIN, 1:STDOUT, 2:STDERR)
  • &: running job in background (終端機背景執行)
  • nohup: 系統背景執行(不同於&)
    • nohup <COMMAND> &
  • free -g: 查看實際剩餘ram(單位為G)
  • grep: find keywords in file
    • grep <KEYWORD> <FILENAME>
  • nice and renice: run a program with modified priority. If the server is under heavy load and you need to start a non-urgent large job, please use these.
tutorials/linux_essential_commands.1331545360.txt.gz · Last modified: 2012/03/12 17:42 by chkuo