[b]Unix Filesystem Hierarchy Standard:
[url]http://www.pathname.com/fhs/pub/fhs-2.3.html#THEFILESYSTEM[/url]
Unix directory structure:
[url]http://en.wikipedia.org/wiki/Unix_directory_structure[/url][/b]
View file system hierarchy of Linux:
LinuxFilesystemTreeOverview
[url]https://help.ubuntu.com/community/LinuxFilesystemTreeOverview[/url]
[url]http://linuxcommand.org/lts0040.php[/url]
Linux 分区方案:
[url]https://help.ubuntu.com/community/DiskSpace[/url]
[b]使用 [color=red]update-rc.d[/color] 实现linux服务的开机自启动:(rc stands for Run Commands)[/b]
How-To: Managing services with update-rc.d:
[url]http://www.debuntu.org/how-to-manage-services-with-update-rc.d[/url]
Ubuntu Manpage: update-rc.d - install and remove System-V style init script links:
[url]http://manpages.ubuntu.com/manpages/hardy/man8/update-rc.d.8.html[/url][quote]FILES
/etc/init.d/
The directory containing the actual init scripts.
/etc/rc?.d/
The directories containing the links used by init and managed by
update-rc.d.
/etc/init.d/skeleton
Model for use by writers of init.d scripts.
/var/lib/sysv-rc/legacy-bootsequence
Flag indicating the machine is using legacy mode for boot script
ordering.[/quote]使用update-rc.d管理Linux服务:
[url]http://blog.bornin76.com:801/?p=130[/url]
关于 /etc/init.d 目录:
[url]http://www.ghacks.net/2009/04/04/get-to-know-linux-the-etcinitd-directory/[/url]
[b]下面存放 binary files(二进制可执行文件) 的目录的区别(sbin之s代表system, usr 代表 Unix System Resources):[/b]
/bin/
/sbin/
/usr/bin/
/usr/sbin/
/usr/local/bin/
/usr/local/sbin/
[url]http://unix.stackexchange.com/questions/8656/usr-bin-vs-usr-local-bin-on-linux[/url]
[b].profile .bashrc .bash_profile 的区别:[/b]
[url]http://superuser.com/questions/183870/difference-between-bashrc-and-bash-profile[/url]
[b]/etc/bash.bashrc 和 ~/.bashrc 的区别:[/b]
[url]http://superuser.com/questions/49562/whats-the-difference-between-etc-bash-bashrc-and-bashrc-which-one-should-i[/url][quote]/etc/bash.bashrc applies to all users
~/.bashrc only applies to the user in which home folder it is.[/quote][b]针对单个用户的 ~/.bash_profile 与 ~/.bashrc 的区别:[/b]
[url]http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html[/url][quote].bash_profile是在登陆时起作用; .bashrc 是交互式non-login shells,即:修改.bashrc后,脚本在新打开的terminal中就开始起作用了,不用重新登陆。[/quote]关于 interactive shell / non-interactive shell、login shell / non-login shell,详见:
[url]http://wuaner.iteye.com/blog/1671522[/url]
[b]File Descriptors & IO Redirection:[/b]
[align=center][img]http://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Stdstreams-notitle.svg/220px-Stdstreams-notitle.svg.png[/img][/align]
What's File Descriptors? When a UNIX/linux program wants to use a file, it must first open that file. When it does so, UNIX/linux will associate a number with the file. This number, which is used by the program when reading from and writing to the file, is the file descriptor. linux kernal 的 /usr/include/unistd.h 文件中可查看stdin/stdout/stderr三个 fd 的定义:
[url]http://www.symkat.com/understanding-file-descriptors-and-io-redirection[/url]
在 File Descriptors 间做 IO Redirection 时的 [b]&[/b],如 2>&1 ,代表了什么?答案是使用 & 仅仅是为了表明被重定向至的文件(stdin、stdout、stderr都是character devices,unix/linux下 character devices 也是被当作文件file来管理的)是stdout,而不是一个名为 1 的文件,参见:
[url]http://en.wikipedia.org/wiki/Redirection_(computing)[/url][quote]In shells derived from csh (the C shell), the syntax instead appends the & (ampersand) character to the redirect characters, thus achieving a similar result. The reason for this is to distinguish between a file named '1' and stdout, i.e. 'cat file 2>1' vs 'cat file 2>&1'. In the first case, stderr is redirected to a file named '1' and in the second, stderr is redirected to stdout.[/quote][url]http://stackoverflow.com/questions/818255/in-the-bash-shell-what-is-21[/url][quote]1 is stdout. 2 is stderr.
Here is one way to remember this construct (altough it is not entirely accurate): at first, 2>1 may look like a good way to redirect stderr to stdout. However, it will actually be interpreted as "redirect stderr to a file named 1". & indicates that what follows is a file descriptor and not a filename. So the construct becomes: 2>&1.[/quote]
[url]http://www.pathname.com/fhs/pub/fhs-2.3.html#THEFILESYSTEM[/url]
Unix directory structure:
[url]http://en.wikipedia.org/wiki/Unix_directory_structure[/url][/b]
View file system hierarchy of Linux:
$ man hier
LinuxFilesystemTreeOverview
[url]https://help.ubuntu.com/community/LinuxFilesystemTreeOverview[/url]
[url]http://linuxcommand.org/lts0040.php[/url]
Linux 分区方案:
[url]https://help.ubuntu.com/community/DiskSpace[/url]
[b]使用 [color=red]update-rc.d[/color] 实现linux服务的开机自启动:(rc stands for Run Commands)[/b]
How-To: Managing services with update-rc.d:
[url]http://www.debuntu.org/how-to-manage-services-with-update-rc.d[/url]
Ubuntu Manpage: update-rc.d - install and remove System-V style init script links:
[url]http://manpages.ubuntu.com/manpages/hardy/man8/update-rc.d.8.html[/url][quote]FILES
/etc/init.d/
The directory containing the actual init scripts.
/etc/rc?.d/
The directories containing the links used by init and managed by
update-rc.d.
/etc/init.d/skeleton
Model for use by writers of init.d scripts.
/var/lib/sysv-rc/legacy-bootsequence
Flag indicating the machine is using legacy mode for boot script
ordering.[/quote]使用update-rc.d管理Linux服务:
[url]http://blog.bornin76.com:801/?p=130[/url]
关于 /etc/init.d 目录:
[url]http://www.ghacks.net/2009/04/04/get-to-know-linux-the-etcinitd-directory/[/url]
[b]下面存放 binary files(二进制可执行文件) 的目录的区别(sbin之s代表system, usr 代表 Unix System Resources):[/b]
/bin/
/sbin/
/usr/bin/
/usr/sbin/
/usr/local/bin/
/usr/local/sbin/
[url]http://unix.stackexchange.com/questions/8656/usr-bin-vs-usr-local-bin-on-linux[/url]
[b].profile .bashrc .bash_profile 的区别:[/b]
[url]http://superuser.com/questions/183870/difference-between-bashrc-and-bash-profile[/url]
[b]/etc/bash.bashrc 和 ~/.bashrc 的区别:[/b]
[url]http://superuser.com/questions/49562/whats-the-difference-between-etc-bash-bashrc-and-bashrc-which-one-should-i[/url][quote]/etc/bash.bashrc applies to all users
~/.bashrc only applies to the user in which home folder it is.[/quote][b]针对单个用户的 ~/.bash_profile 与 ~/.bashrc 的区别:[/b]
[url]http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html[/url][quote].bash_profile是在登陆时起作用; .bashrc 是交互式non-login shells,即:修改.bashrc后,脚本在新打开的terminal中就开始起作用了,不用重新登陆。[/quote]关于 interactive shell / non-interactive shell、login shell / non-login shell,详见:
[url]http://wuaner.iteye.com/blog/1671522[/url]
[b]File Descriptors & IO Redirection:[/b]
[align=center][img]http://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Stdstreams-notitle.svg/220px-Stdstreams-notitle.svg.png[/img][/align]
What's File Descriptors? When a UNIX/linux program wants to use a file, it must first open that file. When it does so, UNIX/linux will associate a number with the file. This number, which is used by the program when reading from and writing to the file, is the file descriptor. linux kernal 的 /usr/include/unistd.h 文件中可查看stdin/stdout/stderr三个 fd 的定义:
/* Standard file descriptors. */
#define STDIN_FILENO 0 /* Standard input. */
#define STDOUT_FILENO 1 /* Standard output. */
#define STDERR_FILENO 2 /* Standard error output. */
Understanding File Descriptors and IO Redirection:
[url]http://www.symkat.com/understanding-file-descriptors-and-io-redirection[/url]
在 File Descriptors 间做 IO Redirection 时的 [b]&[/b],如 2>&1 ,代表了什么?答案是使用 & 仅仅是为了表明被重定向至的文件(stdin、stdout、stderr都是character devices,unix/linux下 character devices 也是被当作文件file来管理的)是stdout,而不是一个名为 1 的文件,参见:
[url]http://en.wikipedia.org/wiki/Redirection_(computing)[/url][quote]In shells derived from csh (the C shell), the syntax instead appends the & (ampersand) character to the redirect characters, thus achieving a similar result. The reason for this is to distinguish between a file named '1' and stdout, i.e. 'cat file 2>1' vs 'cat file 2>&1'. In the first case, stderr is redirected to a file named '1' and in the second, stderr is redirected to stdout.[/quote][url]http://stackoverflow.com/questions/818255/in-the-bash-shell-what-is-21[/url][quote]1 is stdout. 2 is stderr.
Here is one way to remember this construct (altough it is not entirely accurate): at first, 2>1 may look like a good way to redirect stderr to stdout. However, it will actually be interpreted as "redirect stderr to a file named 1". & indicates that what follows is a file descriptor and not a filename. So the construct becomes: 2>&1.[/quote]