Commands by klisanor (2)

  • translate <some phrase> [output-language] [source-language] 1) "some phrase" should be in quotes 2) [output-language] - optional (default: English) 3) [source-language] - optional (default: auto) translate "bonjour petit lapin" hello little rabbit translate "bonjour petit lapin" en hello little rabbit translate "bonjour petit lapin" en fr hello little rabbit Show Sample Output

    translate(){wget -U "Mozilla/5.0" -qO - "${3:-auto}&tl=${2:-en}&dt=t&q=$1" | cut -d'"' -f2}
    klisanor · 2014-06-10 12:08:51 0
  • The command renames all files in a certain directory. Renaming them to their date of creation using EXIF. If you're working with JPG that contains EXIF data (ie. from digital camera), then you can use following to get the creation date instead of stat. * Since not every file has exif data, we want to check that dst is valid before doing the rest of commands. * The output from exif has a space, which is a PITA for filenames. Use sed to replace with '-'. * Note that I use 'echo' before the mv to test out my scripts. When you're confident that it's doing the right thing, then you can remove the 'echo'... you don't want to end up like the guy that got all the files blown away. Credits: Show Sample Output

    for i in *.jpg; do dst=$(exif -t 0x9003 -m $i ) && dst_esc=$(echo $dst | sed 's/ /-/g' ) && echo mv $i $dst_esc.jpg ; done
    klisanor · 2012-05-02 07:23:38 1

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

silent/shh - shorthand to make commands really quiet
Sometimes I just want to run a command quietly but all that keyboard shifting makes my fingers hurt. This little function does the job eg.: $ if shh type less; then PAGER=less; fi

Better recursive grep with pretty colors... requires ruby and gems (run: "gem install rak")

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

Define an alias with a correct completion
In Bash, when defining an alias, one usually loses the completion related to the function used in that alias (that completion is usually defined in /etc/bash_completion using the complete builtin). It's easy to reuse the work done for that completion in order to have smart completion for our alias. That's what is done by this command line (that's only an example but it may be very easy to reuse). Note 1 : You can use given command line in a loop "for old in apt-get apt-cache" if you want to define aliases like that for many commands. Note 2 : You can put the output of the command directly in your .bashrc file (after the ". /etc/bash_completion") to always have the alias and its completion

save command output to image

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

Speed up the keyboard repeat rate in X server

Numbers guessing game
Felt like I need to win the lottery, and wrote this command so I train and develop my guessing abilities.

Join flv files

Url Encode

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: