Check These Out
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
)
only for sudo-style systems.
Use this construct instead of I/O re-directors ``>'' or ``>>'' because
sudo only elevates the commands and *not* the re-directors.
***warning: remember that the `tee` command will clobber
file contents unless it is given the ``-a'' argument
Also, for extra security, the "left" command is still run unprivileged.
This command sequence allows simple setup of (gasp!) password-less SSH logins. Be careful, as if you already have an SSH keypair in your ~/.ssh directory on the local machine, there is a possibility ssh-keygen may overwrite them. ssh-copy-id copies the public key to the remote host and appends it to the remote account's ~/.ssh/authorized_keys file. When trying ssh, if you used no passphrase for your key, the remote shell appears soon after invoking ssh
[email protected]
This starts a very basic X session, with just a simple xterm. You can use this xterm to launch your preferred distant session.
$ ssh -X
[email protected] gnome-session
Try also startkde or fluxbox or xfce4-session.
To switch between your two X servers, use CTRL+ALT+F7 and CTRL+ALT+F8.
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22)
(all files & folders on destination server/folder will be deleted)
will search trought pidgin conversation logs for "searchterm", and output them stripping the html tags. The "sed" command is optionnal if your logs are stored in plain text format.
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"
}
If your web server is down, this command will periodically attempt to connect to it. If the output is blank, your server is not yet up. If you see HTML, your server is up. Obviously, you need to replace the Google URL with your web server URL...
* 'watch' -- a command for re-executing a command and displaying
the output
* '-n 15' -- tells watch to redo the command every 15 seconds
* 'curl' -- a handy utility for getting the source of a web page
* '-s' -- tells curl to be silent about failing
* '--connect-timeout 10' -- Try to connect for 10 seconds