[Linux] basic command 1

cat, tac

  • Shows the contents of the file.

  • Option

    • -n : number all output lines
    • -b : number nonempty output lines
    • > : If the file exists, it is overwritten
    • >> : append to the end of the file

tee, nl

  • tee -a : append to the end of the file
  • nl == cat -b
  • -i10, -v100, -w10

head, tail

  • head
    • head a : 10 lines from head
    • head -n 10 a : 10 lines from head
    • head -n +10 a : 10 lines from head
    • head -n -5 a : subtract the last 5 lines
  • tail
    • tail b : 10 lines from tail
    • tail -n 10 b : 10 lines from tail
    • tail -n -10 b : 10 lines from tail
    • tail -n +3 b : from 3 lines to end line

split

  • Opiton
    • -l
    • -C
    • -a
    • -d
    • –additional-suffix
    • –numeric-suffixes

csplit, wc

  • Option
    • csplit -f aa_
    • csplit k /REGEXP/ {*}
    • csplit k %REGEXP%

ls

  • Option
    • -a : all
    • -A : almost all (no . ..)
    • -l : long
    • -h : human-readable
    • -F : (one of */=>@ )
    • -i : inode
    • -R : recursive

    • -S : size
    • -r : reverse
    • -t : time
    • -t :modifiction time
      • -u : access time
      • -c : change -time

Reference

  • –help