### Commands tagged Game (6) the last day the last week the last month all time sorted by date votes

• Felt like I need to win the lottery, and wrote this command so I train and develop my guessing abilities. Show Sample Output

13
A=1;B=100;X=0;C=0;N=\$[\$RANDOM%\$B+1];until [ \$X -eq \$N ];do read -p "N between \$A and \$B. Guess? " X;C=\$((\$C+1));A=\$((\$X<\$N?\$X:\$A));B=\$((\$X>\$N?\$X:\$B));done;echo "Took you \$C tries, Einstein";
· 2009-12-16 13:24:23
• Really bored during class so I made this... Basically, you hold period (or whatever) and hit enter after a second and you need to make the next line of periods the same length as the previous line... My record was 5 lines of the same length. It's best if you do it one handed with your pointer on period and ring on enter.

9
count="1" ; while true ; do read next ; if [[ "\$next" = "\$last" ]] ; then count=\$((\$count+1)) ; echo "\$count" ; else count="1" ; echo \$count ; fi ; last="\$next" ; done
· 2010-03-30 04:02:29
• Change the APP variable's value to whatever you want to install. Depending on how fast your machine is, you'll want to adjust the value 50 to something else. You might also want to play a different game than Gnometris - just make sure it's a GUI game.

2
APP=wine; if [ \$(sudo apt-get --print-uris -y install \$APP | sed -ne 's/^After this operation, \([0-9]\{1,\}\).*MB.*/\1/p') -gt 50 ]; then gnometris 2>/dev/null & sudo apt-get install \$APP; else sudo apt-get install \$APP; fi
· 2010-04-18 19:32:26
• hold period (or whatever character) and hit enter after a second. You need to make the next line of periods the same length as the previous line... score starts at 0 and increase each time length of line is same.

1
while \$8;do read n;[ \$n = "\$l" ]&&c=\$((\$c+1))||c=0;echo \$c;l=\$n;done
· 2010-03-31 00:41:08
• Where \$1 = author and \$2 = mod name You need to be running a daily build of Minetest (for example from the 'minetestdevs/daily-builds' PPA), or some bleeding edge mods will not work or crash the game. Update a mod by entering its subdirectory under ~/.minetest/mods and doing `git pull && git submodule update --recursive --remote --init`

0
cd ~/.minetest/mods && git clone --recursive https://github.com/\$1/\$2.git
· 2015-09-30 19:24:59

• 0
emacs -f snake
· 2015-11-03 23:34:57

### What's this?

commandlinefu.com 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.

### Check These Out

Add all unversioned files to svn
No need for grep, let awk do the match. This will not behave properly if the filenames contains whitespace, which is awk's default field separator.

add all files not under version control to repository
With the force options the same results can be achieved

list block devices
Shows all block devices in a tree with descruptions of what they are.

find and grep Word docs
Find Word docs by filename in the current directory, convert each of them to plain text using antiword (taking care of spaces in filenames), then grep for a search term in the particular file. (Of course, it's better to save your data as plain text to make for easier grepping, but that's not always possible.) Requires antiword. Or you can modify it to use catdoc instead.

Harder, Faster, Stronger SSH clients
We force IPv4, compress the stream, specify the cypher stream to be Blowfish. I suppose you could use aes256-ctr as well for cypher spec. I'm of course leaving out things like master control sessions and such as that may not be available on your shell although that would speed things up as well.

Find the package that installed a command

Kill multiple instances of a running process

analyze traffic remotely over ssh w/ wireshark
When using tcpdump, specify -U option to prevent buffering.

Get mouse location (X,Y coordinates)

Quick command line math
expr will give you a quick way to do basic math from the CLI. Make sure you escape things like * and leave a space between operators and digits.