Home | Mirror | Search

Netkiller Linux Basics 手札

Debian Family(Ubuntu) Handbook

Mr. Neo Chan, 陳景峰(BG7NYT)


中國廣東省深圳市龍華新區民之街道溪山美地
518109
+86 13113668890
+86 755 29812080

版權聲明

轉載請與作者聯繫,轉載時請務必標明文章原始出處和作者信息及本聲明。

文檔出處:
http://netkiller.sourceforge.net
http://netkiller.github.com

內容摘要

對初學Linux的愛好者忠告

玩Linux最忌reboot(重新啟動)這是windows玩家壞習慣

Linux只要接上電源你就不要再想用reboot,shutdown,halt,poweroff命令,Linux系統和應用軟件一般備有reload,reconfigure,restart/start/stop...不需要安裝軟件或配置伺服器後使用reboot重新引導計算機

在Linux系統裡SIGHUP信號被定義為刷新配置檔案,有些程序沒有提供reload參數,你可以給進程發送HUP信號,讓它刷新配置檔案,而不用restart.通過pkill,killall,kill 都可以發送HUP信號例如: pkill -HUP httpd


您可以使用iBook閲讀當前文檔

目錄

自述
1. 系列文檔
2. 作者簡介
3. 寫給讀者
1. System Infomation
1. Cpu Bit
2. shutdown
3. Profile
1. shell
4. Introduction
1. Distribution Version
2. Distribution information
3. Linux Installation
3.1. HDD Partition
5. Kernel
6. Package Management
1. apt-cache
1.1. search
1.2. depends
1.3. policy
2. Apt-Get
2.1. Search
2.2. Installation
2.3. Update
2.4. Remove
3. aptitude
4. Automatic Updates
5. dpkg
5.1. -i|--install 安裝.deb包
5.2. -r|--remove 卸載.deb包
5.3. -L|--listfiles <package> ... List files `owned' by package(s). 列出包中的檔案
5.4. -l|--list [<pattern> ...] List packages concisely. 列出.deb包
5.5. Status
5.6. dpkg-deb - Debian package archive (.deb) manipulation tool
5.6.1. -X, --vextract archive directory Extract and display the filenames contained by a package
5.6.2. -e, --control archive [directory] Extracts the control information files from a package archive into the specified directory.
5.6.3. -b, --build directory [archive|directory]
5.7. dpkg-reconfigure
6. Upgrading
6.1. GUI
6.2. CLI
6.3. CDROM
7. 製作.deb安裝包
7.1. checkinstall — Track installation of local software, and produce a binary manageable with your package management software.
7.2. dh_make - prepare Debian packaging for an original source archive
7.3. control
7. Device information
1. dmesg - print or control the kernel ring buffer
2. smartctl - Control and Monitor Utility for SMART Disks
3. lspci - list all PCI devices
4. dmidecode - DMI table decoder
5. ethtool - Display or change ethernet card settings
6. usb device
7. SCSI
8. HBA
9. kudzu - detects and configures new and/or changed hardware on a system
8. udev - Linux dynamic device management
9. Kernel modules
1. modprobe - program to add and remove modules from the Linux Kernel
10. Locale
1. time zone
2. to change system date/time
2.1. NTP Server
3. Language
11. console / terminal
1. serial console
2. console timeout
3. TUI (Text User Interface)
4. framebuffer
12. Harddisk
1. 查看分區分區 UUID
2. Label
2.1. Ext2
2.1.1. 查看卷標
2.1.2. 更改卷標
3. 臨時增加 swap 分區
4. Show partition
5. Create partition
6. Clone partition
7. Format partition
7.1. ext3
7.2. ReiserFS
8. estimate disk / directory / file space usage
9. Convert from ext3 to ext4 File system
10. GPT
10.1. 查看分區
10.2. 創建分區
10.3. 退出
10.4. mount
11. loop devices
11.1. losetup - set up and control loop devices
13. Removable Storage
1. usb flash
2. CD / DVD
2.1. Mount an ISO file
2.2. create iso file from CD
2.3. burner
2.4. ISO Mirror
14. File System
1. Mount partition
1.1. Mount
1.2. Umount
1.3. bind directory
1.4. /etc/fstab
2. RAM FS
3. tmpfs
4. ftp fs
5. SSHFS (sshfs - filesystem client based on SSH File Transfer Protocol)
6. davfs2 - mount a WebDAV resource as a regular file system
7. File system test
7.1. ext4 vs btrfs
7.2. xfs vs jfs vs reiserfs
7.3. RAID10 (146G*8) vs EMC VNX 5300 (8G Fibre Channel)
7.4. Dell 2950(RAID5 500G SATA * 6) vs MD1200
15. Networking
1. Hostname
1.1. /etc/hostname
1.2. /etc/host.conf
1.3. /etc/hosts
1.4. hosts.allow / hosts.deny
1.5. /etc/resolv.conf
2. Network adapter
3. Ethernet Interfaces
3.1. ifquery
3.2. DHCP
3.3. Static IP
4. Mask
5. Gateway
6. Configuring Name Server Lookups
7. sysctl
8. bonding
8.1. Ubuntu
9. Finding optimal MTU
10. 介面名稱
16. Logging
1. syslog, klogctl - read and/or clear kernel message ring buffer; set console_loglevel
1.1. /etc/sysconfig/syslog
1.2. /etc/syslog.conf
1.3. logger
1.4. To Log Messages Over UDP Network
2. logrotate - rotates, compresses, and mails system logs
2.1. /etc/logrotate.conf
2.2. /etc/logrotate.d/
2.2.1. apache2
2.2.2. mysql
2.2.3. cacti
3. remote syslog
3.1. syslog-ng
3.2. rsyslog
17. Service
1. update-rc.d - install and remove System-V style init script links
2. invoke-rc.d - executes System-V style init script actions
3. runlevel
4. sysv-rc-conf
5. xinetd - replacement for inetd with many enhancements
5.1. tftpd
6. Scheduled Tasks
6.1. crontab - maintain crontab files for individual users
6.2. at, batch, atq, atrm - queue, examine or delete jobs for later execution
7. sv - control and manage services monitored by runsv
7.1. runsv
7.2. runsvdir
18. Process
1. top - display Linux tasks
2. ps - report a snapshot of the current processes
2.1. ps axef
2.2. ps -eo pid,cmd
2.3. ps jax
2.4. zombie process
3. mpstat
4. pstree - display a tree of processes
5. pid
5.1. pgrep, pkill - look up or signal processes based on name and other attributes
5.2. pidof -- find the process ID of a running program.
6. jobs
6.1. &
6.2. Ctrl + Z
6.3. jobs
6.4. fg / bg
6.5. nohup - run a command immune to hangups, with output to a non-tty
7. ionice - get/set program io scheduling class and priority
19. Authentication
1. User
1.1. Add a new user
1.2. remove an existed user
1.3. usermod - modify a user account
1.4. lock / unlock
1.4.1. /etc/passwd
2. Group
2.1. Add a new group
2.2. Add a user to the group
2.3. /etc/group
20. Permission
1. umask
2. Access Permissions
2.1. chown - change file owner and group
2.2. chgrp - change group ownership
2.3. chmod - change file access permissions
3. chattr - change file attributes on a Linux second extended file system
4. su - run a shell with substitute user and group IDs
5. sudo, sudoedit - execute a command as another user
5.1. NOPASSWD
5.2. 允許或禁止命令
5.3. Cmnd_Alias 用法
6. ACL - Access Control List
6.1. getfacl - get file access control lists
6.2. setfacl - set file access control lists
6.2.1. set
6.2.2. default
6.2.3. remove
6.3. backup and restore
I. System Commands
21. Help Commands
1. man - an interface to the on-line reference manuals
1.1. manpath.config
1.2. 查看man手冊位置
1.3. 指定手冊位置
22. Directory and File System Related
1. dirname
2. filename
2.1. 排除副檔名
2.2. 取副檔名
3. test - check file types and compare values
4. stat
5. mkdir - make directories
6. rename
7. touch
8. ls - list directory contents
9. cp - copy files and directories
9.1. copy directories recursively
9.2. overwrite an existing file
10. rm - remove files or directories
10.1. -bash: /bin/rm: Argument list too long
10.2. zsh: sure you want to delete all the files in /tmp [yn]?
11. df - report file system disk space usage
12. du - estimate file space usage
13. tac - concatenate and print files in reverse
14. find - search for files in a directory hierarchy
14.1. name
14.2. regex
14.3. user
14.4. perm
14.5. type
14.5.1. 分別設置檔案與目錄的權限
14.6. -delete
14.7. exec
14.8. xargs
14.9. 排除目錄
14.10. -mtime / -mmin
14.11. --newer
14.12. -print / -printf
23. package / compress and decompress
1. tar — The GNU version of the tar archiving utility
1.1. tar examples
1.2. gunzip
1.3. b2zip
1.4. compress
1.5. -t, --list
1.6. tar: Removing leading `/’ from member names
1.7. -C, --directory=DIR
1.8. --exclude
1.9. -T
1.10. 日期過濾
1.11. 保留權限
1.12. -r, --append
1.13. 遠程傳輸
1.14. 分卷壓縮
2. cpio - copy files to and from archives
3. gzip
4. zip, zipcloak, zipnote, zipsplit - package and compress (archive) files
5. RAR
6. 7-Zip
24. date and time
1. 日期格式
2. -d --date=
2.1. 日期偏移量
2.1.1. day
2.1.2. month
2.1.3. year
2.2. 時間偏移
3. weekday name
4. UTC
25. Numeric
1. 數值運算
2. seq - print a sequence of numbers
3. bc - An arbitrary precision calculator language
26. Text Processing
1. iconv - Convert encoding of given files from one encoding to another
1.1. cconv - A iconv based simplified-traditional chinese conversion tool
2. 字元串處理命令expr
3. cat - concatenate files and print on the standard output
3.1. -s, --squeeze-blank suppress repeated empty output lines
4. nl - number lines of files
5. od - dump files in octal and other formats
5.1. 16進制
6. tr - translate or delete characters
7. cut - remove sections from each line of files
8. printf - format and print data
9. Free `recode' converts files between various character sets and surfaces.
10. /dev/urandom 隨機字元串
11. col - filter reverse line feeds from input
12. apg - generates several random passwords
13. head/tail
14. grep, egrep, fgrep, rgrep - print lines matching a pattern
14.1. 刪除空行
14.2. -v, --invert-match
14.3. Output control
14.3.1. -o, --only-matching show only the part of a line matching PATTERN
14.3.2. 遞歸操作
14.3.3. -c, --count print only a count of matching lines per FILE
14.4. Context control
14.4.1. -A, --after-context=NUM print NUM lines of trailing context
14.4.2. -B, --before-context=NUM print NUM lines of leading context
14.4.3. -C, --context=NUM print NUM lines of output context
14.4.4. --color
14.5. Regexp selection and interpretation
14.5.1. .*
14.5.2. 2010:(13|14|15|16)
14.5.3. []與{}
14.6. ^M
14.7. egrep
15. sort - sort lines of text files
15.1. 對列排序
16. uniq
17. 行列轉換,表格操作
17.1. column - columnate lists
17.2. paste - merge lines of files
27. Logging
1. logger - a shell command interface to the syslog(3) system log module
28. Password
1. Shadow password suite configuration.
2. newusers - update and create new users in batch
3. chpasswd - update passwords in batch mode
29. binutils
1. strings - print the strings of printable characters in files.
30. Utility Programs
1. ed, red - text editor
2. vim
2.1. 查找與替換
2.2. 批處理
2.2.1. vi 批處理
2.3. line()
3. awk
3.1. 處理列
3.2. printf
3.3. 查找檔案並刪除
3.4. Pattern(字元匹配)
3.4.1. Pattern, Pattern
3.5. Built-in Variables
3.5.1. NF
3.6. Built-in Functions
3.6.1. length
3.7. 過濾相同的行
4. sed
4.1. find and replace
4.1.1. 正則
4.1.2. delete
4.1.3. aaa="bbb" 提取bbb
5. CURL - transfer a URL
5.1. 基本用法
5.2. data
5.3. connect-timeout
5.4. compressed
5.5. vhosts
5.6. http status
5.7. -A/--user-agent <agent string>
5.8. referer
5.9. -v
5.10. -o/--output <file>
5.11. -H/--header <line> Custom header to pass to server (H)
5.11.1. Last-Modified / If-Modified-Since
5.11.2. ETag / If-None-Match
5.11.3. Accept-Encoding:gzip,defalte
5.11.4. HOST
6. expect
6.1. 模擬登錄 telnet 獲取Cisco配置
6.2. 模擬登錄 ssh
6.3. SCP
7. wget - retrieves files from the web
7.1. HTTP options
7.1.1. --post-data=STRING use the POST method; send STRING as the data.
7.2. Recursive download
7.2.1. -r, --recursive specify recursive download.
7.2.2. -m, --mirror shortcut for -N -r -l inf --no-remove-listing.
7.3. --no-passive-ftp disable the "passive" transfer mode.
8. screen - screen manager with VT100/ANSI terminal emulation
9. TUI
9.1. tmux
9.2. htop - interactive process viewer
9.3. elinks
9.4. chat
II. Shell
31. Introduction
1. chsh - change login shell
2. test 命令
3. I/O 重定向
3.1. error 重定向
3.2. 使用塊記錄日誌
3.3. tee - read from standard input and write to standard output and files
3.3.1. nettee - a network "tee" program
3.4. 快速清空一個檔案的內容
4. pipes (FIFOs)
5. mktemp - create a temporary file or directory 臨時目錄與檔案
6. History 命令歷史記錄
6.1. .bash_history
6.2. .mysql_history
32. Bash Shell
1. bash - GNU Bourne-Again SHell
1.1. -n 檢查腳本是否有語法錯誤
1.2. -x 顯示詳細運行過程
2. prompt
3. Internal Environment Variables
4. variable
4.1. set
4.2. export / unset
4.3. declare
4.4. 系統變數
4.5. Strings
4.5.1. ##/#
4.5.2. %%/%
4.5.3. :n1:n2
4.5.4. #
4.5.5. example
4.6. Array
4.7. eval
5. conditions if and case
5.1. if
5.2. case
6. Loops for, while and until
6.1. for
6.2. while
6.3. until
7. Functions
7.1. Local variables
8. User interfaces
8.1. input
33. Z Shell
1. installing Z shell
2. Starting file
2.1. ~/.zshrc
3. Prompting
4. Aliases
5. History
6. FAQ
6.1. Home/End key
34. Shell TUI
1. terminal
1.1. resize - set TERMCAP and terminal settings to current xterm window size
1.2. tset, reset - terminal initialization
1.3. stty - change and print terminal line settings
2. tput
3. dialog
3.1. --inputbox
4. whiptail - display dialog boxes from shell scripts
4.1. --msgbox
4.2. --infobox
4.3. --yesno
4.4. --inputbox
4.5. --passwordbox
4.6. --textbox
4.7. --checklist
4.8. --radiolist
4.9. --menu
4.10. --gauge
35. Example
1. 有趣的Shell
2. backup
3. CPU 核心數
4. Password
5. processes
5.1. pid
5.2. kill
5.3. pgrep
6. Shell 技巧
6.1. 行轉列,再批評
6.2. for vs while
6.3. 遍歷字元串
36. Open Source Distributed Computing
1. Boinc (berkeley 分散式計算平台)
1.1. rc.local
2. ubuntu apt-get 安裝
3. boinccmd
3.1. attach_project
3.2. nomorework | allowmorework 禁止下載任務 / 允許下載任務
III. X Window
37. install x window
38. X Setup
1. 取消開機啟動畫面
2. Automatic login
3. fonts 字型
4. disable x window
39. X Terminal
1. tsclient - Terminal Server Client supporting XDMCP, VNC and RDP
1.1. VNC
1.2. xdmcp
2. vinagre - a remote desktop viewer for the GNOME Desktop
3. rdesktop - A Remote Desktop Protocol client
3.1. -g: desktop geometry (WxH)
3.2. -f: full-screen mode
3.3. -A: enable SeamlessRDP mode
3.4. -z: enable rdp compression
3.5. -r: enable specified device redirection (this flag can be repeated)
4. TightVNC
40. Unity
1. Enable/Disable Auto Hide For Unity 2-D Launcher In Ubuntu 11.10
41. X Window System
1. Fluxbox
2. LXDE
3. Xfce
4. Xming X Server for Windows
42. X Application Software
1. ubuntu-restricted-extras
2. Keyboard Input Methods(輸入法)
3. Firefox
4. Download Software
5. PAC Manager
6. LibreOffice
7. VYM (View Your Mind)
8. greenshot
43. Office
1. Calc
1.1. 函數
A. 附錄
1. Linux 下載排名
B. 歷史記錄

表格清單

4.1. Linux partition
32.1. 檔案目錄表達式
32.2. 字元串表達式
32.3. 組合表達式

範例清單

12.1. GPT Example
15.1. bonding example
22.1. backup(find + tar)
30.1. example for expect
30.2. example for expect
30.3. example 1
30.4. *.exp
32.1. A "Power User" Prompt
32.2. A Prompt the Width of Your Term
32.3. The Elegant Useless Clock Prompt
32.4. Basic conditional example if .. then
32.5. Conditionals with variables
32.6. case
32.7. Functions with parameters sample
32.8. Using select to make simple menus
32.9. Using the command line
32.10. Reading user input with read
32.11. read
34.1. whiptail - yesno
34.2. whiptail - inputbox
34.3. whiptail - passwordbox
34.4. whiptail - passwordbox
34.5. whiptail - example 1
34.6. whiptail - radiolist
35.1. random password
comments powered by Disqus