Linux do some cool things or funny things

1. File randomizer

This project came to my mind when I was trying to burn some music for my car. The car did not have the ability to shuffle play so I decided to randomize the file order. But the default burning tool did not have an option to shuffle files before burning, so I decided to make this small script. This is the full script:

#!/bin/bash 
num_files=$(ls | wc -l) 
pad=$(echo "l($num_files)/l(10) + 1" | bc -l) 
pad=${pad%.*} 

counter=0 
ls -A | shuf | while read filename; do num=$(printf "%0${pad}d" $counter); mv "$filename" "$num - $filename"; counter=$(($counter+1)); done;

1. funny terminal

  • The fortune | cowsay is quite known. But to spice things up, use
    lolcat

    这里写图片描述


  • Other things quite famous are figlet and toilet

这里写图片描述


  • Espeak is a text-to-speech programe

  • nyancat(gif)
    这里写图片描述

  • vtop is another nice command (install via npm) This uses braille characters to make the plot!
    这里写图片描述

  • cmatrix
    这里写图片描述

  • Install sl, so when you misspel ls, you get this: (gif)
    这里写图片描述

  • Install filters to have
    这里写图片描述

- easy terminal

  • remove empty directories
find -type d -empty -exec rm {} \; # remove empty directories
  • convert bases to other bases
echo "obase=16;ibase=10;500000" | bc
  • find the years in which 21 november is a friday
for y in {1970..2010} ; do date -d $y-11-21 +%u-%Y ; done | grep -P "(?<=5-).*"
  • find out how many files sit in a directory
ls -l | wc -l
  • get a list of the ASCII files in the directory
file * | grep ASCII | awk -F: {'print $1'}
  • create a hexdump
cat file | hexdump -c
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值