变量
来源:互联网 发布:二手手机估值软件 编辑:程序博客网 时间:2024/04/29 13:38
1.快捷键
Ctrl+U ----删除当前光标到行首的内容
Ctrl+K ----删除当前光标到行尾的内容
history -c ----命令历史的清除
set nu- ----查看文件行数
1.vi hello.sh
2.按下Esc键,按下:键
3.在:号后输入set nu,回车,即可
4.chgrp 用户组名 文件名 ----更改文件的所属组
5.getent group 组名 ----查看组包含哪些用户
或grep '^root' /ect/group
2.简单shell实例
#!/bin/bash
#hello2.sh
if [ $# -ne 1 ]; ---判断参数是否等于1,$#:判断参数个数
then
echo "Uage:$0 username"; --$0 表示脚本名称
exit 1;
else
echo "Hello World,Hello $1 !"; --$1 表示第一个参数
fi
3.suid,guid
当文件具有s时,说明其它用户执行此文件时,被转成所属用户执行。
当文件具有g时,说明其它组执行此文件时,被转成所属组执行。
当文件有t标示时,说明其它用户有读写权限,及加文件权限,但没有删除权限。
4.umask
cat /etc/bashrc | grep "umask"
设定用户的umask
vi .bashrc
5.硬链接和软链接
ln 123 mm ---硬链接
ls -lih 123
ln -s /root/123 1 ---软链接
6.查找find
find -prem -654 -print -----按权限查找
find /apps -name "/apps/bin" -prune -o -print ----忽略掉/apps/bin目录
find . -path "./shell" -prune -o -name "*.txt" -print
find . -user root -print ----查找所属root用户的文件
find . -nouser - print ---查找不属于任何用户的文件
find . -group root -print
find . -nogroup -print
find . -mtime +3 -print ---查找3天前修改的数据
find . -type d -print ---查找目录
find . ! -type d -print ---查找非目录
find . -type | -exec ls -l {} / ----查找连接文件
find logs -type -mtime +5 -exec rm {} /; -----查找5天前文件,并删除,不给出提示
find logs -type -mtime +5 -ok rm {} /; -----相比前一个,给出提示。
7.xargs简介
cut -d':' -f1 < /etc/passwd/|head -n 3 |xargs finger -----取文件passwd中以:分隔的第一列作为参数传给finger指令。
find . -type f -print | xargs file -----把找到的文件作为参数传递给file命令。
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 创建型模式之原型模式
- JTable中加入JCheckBox
- 在 Java 中应用设计模式 - Factory Method
- arm体系结构学习笔记 part4 -- 异常处理的返回
- 上手就先混积分,网络反应也太慢了,也不知道是哪里的事
- 变量
- 又一个学期要过去了
- 使用map文件找bug.
- jsp request方法大全
- Fedora中的rpm软件包命令用法摘记
- CISC, RISC 区别
- ubuntu中pdf中文乱码解决方法
- MFC中的afx_msg和BEGIN_MESSAGE_MAP
- 链接服务器相关