Linux shuf --随机选择器
2016-04-08 10:56
771 查看
Shuf
命令随机从一个文件或文件夹中选择行/文件/文件夹。首先使用ls命令来显示文件夹的内容。
复制代码
代码如下:
# ls
Desktop Documents Downloads Music Pictures Public Templates Videos
# ls | shuf(shuffle Input)
Music
Documents
Templates
Pictures
Public
Desktop
Downloads
Videos
# ls | shuf-n1 (pick on random selection)
Public
# ls | shuf -n1
Videos
# ls | shuf -n1
Templates
# ls | shuf -n1
Downloads
注意:你可以把‘ n1'替换成‘n2'来输出两个随机选择或者使用 n3、 n4等数字输出其他任意的随机选择
命令随机从一个文件或文件夹中选择行/文件/文件夹。首先使用ls命令来显示文件夹的内容。
复制代码
代码如下:
# ls
Desktop Documents Downloads Music Pictures Public Templates Videos
# ls | shuf(shuffle Input)
Music
Documents
Templates
Pictures
Public
Desktop
Downloads
Videos
# ls | shuf-n1 (pick on random selection)
Public
# ls | shuf -n1
Videos
# ls | shuf -n1
Templates
# ls | shuf -n1
Downloads
注意:你可以把‘ n1'替换成‘n2'来输出两个随机选择或者使用 n3、 n4等数字输出其他任意的随机选择
相关文章推荐
- Linux sftp --安全文件传输命令行工具
- Linux service --系统服务管理
- [随笔]Linux grep命令详解
- Linux seq --打印一串有规律的数据
- Linux sed --模拟空间&保留空间
- 如何查看linux服务器的版本和配置信息
- Linux sed --编辑文本
- linux下vi命令大全
- Linux流量实时监控工具iftop安装配置
- Linux scp --Secure copy 远程拷贝文件
- Linux sar --系统性能分析工具
- Linux rz --批量上传文件
- Linux rsync --数据镜像备份工具
- Linux route --显示和操作IP路由表
- Linux rmdir --删除空目录
- Linux rm --删除文件或目录,当心系统毁灭
- Linux reset --终端屏幕混乱的终结者
- Linux pwd --显示当前工作目录
- Linux pstree --以树状图显示进程间的关系
- CentOS 6.6升级GCC