鹏鹏的博客

额嗯嗯嗯...博文写不写?随缘



Linux常用命令学习笔记(一)

  • ls: list files and dirs in current dir

    • -a display all files
    • -l display in list
    • -t sort by edit time
  • mv: move / rename

    • mv source target
  • cp: copy files / dirs

    • -a copy all properties
    • -r recursion
    • -f forcible
  • scp: remote copy
    scp source target
  • file: judge file type
  • rm remove file

    • -rf recursion and forcible
  • touch: create new file or update file time
  • cd: change current dir
  • mkdir: create new dir
    -p recursion
    -m dir permission
  • rmdir: remove empty dir
  • echo: display content

    • -e escape string
  • cat: display or combine file

    • -n display line numbers
    • cat file1 > file2 : combine file1 to file2
  • more/less: display file
  • nl: display file with line numbers
  • head: display several lines at the beginning of file
  • tail: display several lines at the end of file
  • which: locate command dir
  • whereis: display command location, source code, help file location
  • find

    • -o combine two paras
    • -name figure the file name
    • -iname similar to -name, ignore low/upcase
    • ! not
    • -type file type

      • f normal
      • l linking
      • d dir
    • -maxdepth the maximumal depth of dir
    • -size figure size of file

      • +10k: >10k
      • -10k: <10k
      • 10k: ==10k
    • -empty empty file
    • -delete delete found files
    • -user
    • -exec execute commands
  • grep: regular expression

    • -v reverse
    • -o only output matched text
    • -E use extended regular expression
    • -c count number of matched lines
    • -n display line numbers of matched line
  • seq: generate sequence

    • -f format
    • -s separator
    • -w same width (add "0")
  • wc: count file number of lines and words

    • -c display bytes
    • -l display line numbers only
    • -w display word number only
  • tar

    • -c create new backups
    • -v display the progress
    • -f filename
    • -z gzip
    • -j bzip
    • -x uncompress
    • -C figure a dir
  • gzip, bzip2, xz
  • last: display rencent user login information
  • lastlog: display all users' latest login information
  • history: display recent commands
  • sort: sort txt

    • -u ignore same lines
    • -k column of sort key
    • -t separator between columns
  • uniq: ignore same lines in txt