登录后shell启动并继承很多变量、I/O流,进程信息等等,fork的子shell则会继承父shell的环境和变量
id命令查看uid和gid
umask是权限补码,chmod是权限码
/etc/profile里指定了umask默认值022,这样对于新创建的文件夹则是777-022=755(drwxr-xr-x),对新创建的文件则是666-022=644(-rw-r--r--)
文件夹和文件权限分三组,从左至右分别是owner/group/others的权限
chmod命令用来改变文件夹和文件的权限
[code]
$ chmod 755 file
$ chmod g+w filw
$ chmod go-rx file
$ chmod a=r file
[/code]
r=read, w=write, x=execute, u=user, g=group, o=others, a=all
chown命令用来更改文件夹和文件的owner和group
[code]
$ chown root file
$ chown root:root file
[/code]
cd命令用来change directory
set命令用来设置本地变量和环境变量
env命令查看当前环境变量
file descriptor是一个unsigned integer,它是kernel维护的file-descriptor table的index,kernel用file-descriptor table来引用打开的文件和I/O流
file descriptor 0表示标准输入(stdin),file descriptor 1表示标准输出(stdout),file descriptor 2表示标准错误(stderr)
当file descriptor赋给非terminal时称之为I/O重定向
[code]
$ who > file
$ cat file1 file2 >> file3
$ mail tom < file
$ find / -name file -print 2>errors
% (find / -name file -print) >& errors
[/code]
一个命令的输出作为另一个命令的输入,则称之为管道pipe
[code]
who | wc
[/code]
信号量signal则是指发送一条消息给一个进程
标准信号量
[code]
Number Name Description Action
0 EXIT Shell exits Termination
1 SIGHUP Terminal has disconnected Termination
2 SIGINT User presses Ctrl-C Termination
3 SIGQUIT User presses Ctrl-\ Termination
4 SIGILL Illegal hardware instruction Program error
5 SIGTRAP Produced by debugger Program error
8 SIGFPE Arithmetic error Program error
9 SIGKILL Cannot be caught or ignored Termination
[/code]
当shell用来当作编程语言,命令和shell控制结构输入到一个编辑器并保存在一个文件种,则称之为一个script
id命令查看uid和gid
umask是权限补码,chmod是权限码
/etc/profile里指定了umask默认值022,这样对于新创建的文件夹则是777-022=755(drwxr-xr-x),对新创建的文件则是666-022=644(-rw-r--r--)
文件夹和文件权限分三组,从左至右分别是owner/group/others的权限
chmod命令用来改变文件夹和文件的权限
[code]
$ chmod 755 file
$ chmod g+w filw
$ chmod go-rx file
$ chmod a=r file
[/code]
r=read, w=write, x=execute, u=user, g=group, o=others, a=all
chown命令用来更改文件夹和文件的owner和group
[code]
$ chown root file
$ chown root:root file
[/code]
cd命令用来change directory
set命令用来设置本地变量和环境变量
env命令查看当前环境变量
file descriptor是一个unsigned integer,它是kernel维护的file-descriptor table的index,kernel用file-descriptor table来引用打开的文件和I/O流
file descriptor 0表示标准输入(stdin),file descriptor 1表示标准输出(stdout),file descriptor 2表示标准错误(stderr)
当file descriptor赋给非terminal时称之为I/O重定向
[code]
$ who > file
$ cat file1 file2 >> file3
$ mail tom < file
$ find / -name file -print 2>errors
% (find / -name file -print) >& errors
[/code]
一个命令的输出作为另一个命令的输入,则称之为管道pipe
[code]
who | wc
[/code]
信号量signal则是指发送一条消息给一个进程
标准信号量
[code]
Number Name Description Action
0 EXIT Shell exits Termination
1 SIGHUP Terminal has disconnected Termination
2 SIGINT User presses Ctrl-C Termination
3 SIGQUIT User presses Ctrl-\ Termination
4 SIGILL Illegal hardware instruction Program error
5 SIGTRAP Produced by debugger Program error
8 SIGFPE Arithmetic error Program error
9 SIGKILL Cannot be caught or ignored Termination
[/code]
当shell用来当作编程语言,命令和shell控制结构输入到一个编辑器并保存在一个文件种,则称之为一个script
Shell环境与脚本基础
17万+

被折叠的 条评论
为什么被折叠?



