New answers tagged utilities
Detecting UTF-8 encoding: file will usually give you the encoding; to get a more processable output from file, you've got to pass some options, and cut it until you get the part that describes the encoding: file --brief --mime myfile.txt | cut -d '=' -f 2 Note that it may either be 'us-ascii' or 'utf-8', depending on whether it finds some UTF-8 ...
You should try the file command, it already does a good job of determining information about the contents, although it doesn't analyse the full data file. If you have a large file somefile where the first utf-8 character doesn't appear until the end, file somefile will not detect that as an utf-8 file.
runuser is a recent command, it appeared in util-linux 2.23. Ubuntu 14.04 ships util-linux 2.20, so it doesn't have this command yet. runuser isn't very useful. Just use su instead. Note that the command runuser user -c 'cd' doesn't actually do anything — the scope of cd does not extend to the next call to runuser. You'd have to use runuser user -c 'cd ...
xprop -root 2>/dev/null | sed -n '/^_NET_ACTIVE_WINDOW/ s/.* // p'
Top 50 recent answers are included