1. Trang chủ
  2. » Ngoại Ngữ

unix command line

12 282 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 12
Dung lượng 116,92 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Mastering the UNIX Command LineHoward Mao March 28, 2013... More About PermissionsI Three types of permissions: read r, write w, execute x I Three categories: user u, group g, other o I

Trang 1

Mastering the UNIX Command Line

Howard Mao

March 28, 2013

Trang 2

I Created by Ken Thompson and Dennis Ritchie in 1970

I Modern descendants include Linux, OSX, and BSD

Trang 3

Looking up Information

I Man Pages: man <command>

I Google is your friend

I Stackexchange Sites

I stackoverflow.com

I serverfault.com

I superuser.com

I unix.stackexchange.com

Trang 4

Basic Filesystem Navigation

I look around - ls

I move about - cd, pushd, popd

I move, copy, delete - mv, cp, rm

I file info - stat, du, file

I changing permissions - chmod, chown

Trang 5

More About Permissions

I Three types of permissions: read (r), write (w), execute (x)

I Three categories: user (u), group (g), other (o)

I Also represented by an octal number: read (4), write (2), execute (1)

I Add them together to get number One octal digit for each category

I Ex 644 means read + write for user, read only for group and other, execute for nobody

I Execute permission for directory means you can list files in directory

Trang 6

I Match everything *

I Choices {foo,bar,baz}

I Characters [abc]

I Numbers {0 5}

Trang 7

The Almighty Find

Find allows you to search for files

I By Name: find -name \*.txt

I By Type: find -type d

I By Timestamp: find -mtime 1

I And many many more

Can also run commands on files find -name txt -exec rm {} \;

Trang 8

I/O Redirection

I I/O Commands: echo, cat, less

I Input from File: command < input.txt

I Output to File: command > output.txt

I Pipes : command1 | command2

Trang 9

I Search lines with grep

I Find and Replace with sed

I Select columns with cut and awk

Trang 10

Manipulating Processes

I Start in background: command &

I One after another: command1; command2

I If successful, then: command1 && command2

I If unsuccessful, then: command1 || command2

I Suspend and resume: command <Ctrl>+Z; [bg|fg]

I See running procs: ps, ps -au $USER, ps aux

Trang 11

I Server info - ping, traceroute, host, whois

I Sending raw traffic - nc, telnet

I The World Wide Web - wget, curl

I What’s my address? - ip addr, ip link

I What ports are open - ss, nmap

I Who’s on the port - lsof

Trang 12

I Believe it or not, the shell is turing complete

I Variables : VAR=abc

I If statements : if [ "$VAR" ]; then echo $VAR; fi

I For loops : for i in {1 5}; do echo $i; done

I While loops : while true; do echo "forever"; done

I User input : read var; echo $var

I Functions : function func () { do something }

Ngày đăng: 28/08/2016, 13:23

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN