Check These Out
This is just one method of checking to see if an IP is blocked via IP tables or CSF. Simple and to the point. Replace xx.xx.xx.xx with the IP you wish to check.
`blkid` is an interface to libuuid - it can read Device Mapper, EVMS, LVM, MD, and regular block devices.
-c /dev/null - Do not use cached output from /etc/blkid.tab or /etc/blkid/blkid.tab (RHEL)
-i - Display I/O Limits (aka I/O topology) information (not available in RHEL)
-p - Low-level superblock probing mode (not available in RHEL)
NR%2 == 1 on odd lines and 0 on even lines
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)
You can exclude more system folders or individual files which are not necessary for the backup and can be recreated after the restore procedure, like /lost+found, /mnt, /media, /tmp, /usr ...
Restoring the above backup procedure is as simple as becoming root and typing:
$ tar zxpf backup.tgz -C /
You can extract any file or directory out of the backup.tgz file for recovery, for instance, if you have a corrupt or mis-configured fstab file, you could simply issue the command:
$ tar zxpf backup.tgz /ect/fstab -C /
Other options:
v add verbose option to see files processed
A far safer solution is to restore the desired files under a different directory, and then compare, move, or update the files to their original locations afterward.
Checks your gmail account every 30 seconds and display the number of new messages in the top right corner of the terminal.
A kind of CLI "Gmail notifier" if you will. :-)
This is a mashup of http://www.commandlinefu.com/commands/view/7916/put-a-console-clock-in-top-right-corner and http://www.commandlinefu.com/commands/view/3386/check-your-unread-gmail-from-the-command-line
An old USB A/B cable is all you need to make your own Smart Home hardware!
Cut off and discard the B-portion of the USB cable. On the A side, connect the RED (+) and WHITE (D-) wires via a 1 kiloohm resistor.
$Picture:
http://imgur.com/dJGVlAU
Now plug the cable into a USB port on your Linux computer. Your hardware is ready!
Run the above command after changing variable mysms to your personal email-to-SMS gateway info as required by your cellular service provider.
The command uses the amazing usbmon tool (see link below) to detect the cable.
For the curious, to view the raw usbmon output, run this command: (Also see the sample output)
$usbmon -i usb0
How does it work? When the red and white wires are connected (via the 1 kiloohm resistor) the USB hardwere is tricked into thinking that a new USB device is trying to start up.
We then use the usbmon utility to capture the host USB events as it tries to talk to the cable.
The expect utility watches the usbmon stream and waits for the disconnect text "-2:128" before sending the SMS message.
Finally, the sendmail tool is used to email the SMS message to your smartphone via your cellular provider's SMS-to-email gateway.
As a result, when the electrical connection between the red and white wire is interrupted, or the USB cable is unplugged from your computer, you get an SMS notification of the disconnect event on your smartphone.
Could this be the cheapest smart home gadget ever? What are YOU going to sense with it?
Please let me know in the comments and please don't forget to click it up!
$
$Links:
$
http://www.linuxcertif.com/man/8/usbmon/
http://en.wikipedia.org/wiki/USB#Pinouts
http://imgur.com/dJGVlAU
tar(1) and cpio(1) are not fully platform agnostic, although their file formats are specified in POSIX.1-2001. As such, GNU tar(1) might not be able to extract a BSD tar(1) archive, and ivce versa. pax(1) is defined in POSIX.1-2001. To extract an archive:
$ pax -rf archive.tar