linuxshell专题讲座

上传人:卷****络 文档编号:185242778 上传时间:2021-07-05 格式:DOCX 页数:60 大小:1,003.01KB
返回 下载 相关 举报
linuxshell专题讲座_第1页
第1页 / 共60页
linuxshell专题讲座_第2页
第2页 / 共60页
linuxshell专题讲座_第3页
第3页 / 共60页
linuxshell专题讲座_第4页
第4页 / 共60页
linuxshell专题讲座_第5页
第5页 / 共60页
点击查看更多>>
资源描述

《linuxshell专题讲座》由会员分享,可在线阅读,更多相关《linuxshell专题讲座(60页珍藏版)》请在金锄头文库上搜索。

1、LinuxShell应用编程专题讲座第一部分shell编程基础1shell简介什么是shell存取权限和安全shell简单脚本shell特性1.1什么是shelll shell是核心程序kernel之外的指令解析器,是一个程序,同时是一种命令语言和程序设计语言。 shell是命令解析器,用户输入命令,它去解析。l shell类型ash、bash、ksh、csh、tcsh cat /etc/shells 看系统下的shell echo $SHELL 看当前用户运行的shelll 程序在shell中运行 ls命令执行过程分析l shell中可以运行子shell /bin/csh 退出子shelll

2、 linux下默认的shell是bash bash特点,快速(上下键);tab键盘自动补齐;自动帮助功能help在shell下执行help命令,可以查看shell提供的命令testlocalhost $ help GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)These shell commands are defined internally. Type help to see this list.Type help name to find out more about the function name.Use

3、info bash to find out more about the shell in general.Use man -k or info to find out more about commands not in this list.A star (*) next to a name means that the command is disabled. JOB_SPEC & ( expression ) . filename arguments : arg. expression alias -p name=value . bg job_spec . bind -lpvsPVS -

4、m keymap -f fi break n builtin shell-builtin arg . caller EXPR case WORD in PATTERN | PATTERN. cd -L|-P dir command -pVv command arg . compgen -abcdefgjksuv -o option complete -abcdefgjksuv -pr -o continue n declare -afFirtx -p name=val dirs -clpv +N -N disown -h -ar jobspec . echo -neE arg . enable

5、 -pnds -a -f filename eval arg . exec -cl -a name file redirec exit n export -nf name=value . or false fc -e ename -nlr first last fg job_spec for NAME in WORDS . ; do COMMA for ( exp1; exp2; exp3 ); do COM function NAME COMMANDS ; or NA getopts optstring name arg hash -lr -p pathname -dt na help -s

6、 pattern . history -c -d offset n or hi if COMMANDS; then COMMANDS; elif jobs -lnprs jobspec . or job kill -s sigspec | -n signum | -si let arg arg . local name=value . logout popd +N | -N -n printf -v var format arguments pushd dir | +N | -N -n pwd -LP read -ers -u fd -t timeout readonly -af name=v

7、alue . return n select NAME in WORDS . ; do CO set -abefhkmnptuvxBCHP -o opti shift n shopt -pqsu -o long-option opt source filename arguments suspend -f test expr time -p PIPELINE times trap -lp arg signal_spec . true type -afptP name name . typeset -afFirtx -p name=valu ulimit -SHacdfilmnpqstuvx l

8、imit umask -p -S mode unalias -a name name . unset -f -v name . until COMMANDS; do COMMANDS; done variables - Some variable names an wait n while COMMANDS; do COMMANDS; done COMMANDS ; 1.2存取权限与安全简介:文件和目录的权限(-rwxrr-)setuid(suid/guid) (chmod u+s g+s file)chown和chgrp(chown user file/chgrp group file)um

9、ask (umask nnn) (文件创建时的缺省权限位)l 文件和目录的权限(-rwxr-r-) linux下安全解决方案很多,现在讨论文件和目录的访问权限 练习ls lh文件的权限 硬链接数 用户名用户组 文件大小、最近修改时间 文件名称drwxr-xr-x 2 test test 4096 Jun 23 08:07 cppsocket1drwxr-xr-x 8 test test 4096 Jun 23 08:08 cppsocket2drwxr-xr-x 9 test test 4096 Jun 18 12:32 gcc-rw-r-r- 1 test test 59827 Jun 23

10、 08:11 gcc_mk_gdb.tar.gzdrwxr-xr-x 7 test test 4096 Jun 23 08:09 mkdrwxr-xr-x 4 test test 4096 Jun 23 09:47 mygccdrwxr-xr-x 5 test test 4096 Jun 23 11:13 mymk-rw-r-r- 1 root root 63 Nov 9 2013 oraInst.loc-rw-rw-r- 1 oracle oinstall 732 Nov 9 2013 oratabdrwxr-xr-x 2 root root 4096 Nov 9 2013 pam.ddrw

11、xr-xr-x 3 root root 4096 Nov 8 2013 racoonlrwxrwxrwx 1 root root 7 Nov 8 2013 rc - rc.d/rcdrwxr-xr-x 10 root root 4096 Nov 8 2013 rc.d硬链接数?d-目录 一般文件 l快捷方式 c字符设备 b块设备 s-socket设备文件 p管道文件-rw-r-r- 1 root root 5 Jun 23 12:39 scim-bridge-0.3.0.lockfile-0localhost:0.0-rw-r-r- 1 oracle oinstall 5 Jun 18 16:

12、13 scim-bridge-0.3.0.lockfile-501localhost:0.0srwxr-xr-x 1 root root 0 Jun 23 05:39 scim-bridge-0.3.0.socket-0localhost:0.0srwxr-xr-x 1 oracle oinstall 0 Jun 18 07:13 scim-bridge-0.3.0.socket-501localhost:0.0srw- 1 oracle oinstall 0 Jun 18 07:13 scim-helper-manager-socket-oraclesrw- 1 root root 0 Ju

13、n 23 05:39 scim-helper-manager-socket-rootsrw- 1 oracle oinstall 0 Jun 18 07:13 scim-panel-socket:0-oraclesrw- 1 root root 0 Jun 23 05:39 scim-panel-socket:0-rootsrw- 1 oracle oinstall 0 Jun 18 07:13 scim-socket-frontend-oraclesrw- 1 root root 0 Jun 23 05:39 scim-socket-frontend-rootdrwx- 2 root root 4.0K Jun 23 05:39 ssh-grWlnX5288drwx- 2 oracle oinstall 4.0K Jun 18 07:13 virtual-oracl

展开阅读全文
相关资源
相关搜索

当前位置:首页 > IT计算机/网络 > C/C++资料

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号