Commands by b2e (4)

  • If you're addicted to command-line solutions of ordinary actions or if you just want to set your volume from bed via mobile phone SSH, you can set this alias and use it as setvol 50 for setting volume on 50% gain Works only with ALSA, tested on Ubuntu 8.10. Give me some info about your experience. TIP: Try aslo command "mute" to toggle mute/unmute sound. But I don't know if this works on all distros.


    1
    alias setvol='aumix -v'
    b2e · 2009-05-21 22:39:40 4
  • With this you can unlock your KDE4 session via SSH, via mobile phone SSH or e. g. scheduled task in crontab (without asking password). Useful when you need to grant somebody access to your locked profile remotely. Create an alias (e. g. as "unlock") and use with remote KDE4 lock. This works only on KDE4 boxes because KDE 3 is using utility with another name. Tested on Kubuntu 8.10.


    -1
    killall -s 9 krunner_lock
    b2e · 2009-05-21 22:29:06 7
  • Forgot to lock your computer? Want to lock it via SSH or mobile phone or use it for scheduled lock? TIP: Make a alias for this (e. g. as "lock"). I found some howtos for ugly X11 lock, but this will use regular KDE locking utility. Note that KDE 3 is using utility with another name (I guess with the same argument --forcelock) Tested on Kubuntu 8.10. Stay tuned for remote unlock.


    3
    DISPLAY=:0 /usr/lib/kde4/libexec/krunner_lock --forcelock >/dev/null 2>&1 &
    b2e · 2009-05-21 22:19:16 5
  • Tuned for short command line - you can set the path to sessionstore.js more reliable instead of use asterixes etc. Usable when you are not at home and really need to get your actual opened tabs on your home computer (via SSH). I am using it from my work if I forgot to bookmark some new interesting webpage, which I have visited at home. Also other way to list tabs when your firefox has crashed (restoring of tabs doesn't work always). This script includes also tabs which has been closed short time before.


    2
    F="$HOME/.moz*/fire*/*/session*.js" ; grep -Go 'entries:\[[^]]*' $F | cut -d[ -f2 | while read A ; do echo $A | sed s/url:/\n/g | tail -1 | cut -d\" -f2; done
    b2e · 2009-05-21 21:58:42 4

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.

Share Your Commands


Check These Out

tail -f a log file over ssh into growl

Display disk partition sizes
It is the same but more faster real 0m0,007s user 0m0,011s sys 0m0,000s with my solution real 0m0,038s user 0m0,044s sys 0m0,000s with your solution :)

dump database from postgresql to a file

Keep a copy of the raw Youtube FLV,MP4,etc stored in /tmp/
Certain Flash video players (e.g. Youtube) write their video streams to disk in /tmp/ , but the files are unlinked. i.e. the player creates the file and then immediately deletes the filename (unlinking files in this way makes it hard to find them, and/or ensures their cleanup if the browser or plugin should crash etc.) But as long as the flash plugin's process runs, a file descriptor remains in its /proc/ hierarchy, from which we (and the player) still have access to the file. The method above worked nicely for me when I had 50 tabs open with Youtube videos and didn't want to have to re-download them all with some tool.

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Change the homepage of Firefox
Pros: Works in all Windows computers, most updated and compatible command. Cons: 3 liner Replace fcisolutions.com with your site name.

Copy without overwriting

Fast, built-in pipe-based data sink
This is shorter and actually much faster than >/dev/null (see sample output for timings) Plus, it looks like a disappointed face emoticon.

bash screensaver off

return the latest kernel version from a Satellite / Spacewalk server software channel


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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: