Shuf 命令隨機從一個文件或文件夾中選擇行/文件/文件夾。首先使用ls命令來顯示文件夾的內容。dom
複製代碼 代碼以下:ide
# lsspa
Desktop Documents Downloads Music Pictures Public Templates Videos排序
# ls | shuf(shuffle Input)io
Musicselect
Documentssort
Templatestop
Pictures文件
Publiceos
Desktop
Downloads
Videos
# ls | shuf-n1 (pick on random selection)
Public
# ls | shuf -n1
Videos
# ls | shuf -n1
Templates
# ls | shuf -n1
Downloads
sort -R 也可隨機排序