linux 学习笔记
来源:互联网 发布:杭州知乎电子有限公司 编辑:程序博客网 时间:2024/06/05 18:07
PIE (地址无关程序编译)
gcc -fPIE -pie -o x random.c每次执行,变量的的地址均会变readelf -h x | grep TypeType: DYN (Shared object file)
(1)
echo $SHLVL
查看当前shell的层次,Incremented by one each time an instance of bash is started
(2) usermod
-c, --comment COMMENT new value of the GECOS field -d, --home HOME_DIR new home directory for the user account -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE -f, --inactive INACTIVE set password inactive after expiration to INACTIVE -g, --gid GROUP force use GROUP as new primary group -G, --groups GROUPS new list of supplementary GROUPS -a, --append append the user to the supplemental GROUPS mentioned by the -G option without removing him/her from other groups -h, --help display this help message and exit -l, --login NEW_LOGIN new value of the login name -L, --lock lock the user account -m, --move-home move contents of the home directory to the new location (use only with -d) -o, --non-unique allow using duplicate (non-unique) UID -p, --password PASSWORD use encrypted password for the new password -R, --root CHROOT_DIR directory to chroot into -s, --shell SHELL new login shell for the user account -u, --uid UID new UID for the user account -U, --unlock unlock the user account -Z, --selinux-user SEUSER new SELinux user mapping for the user account
(3) real uid 和 effective uid
real uid 是指用户登陆系统时所具有的身份信息,可以通过setuid, 或者setresuid在程序中设置。
effective uid是指程序执行的过程中所带有的身份信息, 系统检查权限时根据此信息来判断权限是否达到要求, 然后进一步执行程序。
(4)set uid (u+s), 和 set gid (g+s)
setuid程序执行时具有程序所有着的权限。也就是说,root的一个可执行程序(比如:passwd),如果setuid以后,test用户运行时,具有root的权限。
setgid作用与文件时,跟setuid类似,临时拥有的组权限与拥有着的组一样。
segid作用于目录时,在该目录下所建的文件组与目录的组保持一致。如果没有设置该标志位, 所建的文件、目录组信息就是创建着的组信息。
(5)修改软件源
http://www.annhe.net/article-614.html
(6)查看gcc预定义的变量
touch foo.hgcc -E -dM -c foo.h
ANSI C标准中有几个标准预定义宏(也是常用的):
__LINE__:在源代码中插入当前源代码行号;__FILE__:在源文件中插入当前源文件名;
__DATE__:在源文件中插入当前的编译日期
__TIME__:在源文件中插入当前编译时间;
__STDC__:当要求程序严格遵循ANSI C标准时该标识被赋值为1;
__cplusplus:当编写C++程序时该标识符被定义。
(7)常用命令集合
根据文件名,查找文件
find ./ -name "*"
根据关键词,查找文件
grep -rn "*" ./
sizeof
http://blog.csdn.net/wanfustudio/article/details/705674
修改Linux命令提示符
编辑/etc/profile,文件末尾添加ps1的值
export PS1='[\u@\h \w]\$'
u:user
h:host
w:当前用户路径用~代替
W:只显示最后一个路径名
0 0
- linux学习笔记(1)
- LINUX命令学习笔记
- linux学习笔记(1)
- linux学习笔记(2)
- linux学习笔记(3)
- linux学习笔记
- linux学习笔记
- linux 学习笔记
- linux学习笔记二
- linux学习笔记
- linux学习笔记
- Linux学习笔记
- linux学习笔记
- linux学习笔记
- linux学习笔记
- LINUX 学习笔记(转)
- Linux学习笔记
- Linux 学习笔记
- c++ STL 基础使用
- spring mvc 框架搭建
- 我的OpenCV学习笔记(2):opencv中的模糊算法
- php json_decode 转换为空的解决方案一
- ORA-12737: Instant Client Light: unsupported server character set %s
- linux 学习笔记
- Workflow常见错误如何解决
- 【DB.PL/SQL】程序流程控制 —— 异常处理
- 【移动开发】Service类onStartCommand()返回值和参数
- 关注CSDN社区微信,更多精彩等你来
- cocos2d 坐标系使用
- Linux curl命令参数常用
- CreateThread函数
- Eclipse杂记之屏蔽自带的ant插件