Commands by ichbins (9)

  • Generates a TV noise alike output in the terminal. Can be combined with

    while true;do printf "$(awk -v c="$(tput cols)" -v s="$RANDOM" 'BEGIN{srand(s);while(--c>=0){printf("\xe2\x96\\%s",sprintf("%o",150+int(10*rand())));}}')";done
    ichbins · 2020-05-08 09:55:36 22
  • Scope should have the Rigol Ultravision Technology otherwise it won't accept the command. ImageMagic is required. Scope sends a 1.1M BMP file and converted to PNG it's only 18-20K

    echo "display:data?" | nc "$scope_ip_address" 5555 | dd bs=1 skip=11 2>/dev/null | convert bmp:- out_file.png
    ichbins · 2015-06-27 06:43:43 1
  • This version is precise and requires one second to collect statistics. Check sample output for a more generic version and also a remote computer invocation variant. It doesn't work with the busybox version of the 'top' command but can be adjusted Show Sample Output

    top -bn2|awk -F, '/Cpu/{if (NR>4){print 100-gensub(/.([^ ]+).*/,"\\1","g",$4)}}'
    ichbins · 2014-04-18 17:48:05 0
  • this command will add the following two lines into the ~/.bash_aliases: alias exit='pwd > ~/.lastdir;exit' [ -n "$(cat .lastdir 2>/dev/null)" ] && cd "$(cat .lastdir)" or redirect it to the ~/.bashrc if you like Donno, I find it usefull. You may also define an alias for 'cd ~' like - alias cdh='cd ~'

    echo -e 'alias exit='\''pwd > ~/.lastdir;exit'\''\n[ -n "$(cat .lastdir 2>/dev/null)" ] && cd "$(cat .lastdir)"' >> ~/.bash_aliases
    ichbins · 2014-01-28 18:02:04 0
  • Starts and shows a timer. banner command is a part of the sysvbanner package. Instead of the banner an echo or figlet commands could be used. Stop the timer with Ctrl-C and elapsed time will be shown as the result. Show Sample Output

    alias timer='export ts=$(date +%s);p='\''$(date -u -d @"$(($(date +%s)-$ts))" +"%H.%M.%S")'\'';watch -n 1 -t banner $p;eval "echo $p"'
    ichbins · 2013-08-24 16:18:45 1
  • bash output is inserted into the clipboard, then mousepad is started and the clipboard content is pasted. xsel and xdotool needs to be installed. Instead of the mousepad any other editor can be used. I've successfully tested the Sublime Text Editor and it opens a new tab for each new paste. Check Sample output for a usage example. This command is originated from here - Show Sample Output

    alias 2edit='xsel -b;n=pipe$RANDOM;xdotool exec --terminator -- mousepad $n -- search --sync --onlyvisible --name $n key --window %1 ctrl+v'
    ichbins · 2013-08-11 06:18:31 2
  • pdfunite is a part of the poppler-utils. poppler-utils package is only 150KB. The alternative - pdftk package is 14MB! Install poppler-utils if you need simple pdf operation commands like unite, separate, info, text/html conversions

    pdfunite 1.pdf 2.pdf united.pdf
    ichbins · 2013-07-09 11:44:58 1
  • it also works with the chrome browser. The alternative with tail and nc doesn't

    socat -u FILE:/var/log/syslog,ignoreeof TCP4-LISTEN:12345,fork,reuseaddr
    ichbins · 2013-02-18 13:36:01 0
  • Actually this is a shorter version that fits the 255 chars limit of this resource. The full version shows status in the right top corner: alias mpdd='while sleep 1; do _r=$(awk '\''BEGIN{FS=": "}/^Artist:/{r=r""$2};/^Title:/{r=r" - "$2};/^time:/{r=$2" "r};/^state: play/{f=1}END{if(f==1){print r}}'\'' <(mpc status;mpc currentsong));_l=${#_r};[ $_l -eq 0 ] && continue;[ -z "$_p" ] && _p=$_l;echo -ne "\e[s\e[0;${_p}H\e[K\e[u";_p=$((COLUMNS - _l));echo -ne "\e[s\e[0;${_p}H\e[K\e[0;44m\e[1;33m${_r}\e[0m\e[u";done &' mpc is defined like this: function mpc() { echo "$*" | nc 6600 } Show Sample Output

    while sleep 1; do (mpc status;mpc currentsong)|awk 'BEGIN{FS=": "}/^Artist:/{r=r""$2};/^Title:/{r=r" - "$2};/^time:/{r=$2" "r};/^state: play/{f=1}END{if(f==1){print r}}'|echo -ne "\e[s\e[0;0H\e[K\e[0;44m\e[1;33m$(cat -)\e[0m\e[u";done &
    ichbins · 2012-12-24 18:03:29 0

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Check These Out

Rename all files in lower case
rename is a really powerfull to, as its name suggests, rename files

m4a to mp3 conversion with ffmpeg and lame
A batch file version of the same command would be: for f in *.m4a; do ffmpeg -i "$f" -acodec libmp3lame -ab 256k "${f%.m4a}.mp3"; done

Rename files in batch

find which of the zip files contains the file you're searching for
This command find which of your zip (or jar) files (when you have lots of them) contains a file you're searching for. It's useful when you have a lot of zip (or jar) files and need to know in which of them the file is archived. It's most common with .jar files when you have to know which of the .jar files contains the java class you need. To find in jar files, you must change "zip" to "jar" in the "find" command. The [internal file name] must be changed to the file name you're searching that is archived into one of the zip/jar files. Before run this command you must step into the directory that contains the zip or jar files.

Fetch the current human population of Earth
They are using json now

pretend to be busy in office to enjoy a cup of coffee
Create a progress dialog with custom title and text using zenity.

get absolute file path
Retrieve absolute path name from relative path

Search for a single file and go to it
This command looks for a single file named emails.txt which is located somewhere in my home directory and cd to that directory. This command is especially helpful when the file is burried deep in the directory structure. I tested it against the bash shells in Xubuntu 8.10 and Mac OS X Leopard 10.5.6

run remote linux desktop
First of all you need to run this command. X :12.0 vt12 2>&1 >/dev/null & This command will open a X session on 12th console. And it will show you blank screen. Now press Alt + Ctrl + F7. You will get your original screen. Now run given command "xterm -display :12.0 -e ssh -X [email protected] &". After this press Alt + Ctrl + F12. You will get a screen which will ask you for password for remote linux system. And after it you are done. You can open any window based application of remote system on your desktop. Press Alt + Ctrl + F7 for getting original screen.

Extract audio from a video

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: