cat /sys/class/power_supply/BAT0/capacity - Shows your current battery percentage
cat /sys/class/net/w*/operstate - Shows if your wifi is connected (shows up if connected and down when not)
cat /sys/class/net/e*/operstate - Shows if your ethernet is connected (shows up if connected and down when not)

These are actual files in the linux system that you can open with a file manager and see the output !
There are many more like these in the /sys/class directory. My first reaction when i knew about this was like “Why the hell haven’t i heard about it before ?”. This tip may be useful to general users, but for people who like to do scripting, this can be gold.

Does anyone know where to get more information about the sys/class directory and what all the outputs mean in different cases ?

NOTE: i’m not a linux expert or a professional programmer, but i’m interested in them and learns what i can from online. So i prefer simple solutions that can be easily understood.

  • @Ordoviz
    link
    14 years ago

    topng </dev/screen >screenshot.png – Plan 9 took “Everything is a file” to its full potential