Commands using acpi (12)


  • 3
    acpi -tc
    hypnojazz · 2009-03-29 22:27:31 7
  • The original proc file doesn't exist on my system. Show Sample Output


    3
    acpi -b
    dbbolton · 2010-06-10 23:23:16 6
  • There is no need for variables. I also added sleep to reduce cpu usage, however I didn't test it.


    3
    while :; do acpi -t | osd_cat -p bottom ; sleep 1; done &
    John_W · 2011-01-14 13:57:45 9
  • My firefox overheats my cpu, sometimes above 90 degrees Celsius ( hence the name? ) To keep an eye on temperature, I put this command inside KAlarm ( a kind of cron) to be repeated every minute, for 5 seconds, color red ( default for osd_cat). Its pretty, ultra small, displays a micro 2 lines text on every desktop and over everything and do not steal focus or interrupt any task. I get the information passively, in the low profile bottom of the screen. Of course you can use it inside a terminal. Just do it: watch -n 60 'acpi -t | osd_cat -p bottom'


    2
    acpi -t | osd_cat -p bottom
    m33600 · 2009-10-23 05:22:01 3
  • works best in a shell script run at startup. It will ping localhost once and output to null, after it does that, acpi is called for temperature in fahrenheit and piped through to another loop that feeds notify-send for a tooltip. After waiting five minutes, it will start over. Show Sample Output


    2
    while ping -c 1 127.0.0.1 > /dev/null; do acpi -t -f | while read tem; do notify-send "$tem"; done; sleep 300; done
    c0de · 2011-07-02 06:47:25 8
  • This time I added a print to reemaining energy, every minute, time stamped. The example shown here is complete and point to large discrepancies as time passes, converging to accuracy near the end. Show Sample Output


    1
    echo start > battery.txt; watch -n 60 'date >> battery.txt ; acpi -b >> battery.txt'
    m33600 · 2009-10-19 05:28:15 4

  • 1
    acpi -V
    vajorie · 2010-06-09 14:23:08 3

  • 1
    acpi -a
    wiburg · 2010-06-12 20:07:27 3
  • No need for a colon, and one less semicolon too. Also untested.


    1
    while sleep 1; do acpi -t | osd_cat -p bottom; done &
    linuts · 2011-01-14 23:22:57 4
  • This prints "Charging" or "Discharging". Obviously, this will indicate the status of the AC adapter. The awk part could be from 1-6. I removed the comma because it is useless when only looking at one element of the output array. See acpi(1) for more info.


    0
    acpi -b | sed 's/,//g' | awk '{print $3}'
    dbbolton · 2010-06-11 05:32:57 4

  • -2
    acpi | cut -d '%' -f1 | cut -d ',' -f2
    sn0opy · 2009-02-16 13:36:01 101
  • Checks whether your power supply is still plugged in. If not it will trigger an alarm at maximum volume. Show Sample Output


    -3
    check(){ power=$(acpi -a) ; if [[ $power == *on-line* ]] ; then echo "supply is on"; else echo "somebody is steeling your laptop"; amixer -c0 set Master 100+ unmute ; mpg123 nuclear-alarm.mp3 ; fi } ;while true; do check ; sleep 2 ; done
    hoodie · 2011-12-10 13:42:52 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: