Check These Out
This function will encrypt a bash script and will only execute it after providing the passphrase. Requires mcrypt to be installed on the system.
Lockstat will sample the kernel 977 times per second, and print out the functions that it sees executing on the CPU during the sample. The -s 10 switch tells lockstsat to not only print that function, but also show the call stack (up to 10 deep).
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"
}
I wanted to view only executables installed by a package. This seemed to work.
There's got to be easier way, please share.
Note:
(1) Replace iptables with the package name of your interest
(2) The command will trash any existing environment variable named 'lst'
(3) Instead if you are interested in viewing just .ko or .so files installed by this package, then
that would be easy:
$ dpkg -L iptables | grep "\.[sk]o$"
We don't use CPU scaling, but just in case you do, there is something interesting to note. If you look at the /proc/cpuinfo, the speed listed is current running speed of the processors and not the real speed of the chip.
This will fetch a metascore from metacritic.com.
It requires a url from metacritic without the http://www.metacritic.com/
Example:
$ metascore games/platforms/wii/supermariogalaxy
-
$ metascore tv/shows/marriageref
-
$ metascore video/titles/newmoon
Would be cool to use this in some sort of a graph.
'top' has fancy layout modes where you can have several windows with different things displayed. You can configure a layout and then save it with 'W'. It will then be restored every time you run top.
E.g. to have two colored windows, one sorted by CPU usage, the other by memory usage, run top
$ top
then press the keys
$
and then as you don?t want to repeat this the next time:
$
An alias cannot be executed as command in a find -exec line. This form will trick the command line and let you do the job.
$ buf myfile.txt
This is useful when you are making small but frequent changes to a file. It keeps things organised and clear for another administrator to see what changed and at what time. An overview of changes can be deduced using a simple:
$ ls -ltr