Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Shell Basic

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Shell Basic

ls,cd,wc,grep,find

Avatar for zhiyelee

zhiyelee

April 17, 2014
Tweet

Other Decks in Programming

Transcript

  1. dir/file manipulation • mkdir / mkdir -p! • rmdir /

    rmdir -p! • rm -rf! • cp -i! • ln -s
  2. cd

  3. ls

  4. cat

  5. less & more • less/more! • less line move,more page

    move! • does not read the entire input file before starting! • less -N line-number! • ls /etc | less
  6. tail & head • tail ! • tail -f! •

    tail -5! ! • head! • head -5
  7. Redirection • stdin,stdout,stderr! • 0 1 2! • /dev/null! •

    < > >>! • Case! • redirect error! • redirect stdout and error to a file
  8. " chmod – Change a file's mode! " umask –

    Set the default file permissions! " su – Run a shell as another user! " sudo – Execute a command as another user! " chown – Change a file's owner
  9. umask • umask! • the default permissions of created file!

    • octal notation ! • express a mask of bits to be removed from a file's mode attributes! • common default value: 022 002
  10. umask 022 owner group other original file mode rw-
 110

    rw-
 110 rw-
 110 umask 000 010 010 mode of created file rw-
 110 r—
 100 r—
 100
  11. umask 002 owner group other original file mode rw-
 110

    rw-
 110 rw-
 110 umask 000 000 010 mode of created file rw-
 110 rw-
 110 r—
 100
  12. Grep • Options! • -v, -l,-L, -A, -B,n, -r/-R! •

    Case! • get templates contains `misc` cssfile! • get templates not contain `footer.php`! • contain `misc` but not `footer.php`
  13. Find • Options! • -name, -perm, -delete,-regex! • !! •

    Case! • find all .swp files! • delete all .swp files! • find not .png and jpg file