命令[选项] [参数]command[option] [argument]# (路径 文件等)# (在语法中,中括号是可有可无的意思)listls查看当前所在工作目录下的文件和目录 -a:查看所有文件包括隐藏文件 root@localhost:~\# ls -a. .. anaconda-ks.cfg .bash_history .bash_logout .bash_profile
last | cut -d ' ' -f 1 | sort | uniq#这个命令所实现的就是将last输出的每行数据使用空格切割并取出第一个片段输出,然后排序再取出不重复的数据 last | cut -d ' ' -f 1 | sort -u#这行命令实现的操作与上一行命令一致,但sort没有计数功能,如果要使用计数功能还是需要使用uniq命令 last | cut ...
sbs() { du -b --max-depth 1 | sort -nr | perl -pe 's{([0-9]+)}{sprintf "%.1f%s", $1>=2**30? ($1/2**30, "G"): $1>=2**20? ($1/2**20, "M"): $1>=2**10? ($1/2**10, "K"): ($1, "")}e';} Sort by sizeto display in list the files in the ...
ls:列出当前目录等同于win下dir kali使用bshell默认情况下 : 蓝色表示目录 白色表示普通文件 绿色表示可执行文件 红色表示压缩文件 -l 以长文件显示 第一列首字母d表示目录 c表示设备文件 l表示连接 -表示文件 b表示快 -a 显示隐藏文件 -h 以易于阅读方式显示 –sort 排序 =time =size按大小排序 cd:进入目录...
5、函数:函数本身就是一个命令或一组命令的名字。函数可以使程序模块化,提高效率,可以就在当前的 shell 环境中执行,即在执行像 ls 等可执行程序时不产生自进程。 使用函数的规则: 1、shell 总是先执行别名,然后是函数、内建命令,最后才执行可执行程序。
find . -type f -name "*.faa" -size -1040c -size +440c set:命令用来修改子 Shell 环境的运行参数,即定制环境 默认:执行脚本时,如果遇到不存在的变量,Bash 默认忽略它。 set -u 脚本在头部加上它,遇到不存在的变量就会报错,并停止执行。 set -x用来在运行结果之前,先输出执行的那一行命令。 set -n...
You can also use files as input. By default, standard input comes from the keyboard, but it too can be redirected. To get input from a file instead of the keyboard, use the<operator. One common sysadmin task is to sort the contents of a file. As the name suggests,sortsorts text in...
命令cat、tac、head、tail、cut、sort、tr、history及bash特性,作业1:1、创建目录/backup#mkdir-v/backup2、复制目录/etc至/backup目录中,并重命名为"etc-当前日期",如etc-2013-02-26;要求保留文件原来的属性,保持链接文件;cp:-r,-R,--recursive:递归复制目录及目录
HISTFILESIZE定义了在文件 ~/.bash_history 中保存命令的记录总数 HISTSIZE定义了 history 命令输出的记录数。 HISTCONTROL控制历史记录保留的方式 ignorespace 以空白字符开头的命令不记录 ignoredups 忽略重复,连续重复的命令只记录一次 ignoreboth 两者都生效(ignorespace + ignoredups) ...
cd/du|sort-n If you want to search all of /, but you don't want other partitions (/var or /home, etc.,) to be included (assuming those are actually separate partitions, as found in #0), then you can add the -x option to stay on this partition, and don't traverse the other...