Home | 简体中文 | 繁体中文 | 杂文 | Search | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 作品与服务 | Email

Netkiller Linux Basics 手札

Debian Family(Ubuntu) Handbook

Mr. Neo Chan, 陈景峰(BG7NYT)


中国广东省深圳市龙华新区民治街道溪山美地
518131
+86 13113668890
+86 755 29812080

版权声明

转载请与作者联系,转载时请务必标明文章原始出处和作者信息及本声明。

文档出处:
http://netkiller.github.io
http://netkiller.sourceforge.net

微信扫描二维码进入 Netkiller 微信订阅号

QQ群:128659835 请注明“读者”

内容摘要

[注意]对初学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

[提示]对Linux高级玩家的忠告

其实升级Linux内核也无需reboot(重新启动)目前Linux已经具被改特性,这之前只有小型机才有的特性


您可以使用iBook阅读当前文档

QQ群:128659835 请注明“读者”

目录

1. 自述
1.1. 系列文档
1.2. 作者简介
1.3. 写给读者
1. Introduction
1.1. Linux 发行版本
1.1.1. Debian 衍生版本
1.1.2. Redhat 衍生版本
1.1.3. FreeBSD 包风格的Linux 发行版
1.1.4. Linux 下载排名
1.2. Distribution information
1.3. Linux Installation
1.3.1. HDD Partition
1.4. System Infomation
1.4.1. Cpu Bit
1.5. shutdown
1.6. Profile
1.6.1. shell
2. Kernel
2.1. 编译安装内核
2.2. sysctl - configure kernel parameters at runtime
2.2.1. sysctl.d
2.2.2. vm.overcommit_memory
2.3. /sys
2.3.1. /sys/class/net/
2.4. /proc
2.4.1. 进程内存监控
2.4.2. ulimit 状态
3. Package Management
3.1. apt-cache
3.1.1. search
3.1.2. depends
3.1.3. policy
3.2. Apt-Get
3.2.1. Search
3.2.2. Installation
3.2.3. Update
3.2.4. Remove
3.3. aptitude
3.4. Automatic Updates
3.5. dpkg
3.5.1. -i|--install 安装.deb包
3.5.2. -r|--remove 卸载.deb包
3.5.3. -L|--listfiles <package> ... List files `owned' by package(s). 列出包中的文件
3.5.4. -l|--list [<pattern> ...] List packages concisely. 列出.deb包
3.5.5. Status
3.5.6. dpkg-deb - Debian package archive (.deb) manipulation tool
3.5.6.1. -X, --vextract archive directory Extract and display the filenames contained by a package
3.5.6.2. -e, --control archive [directory] Extracts the control information files from a package archive into the specified directory.
3.5.6.3. -b, --build directory [archive|directory]
3.5.7. dpkg-reconfigure
3.6. Upgrading
3.6.1. GUI
3.6.2. CLI
3.6.3. CDROM
3.7. 制作.deb安装包
3.7.1. checkinstall — Track installation of local software, and produce a binary manageable with your package management software.
3.7.2. dh_make - prepare Debian packaging for an original source archive
3.7.3. control
4. Device information
4.1. dmesg - print or control the kernel ring buffer
4.2. smartctl - Control and Monitor Utility for SMART Disks
4.3. lspci - list all PCI devices
4.4. lshw - list hardware
4.4.1. only show a certain class of hardware
4.5. hwinfo - Hardware Information
4.6. dmidecode - DMI table decoder
4.7. ethtool - Display or change ethernet card settings
4.8. usb device
4.9. lsscsi - list SCSI devices (or hosts) and their attributes
4.10. HBA
4.11. lsblk - list block devices
4.12. kudzu - detects and configures new and/or changed hardware on a system
5. udev - Linux dynamic device management
6. Kernel modules
6.1. modprobe - program to add and remove modules from the Linux Kernel
7. Locale
7.1. time zone
7.2. to change system date/time
7.2.1. NTP Server
7.3. Language
8. console / terminal
8.1. serial console
8.2. console timeout
8.3. TUI (Text User Interface)
8.4. framebuffer
9. Harddisk
9.1. 查看分区分区 UUID
9.2. Label
9.2.1. Ext2
9.2.1.1. 查看卷标
9.2.1.2. 更改卷标
9.3. 临时增加 swap 分区
9.4. Show partition
9.5. Create partition
9.6. Clone partition
9.7. Format partition
9.7.1. ext3
9.7.2. ReiserFS
9.8. estimate disk / directory / file space usage
9.9. Convert from ext3 to ext4 File system
9.10. GPT
9.10.1. 设置GTP磁盘
9.10.2. 查看分区
9.10.3. 创建分区
9.10.4. 删除分区
9.10.5. 退出
9.10.6. mount
9.11. loop devices
9.11.1. losetup - set up and control loop devices
10. Removable Storage
10.1. usb flash
10.2. CD / DVD
10.2.1. Mount an ISO file
10.2.2. create iso file from CD
10.2.3. burner
10.2.4. ISO Mirror
11. File System
11.1. /etc/fstab
11.1.1. /etc/fstab 例子
11.2. Mount partition
11.2.1. Mount
11.2.2. Umount
11.2.3. bind directory
11.3. RAM FS
11.4. tmpfs
11.5. ftp fs
11.6. SSHFS (sshfs - filesystem client based on SSH File Transfer Protocol)
11.7. davfs2 - mount a WebDAV resource as a regular file system
11.8. redisfs
11.9. File system test
11.9.1. ext4 vs btrfs
11.9.2. xfs vs jfs vs reiserfs
11.9.3. RAID10 (146G*8) vs EMC VNX 5300 (8G Fibre Channel)
11.9.4. Dell 2950(RAID5 500G SATA * 6) vs MD1200
12. Networking
12.1. Hostname
12.1.1. /etc/hostname
12.1.2. /etc/host.conf
12.1.3. /etc/hosts
12.1.4. hosts.allow / hosts.deny
12.1.5. /etc/resolv.conf
12.2. Network adapter
12.2.1. 接口名称
12.3. Ethernet Interfaces
12.3.1. ifquery
12.3.2. DHCP
12.3.3. Static IP
12.4. Mask
12.5. Gateway
12.6. Configuring Name Server Lookups
12.7. IP forwarding(IP转发)
12.8. bonding
12.8.1. Ubuntu
12.9. Finding optimal MTU
12.10. wireless
12.10.1. rfkill - tool for enabling and disabling wireless devices
12.10.2. iwlist - Get more detailed wireless information from a wireless interface
12.10.3. iwconfig - configure a wireless network interface
12.10.4. /proc/net/wireless
13. Logging
13.1. rsyslog
13.1.1. rsyslog.conf
13.2. logrotate - rotates, compresses, and mails system logs
13.2.1. /etc/logrotate.conf
13.2.2. /etc/logrotate.d/
13.2.2.1. apache2
13.2.2.2. mysql
13.2.2.3. cacti
13.3. syslog-ng
13.4. syslog, klogctl - read and/or clear kernel message ring buffer; set console_loglevel
13.4.1. /etc/sysconfig/syslog
13.4.2. /etc/syslog.conf
13.4.3. logger
13.4.4. To Log Messages Over UDP Network
14. Service
14.1. update-rc.d - install and remove System-V style init script links
14.2. invoke-rc.d - executes System-V style init script actions
14.3. runlevel
14.4. sysv-rc-conf
14.5. xinetd - replacement for inetd with many enhancements
14.5.1. tftpd
14.6. Scheduled Tasks
14.6.1. crontab - maintain crontab files for individual users
14.6.2. at, batch, atq, atrm - queue, examine or delete jobs for later execution
14.7. sv - control and manage services monitored by runsv
14.7.1. runsv
14.7.2. runsvdir
15. Process
15.1. top - display Linux tasks
15.2. ps - report a snapshot of the current processes
15.2.1. ps axef
15.2.2. ps -eo pid,cmd
15.2.3. ps jax
15.2.4. zombie process
15.3. mpstat
15.4. pstree - display a tree of processes
15.5. pid
15.5.1. pgrep, pkill - look up or signal processes based on name and other attributes
15.5.2. pidof -- find the process ID of a running program.
15.6. jobs
15.6.1. &
15.6.2. Ctrl + Z
15.6.3. jobs
15.6.4. fg / bg
15.6.5. nohup - run a command immune to hangups, with output to a non-tty
15.7. ionice - get/set program io scheduling class and priority
15.8. /proc 目录与进程的关系
16. Permission
16.1. User
16.1.1. Add a new user
16.1.2. remove an existed user
16.1.3. usermod - modify a user account
16.1.4. lock / unlock
16.1.4.1. /etc/passwd
16.2. Group
16.2.1. Add a new group
16.2.2. Add a user to the group
16.2.3. /etc/group
16.3. umask
16.4. Access Permissions
16.4.1. chown - change file owner and group
16.4.2. chgrp - change group ownership
16.4.3. chmod - change file access permissions
16.5. chattr - change file attributes on a Linux second extended file system
16.6. su - run a shell with substitute user and group IDs
16.7. sudo, sudoedit - execute a command as another user
16.7.1. NOPASSWD
16.7.2. 允许或禁止命令
16.7.3. Cmnd_Alias 用法
16.8. ACL - Access Control List
16.8.1. getfacl - get file access control lists
16.8.2. setfacl - set file access control lists
16.8.2.1. set
16.8.2.2. default
16.8.2.3. remove
16.8.3. backup and restore
17. /etc
17.1. /etc/inputrc
17.2. /etc/shells
18. Bash Shell
18.1. bash - GNU Bourne-Again SHell
18.1.1. -n 检查脚本是否有语法错误
18.1.2. -x 显示详细运行过程
18.2. Introduction
18.2.1. chsh - change login shell
18.2.2. test 命令
18.2.3. I/O 重定向
18.2.3.1. error 重定向
18.2.3.2. 使用块记录日志
18.2.3.3. tee - read from standard input and write to standard output and files
18.2.3.4. 创建文件
18.2.3.5. 快速清空一个文件的内容
18.2.4. pipes (FIFOs)
18.2.5. mktemp - create a temporary file or directory 临时目录与文件
18.2.6. History 命令历史记录
18.2.6.1. .bash_history
18.2.6.2. .mysql_history
18.2.7. hash - hash database access method
18.2.8. prompt
18.3. variable
18.3.1. 表达式
18.3.2. Internal Environment Variables
18.3.3. set 设置变量
18.3.4. unset 变量销毁
18.3.5. 设置变量默认值
18.3.6. export 设置全局变量
18.3.7. declare
18.3.8. 系统变量
18.3.9. Numerical 数值运算
18.3.10. Strings 字符串操作
18.3.10.1. ##/#
18.3.10.2. %%/%
18.3.10.3. :n1:n2
18.3.10.4. #
18.3.10.5. example
18.3.10.6. 计算字符串长度
18.3.10.7. 字符串查找替换
18.3.11. Array 数组
18.3.11.1. 拆分字符串并转换为数组
18.3.11.2. 数组转为字符串
18.3.12. eval
18.4. conditions if and case
18.4.1. if
18.4.2. case
18.5. Loops for, while and until
18.5.1. for
18.5.2. while
18.5.3. until
18.6. Functions
18.6.1. Local variables
18.7. User interfaces
18.7.1. input
18.8. Example
18.8.1. 有趣的Shell
18.8.2. backup
18.8.3. CPU 核心数
18.8.4. Password
18.8.5. processes
18.8.5.1. pid
18.8.5.2. kill
18.8.5.3. pgrep
18.8.6. Shell 技巧
18.8.6.1. 行转列,再批评
18.8.6.2. for vs while
18.8.6.3. 遍历字符串
18.8.7. to convert utf-8 from gb2312 code
18.8.8. 使用内存的百分比
18.8.9. 合并apache被cronlog分割的log文件
19. Z Shell
19.1. installing Z shell
19.2. Starting file
19.2.1. ~/.zshrc
19.3. Prompting
19.4. Aliases
19.5. History
19.6. FAQ
19.6.1. Home/End key
20. Shell command
20.1. Help Commands
20.1.1. man - an interface to the on-line reference manuals
20.1.1.1. manpath.config
20.1.1.2. 查看man手册位置
20.1.1.3. 指定手册位置
20.2. getconf - Query system configuration variables
20.3. Directory and File System Related
20.3.1. dirname
20.3.2. filename
20.3.2.1. 排除扩展名
20.3.2.2. 取扩展名
20.3.3. test - check file types and compare values
20.3.4. stat
20.3.5. mkdir - make directories
20.3.6. rename
20.3.7. touch
20.3.8. ls - list directory contents
20.3.9. cp - copy files and directories
20.3.9.1. copy directories recursively
20.3.9.2. overwrite an existing file
20.3.9.3. -a, --archive same as -dR --preserve=all
20.3.10. rm - remove files or directories
20.3.10.1. -bash: /bin/rm: Argument list too long
20.3.10.2. zsh: sure you want to delete all the files in /tmp [yn]?
20.3.11. df - report file system disk space usage
20.3.12. du - estimate file space usage
20.3.13. tac - concatenate and print files in reverse
20.3.14. split - split a file into pieces
20.3.14.1. 按行分割文件
20.3.14.2. 按尺寸分割文件
20.3.15. find - search for files in a directory hierarchy
20.3.15.1. name
20.3.15.2. regex
20.3.15.3. user
20.3.15.4. perm
20.3.15.5. type
20.3.15.6. -delete
20.3.15.7. exec
20.3.15.8. xargs
20.3.15.9. 排除目录
20.3.15.10. -mtime / -mmin
20.3.15.11. --newer
20.3.15.12. -print / -printf
20.3.15.13. -size
20.4. package / compress and decompress
20.4.1. tar — The GNU version of the tar archiving utility
20.4.1.1. tar examples
20.4.1.2. gunzip
20.4.1.3. b2zip
20.4.1.4. compress
20.4.1.5. -t, --list
20.4.1.6. tar: Removing leading `/’ from member names
20.4.1.7. -C, --directory=DIR
20.4.1.8. -P, --absolute-names don't strip leading `/'s from file names
20.4.1.9. --exclude
20.4.1.10. -T
20.4.1.11. 日期过滤
20.4.1.12. 保留权限
20.4.1.13. -r, --append
20.4.1.14. 远程传输
20.4.1.15. 分卷压缩
20.4.2. cpio - copy files to and from archives
20.4.3. gzip
20.4.4. zip, zipcloak, zipnote, zipsplit - package and compress (archive) files
20.4.5. RAR
20.4.6. 7-Zip
20.4.6.1. 压缩
20.4.6.2. 浏览压缩包
20.4.6.3. 解压
20.4.6.4. Creates self extracting archive.
20.5. date and time
20.5.1. 日期格式
20.5.2. -d --date=
20.5.2.1. 日期偏移量
20.5.2.2. 时间偏移
20.5.3. weekday name
20.5.4. UTC
20.6. Numeric
20.6.1. 数值运算
20.6.2. seq - print a sequence of numbers
20.6.3. bc - An arbitrary precision calculator language
20.7. Text Processing
20.7.1. iconv - Convert encoding of given files from one encoding to another
20.7.1.1. cconv - A iconv based simplified-traditional chinese conversion tool
20.7.1.2. uconv - convert data from one encoding to another
20.7.2. 字符串处理命令expr
20.7.3. cat - concatenate files and print on the standard output
20.7.3.1. -s, --squeeze-blank suppress repeated empty output lines
20.7.4. nl - number lines of files
20.7.5. od - dump files in octal and other formats
20.7.5.1. 16进制
20.7.6. tr - translate or delete characters
20.7.7. cut - remove sections from each line of files
20.7.8. printf - format and print data
20.7.9. Free `recode' converts files between various character sets and surfaces.
20.7.10. /dev/urandom 随机字符串
20.7.11. col - filter reverse line feeds from input
20.7.12. apg - generates several random passwords
20.7.13. head/tail
20.7.14. grep, egrep, fgrep, rgrep - print lines matching a pattern
20.7.14.1. 删除空行
20.7.14.2. -v, --invert-match
20.7.14.3. Output control
20.7.14.4. Context control
20.7.14.5. Regexp selection and interpretation
20.7.14.6. ^M
20.7.14.7. egrep
20.7.15. sort - sort lines of text files
20.7.15.1. 对列排序
20.7.16. uniq
20.7.17. 行列转换,表格操作
20.7.17.1. column - columnate lists
20.7.17.2. paste - merge lines of files
20.7.18. 反转字符串或文件内容
20.8. Logging
20.8.1. logger - a shell command interface to the syslog(3) system log module
20.9. Password
20.9.1. Shadow password suite configuration.
20.9.2. newusers - update and create new users in batch
20.9.3. chpasswd - update passwords in batch mode
20.10. binutils
20.10.1. strings - print the strings of printable characters in files.
22. Utility Programs
22.1. ed, red - text editor
22.2. vim
22.2.1. 查找与替换
22.2.2. 批处理
22.2.2.1. vi 批处理
22.2.3. line()
22.3. CURL - transfer a URL
22.3.1. 基本用法
22.3.2. data
22.3.3. connect-timeout
22.3.4. compressed
22.3.5. vhosts
22.3.6. 输出格式定义
22.3.7. -A/--user-agent <agent string>
22.3.8. referer
22.3.9. -v
22.3.10. -o/--output <file>
22.3.11. -H/--header <line> Custom header to pass to server (H)
22.3.11.1. Last-Modified / If-Modified-Since
22.3.11.2. ETag / If-None-Match
22.3.11.3. Accept-Encoding:gzip,defalte
22.3.11.4. HOST
22.3.11.5. HTTP 认证
22.3.12. curl-config
22.3.13. FAQ
22.4. awk
22.4.1. 处理列
22.4.2. printf
22.4.3. Pattern(字符匹配)
22.4.3.1. Pattern, Pattern
22.4.4. Built-in Variables
22.4.4.1. NR
22.4.4.2. NF
22.4.5. Built-in Functions
22.4.5.1. length
22.4.6. 过滤相同的行
22.5. sed
22.5.1. 查找与替换
22.5.1.1. 正则
22.5.1.2. delete
22.5.1.3. aaa="bbb" 提取bbb
22.5.1.4. 首字母大写
22.5.2. 编辑文件
22.5.3. 内容打印
22.5.4. 编辑操作
22.6. expect
22.6.1. 模拟登录 telnet 获取Cisco配置
22.6.2. 模拟登录 ssh
22.6.3. SCP
22.7. expect-lite - quick and easy command line automation tool
22.8. sshpass - noninteractive ssh password provider
22.9. Klish - Kommand Line Interface Shell (the fork of clish project)
22.9.1. 安装Klish
22.9.2. 为用户指定clish作为默认Shell
22.9.3. FAQ
22.9.3.1. clish/shell/shell_expat.c:36:19: fatal error: expat.h: No such file or directory
22.10. Limited command Shell (lshell)
22.11. wget - retrieves files from the web
22.11.1. Logging and input file
22.11.1.1. -i, --input-file=FILE download URLs found in local or external FILE.
22.11.2. HTTP options
22.11.2.1. --post-data=STRING use the POST method; send STRING as the data.
22.11.3. Recursive download
22.11.3.1. -r, --recursive specify recursive download.
22.11.3.2. -m, --mirror shortcut for -N -r -l inf --no-remove-listing.
22.11.4. --no-passive-ftp disable the "passive" transfer mode.
22.12. TUI
22.12.1. screen - screen manager with VT100/ANSI terminal emulation
22.12.2. tmux — terminal multiplexer
22.12.3. byobu - wrapper script for seeding a user's byobu configuration and launching a text based window manager (either screen or tmux)
22.12.4. htop - interactive process viewer
22.12.5. elinks
22.12.6. chat
22.13. parallel - build and execute shell command lines from standard input in parallel
23. Shell Terminal
23.1. terminal
23.1.1. resize - set TERMCAP and terminal settings to current xterm window size
23.1.2. tset, reset - terminal initialization
23.1.3. stty - change and print terminal line settings
23.2. tput
23.2.1. Change the prompt color using tput
23.3. dialog
23.3.1. --inputbox
23.4. whiptail - display dialog boxes from shell scripts
23.4.1. --msgbox
23.4.2. --infobox
23.4.3. --yesno
23.4.4. --inputbox
23.4.5. --passwordbox
23.4.6. --textbox
23.4.7. --checklist
23.4.8. --radiolist
23.4.9. --menu
23.4.10. --gauge
I. X Window
24. install x window
24.1. xinput - utility to configure and test X input devices
25. X Setup
25.1. 取消开机启动画面
25.2. Automatic login
25.3. fonts 字体
25.4. disable x window
26. X Terminal
26.1. tsclient - Terminal Server Client supporting XDMCP, VNC and RDP
26.1.1. VNC
26.1.2. xdmcp
26.2. vinagre - a remote desktop viewer for the GNOME Desktop
26.3. rdesktop - A Remote Desktop Protocol client
26.3.1. -g: desktop geometry (WxH)
26.3.2. -f: full-screen mode
26.3.3. -A: enable SeamlessRDP mode
26.3.4. -z: enable rdp compression
26.3.5. -r: enable specified device redirection (this flag can be repeated)
26.4. tigervnc
26.5. TightVNC
27. Unity
27.1. Enable/Disable Auto Hide For Unity 2-D Launcher In Ubuntu 11.10
28. X Window System
28.1. Fluxbox
28.2. LXDE
28.3. Xfce
28.4. Xming X Server for Windows
29. X Application Software
29.1. ubuntu-restricted-extras
29.2. Keyboard Input Methods(输入法)
29.3. 浏览器
29.3.1. Firefox
29.3.2. Chromium Web Browser
29.4. Download Software
29.5. PAC Manager
29.6. LibreOffice
29.7. VYM (View Your Mind)
29.8. greenshot
29.9. Window Switch
30. Office
30.1. Calc
30.1.1. 函数
1. 附录
1.1. Linux 下载排名
2. 历史记录

表格清单

1.1. Linux partition
18.1. 文件目录表达式
18.2. 字符串表达式
18.3. 组合表达式

范例清单

9.1. GPT Example
9.2. 创建扩展分区
12.1. bonding example
12.2. 命令行建立WiFi链接步骤
18.1. A "Power User" Prompt
18.2. A Prompt the Width of Your Term
18.3. The Elegant Useless Clock Prompt
18.4. Basic conditional example if .. then
18.5. Conditionals with variables
18.6. case
18.7. Functions with parameters sample
18.8. Using select to make simple menus
18.9. Using the command line
18.10. Reading user input with read
18.11. read
18.12. random password
20.1. backup(find + tar)
22.1. example for expect
22.2. example for expect
22.3. example 1
22.4. *.exp
22.5. parallel - build and execute shell command lines from standard input in parallel
23.1. whiptail - yesno
23.2. whiptail - inputbox
23.3. whiptail - passwordbox
23.4. whiptail - passwordbox
23.5. whiptail - example 1
23.6. whiptail - radiolist
comments powered by Disqus