Check These Out
you don't have to spell out numbers, you can just use nu
This script compares the modification date of /var/lib/dpkg/info/${package}.list and all the files mentioned there.
It could be wrong on noatime partitions.
Here is non-oneliner:
#!/bin/sh
package=$1;
list=/var/lib/dpkg/info/${package}.list;
inst=$(stat "$list" -c %X);
cat $list |
(
while read file; do
if [ -f "$file" ]; then
acc=$(stat "$file" -c %X);
if [ $inst -lt $acc ]; then
echo used $file
exit 0
fi;
fi;
done
exit 1
)
connect to it with any network command (including web browser - if you don't mind weird formatting)
curl 127.0.0.1:9876
nc 127.0.0.1 9876
Outputs pseudo-random sounds to speakers (stereo mode because of -c 2) when there are any kind of network activity.
I usually have 5 or more ssh connections to various servers, and putting this command in my .bash_profile file makes my putty window or x terminal window title change to this easily recognizable and descriptive text. Includes the username, group, server hostname, where I am connecting from (for SSH tunneling), which device pts, current server load, and how many processes are running.
You can also use this for your PROMPT_COMMAND variable, which updates the window title to the current values each time you exec a command.
I prefix running this in my .bash_profile with
$ [[ ! -z "$SSH_TTY" ]] &&
which makes sure it only does this when connecting via SSH with a TTY.
Here's some rougher examples from http://www.askapache.com/linux-unix/bash_profile-functions-advanced-shell.html
$ # If set, the value is executed as a command prior to issuing each primary prompt.
$ #H=$((hostname || uname -n) 2>/dev/null | sed 1q);W=$(whoami)
$ #export PROMPT_COMMAND='echo -ne "\033]0;${W}@${H}:${PWD/#$HOME/~} ${SSH_TTY/\/dev\//} [`uptime|sed -e "s/.*: \([^,]*\).*/\1/" -e "s/ //g"`]\007"'
$ #PROMPT_COMMAND='echo -ne "\033]0;`id -un`:`id -gn`@`hostname||uname -n 2>/dev/null|sed 1q` `command who -m|sed -e "s%^.* \(pts/[0-9]*\).*(\(.*\))%[\1] (\2)%g"` [`uptime|sed -e "s/.*: \([^,]*\).*/\1/" -e "s/ //g"` / `command ps aux|wc -l`]\007"'
$ #[[ -z "$SSH_TTY" ]] || export PROMPT_COMMAND
$ #[[ -z "$SSH_TTY" ]] && [[ -f /dev/stdout ]] && SSH_TTY=/dev/stdout
And here's a simple function example for setting the title:
$ function set_window_title(){ echo -e "\033]0; ${1:
[email protected]$HOST - $SHLVL} \007"; }
*** CAREFULLY READ THE NOTES **** *** THIS DOES NOT WORK "OUT OF THE BOX" ***
You'll need a few minutes of CAREFUL reading before making your own Twitter feed:
In 2010 simple command line Twitter feed requests all stopped working because Twitter upgraded to SSL security.
Https requests for a filtered Twitter stream feed now require a special header called "oauth_header".
The benefit is that your stream feed and login info is securely encrypted.
The bad news is that an "oauth_header" takes some work to build.
Fortunately, four functions, imaginatively named step1, step2, step3 and step4 can be used to build a customized oauth_header for you in a few minutes.
Now, go look at "step1" to start creating your own oauth_header!
http://public-dns.info gives a list of online dns servers. you need to change the country in url (br in this url) with your country code. this command need some time to ping all IP in list.