Introduction to FreeBSD commands

  • Published on
    09-Jun-2015

  • View
    413

  • Download
    8

Embed Size (px)

Transcript

  • 1. Intro. toFreeBSD commands2013 NCU CSIE INFO CLUB & SNMG Author : Egg

2. About . Egg 3A Game 3. Outline 1Unix (-Like), Linux ? - FreeBSD2Commands - User - Owner & Group - File access - Network 4. Unix (-Like), Linux ? 5. Unix (-Like), Linux ? Unix Unix-LikeLinux 6. Unix --> BSD --> FreeBSD --> Linux( Unix-Like ) 7. FreeBSD 8. Pros & Cons 9. Feature 1. Free- Open Source2. Stable - Ports3. Multi-User - PermissionImage from : http://blog.secaserver.com4. No desktop (default) - Terminal 10. Start your FreeBSD 11. VirtualBox 12. Terminal 13. Commands 14. User 15. User name(default: root)password Relate .Login ExitAdd user Change password 16. Login login: root Password: root@:~ #Exit root@:~ # exitlogin: 17. Change password passwd passwd [user] root@:~ # passwd root Changing local password for root New Password: Retype New Password: root@:~ # 18. User root ? 19. root (administrator) 20. Add new user adduser adduser root@:~ # adduser 21. Username: egg Full name: egg Uid (Leave empty for default ): Login group [egg]: Login group is egg. Invite egg into other groups? [ ]: Login class [default]: Shell (sh csh tcsh nologin) [sh]: csh Home directory [/home/egg]: Home directory permissions (Leave empty for default): Use password-based authentication? [yes]: Use an empty password? (yes/no) [no]: Use a random password? (yes/no) [no]: Enter password: Enter password again: Lock out the accout after creation? [no]: Username : egg Password : ***** ../Home Group 22. Task 1 root passwd useradd, exit 23. root@ : ~ # : root :~ 24. ~ /rootroot /home/(user) 25. /root , /home ? 26. / 27. /boot /root/ ()/home/bin /sbin/var /usr . ./home/egg /home/inin . . /var/log /var/mail . . 28. Change Directory cd cd egg@:~ % cd . egg@:~ % egg@:~ % cd .. . .. /var var egg@:/home % egg@:/home % cd /var egg@:/var % 29. List (directory contents) ls ls [ -al ] -a ( . )-l 30. egg@:/var % cd / egg@:/ % ls COPYRIGHT bin boot deventropy etc home liblibexec media mnt procrescue root sbin systmp usr varentropy etc home lib libexecmedia mnt proc rescue rootsbin sys tmp usr varegg@:/ % ls -a . .. .cshrc .profile .snap.sujournal COPYRIGHT bin boot dev 31. egg@:/ % ls -l Total 69 -r--r--r-drwxr-xr-x drwxr-xr-x ...1 2 7root root rootwheel wheel wheel61099 1024 1024Sep 27 12:04 COPYRIGHT Sep 27 12:00 bin Sep 27 12:00 bootwheel wheel wheel1024 1024 968Sep 27 12:04 . Sep 27 12:00 .. Sep 27 12:00 .cshrcegg@:/ % ls -alTotal 32889 drwxr-xr-x 18 drwxr-xr-x 18 -rw-r--r-- 2 ...root root root 32. Owner & Group 33. -r--r--r-drwxr-xr-x lrwxr-xr-x root root rootwheel wheel wheelOwnerGroupCOPYRIGHT bin home->usr/home 34. -r--r--r-drwxr-xr-x lrwxr-xr-x1 2 1root root rootwheel 61099 Sep 27 12:04 COPYRIGHT wheel 1024 Sep 27 12:00 bin wheel 8 Sep 27 12:00 home->usr/homer-rwx rwxr-r-x r-xr-r-x r-x-dld l 35. -r--r--r-drwxr-xr-x lrwxr-xr-x1 2 1root root rootwheel 61099 Sep 27 12:04 COPYRIGHT wheel 1024 Sep 27 12:00 bin wheel 8 Sep 27 12:00 home->usr/homed lr-rwx rwxr-r-x r-xr-r-x r-xrw x 36. File access 37. File ReadExecuteWrite Relate .Read Edit(New) Move Remove Copy 38. Read (Print) file cat, more cat (filename) more (filename) egg@:/ % cat /etc/group bin:*:7: news:*:8: man:*:9: games:*:13: ftp:*:14: ... 39. Read (Print) filemoreegg@:/ % more /etc/group # $FreeBSD: (...) # wheel:*:0:root daemon:*:1: kmem:*:2: sys:*:3: tty:*:4: ... --More--(74%)[space] / "" q 40. Edit (New) file vi vi [filename] egg@:/ % cd ~ egg@:~ % vi test~ ~ ~ ~ 41. Edit (New) filevi i [Esc] : 42. Edit (New) filevi iHello! You can call me Egg. ~ ~ ~ ~ 43. Edit (New) filevi[Esc] hjkld d3l 3 dd yy p 44. Edit (New) filevi ::w :q vi:q! :w [filename] "filename" 45. Task 2 User root /tmp about ex.1005020xx 1993/xx/xxcd vi :wq User /tmp about ex.1005020xx 1993/xx/xx , today : 2013/10/21cat | more 46. Wrong ? 47. 1005020xx 1993/xx/xx, today:2013/10/21 ~ ~ :wq Read-only file, not written; use ! to override.1005020xx 1993/xx/xx, today:2013/10/21 ~ ~ :wq! Error: about: Permission denied. 48. :q! egg@:/tmp % ls -l total 4 -rwxr--r--1 rootwheelOwner : root Group : wheel Other : egg9 Oct 21 13:55 aboutr, w, x r r 49. Change file owner/mode 50. Change file owner chown chown (O) [: G] (filename) root@:/tmp # chown egg about root@:/tmp # ls -l total 4 -rwxr--r--1 eggwheel9 Oct 21 13:55 aboutroot@:/tmp # chown egg:egg about root@:/tmp # ls -l total 4 -rwxr--r--1 eggegg9 Oct 21 13:55 about 51. Change file mode chmod chmod _ _ _ (filename) ___Owner group otherr 4 rwx: 4+2+1 =7 w 2 rw : =6 x 1 r : =4 52. Change file mode chmod chmod _ _ _ (filename) root@:/tmp # chmod 747 about root@:/tmp # ls -l total 4 -rwxr--rwx1 rootwheel9 Oct 21 13:55 about 53. Network 54. root@:/tmp # sysinstall 55. Ping Send the packets to network hosts root@:/tmp # ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8): 56 data bytes 64 bytes from 168.95.1.1: icmp_seq=0 ttl=50 time=10.0 ms 64 bytes from 168.95.1.1: icmp_seq=1 ttl=50 time=10.2 ms ...root@:/tmp # ping www.google.com PING www.foofle.com (202.169.173.216): 56 data bytes 64 bytes from 202.169.173.216 : icmp_seq=0 ttl=58 time=10.0 ms 64 bytes from 202.169.173.216 : icmp_seq=1 ttl=58 time=10.2 ms ... 56. Need some help ? 57. Display manual pages man man (command) root@:/ # man ls Name ls -- list directory contents SYNOPSIS ls [-A...] ... 58. Final. 59. Close down the system shutdown shutdown [-p] time -p halt, power off root@:/ # shutdown p now 60. End 61. We areSNMG System and Network Management Group 62. Thanks for NCU CSIE INFO CLUB