Commands by leftyfb (2)

  • Requires: curl xsel access to the internet( This is an alias utilizing the service to make sharing files easier from the command line. I have modified the alias provided by to use xsel to copy the resulting URL to the clipboard. The full modified alias is as follows since commandlinefu only allows 255 characters: transfer() { if [ $# -eq 0 ]; then echo "No arguments specified. Usage:\necho transfer /tmp/\ncat /tmp/ | transfer"; return 1; fi if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "$basefile" |xsel --clipboard; else curl --progress-bar --upload-file "-" "$1" |xsel --clipboard ; fi; xsel --clipboard; } Show Sample Output

    transfer() { basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');curl --progress-bar --upload-file "$1" "$basefile"|xsel --clipboard;xsel --clipboard ; }
    leftyfb · 2016-03-20 19:38:48 0
  • I save this to bin/iptrace and run "iptrace ipaddress" to get the Country, City and State of an ip address using the service. I add the following to my script to get a tinyurl of the map as well: URL=`lynx -dump$1|grep details|awk '{print $2}'` lynx -dump$URL|grep tinyurl|grep "19. http"|awk '{print $2}'

    lynx -dump$1|grep address|egrep 'city|state|country'|awk '{print $3,$4,$5,$6,$7,$8}'|sed 's\ip address flag \\'|sed 's\My\\'
    leftyfb · 2009-02-25 17:16:56 5

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

Show max lengths of all fields in a pipe delimited file with header row

Quick calculator at the terminal
Useful for quick calculations at the command line. $math_expr is any arithmetic expression (see sample output): 4.5*16+3^2 s(3.1415926/2) More options in the bc man page.

Set laptop display brightness
Run as root. Path may vary depending on laptop model and video card (this was tested on an Acer laptop with ATI HD3200 video). $ cat /proc/acpi/video/VGA/LCD/brightness to discover the possible values for your display.

Extract audio from Mythtv recording to Rockbox iPod using ffmpeg
There are some pretty good live performances on late night TV. With Mythtv I record David Letterman, Jimmy Fallon, and Conan nightly all in HD from over the air broadcasts. If I find a live performance I like I copy it to my Rockboxed iPod using this command. The Rockbox firmware knows how to downmix 5.1 audio. The command above extracts the audio from the video starting at 58 minutes and 15 seconds. It ends at the end of the file since this was the last performance of the recording. The command creates an ac3 file. I copy the ac3 file to my Rockbox iPod and rock on.

import gpg key from the web
imports a public key from the web. I know this by head.. but useful nevertheless

Display summary of git commit ids and messages for a given branch
In color. Additionally you may define in your ~/.gitconfig and run it just as 'git one': one = log --pretty='format:%Cgreen%H %Cred%ai %Creset- %s'

Erase to factory a pendrive, disk or memory card, and watch the progress

Avoids ssh timeouts by sending a keep alive message to the server every 60 seconds
ssh_config is the system-wide configuration file for ssh. For per-user configuration, which allows for different settings for each host: $echo 'ServerAliveInterval 60' >> ~/.ssh/ssh_config On OSX: $echo 'ServerAliveInterval 60' >> ~/.ssh/config or $echo 'ServerAliveInterval 60' >> ~/etc/ssh_config

user 'tr' to convert mixed case in a file to lower case
convert mixed case in a file to lower case

Search from the command line using the API
Usage: cmdfu hello world

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: