Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

scrottie (4167)


My email address is Spam me harder! *moan*

Journal of scrottie (4167)

Saturday October 11, 2008
01:09 AM

7 Useful Linux Tricks

[ #37640 ]
while true;do ssh -N -R *:2222:localhost:22 -l scott;sleep 10;done

... I'll leave that running on firewalled machines so I can get back in (ssh -l scott -p 2222 from outside the firewall. Sometimes I'll leave my main laptop at home and take the little P1120 (that runs for 8 hours on a charge!) and kind of work remotely. in this example is a non-firewalled host with your public key in its ssh/authorized_keys.

x11vnc -reflect 'listen:5551' -dontdisconnect -forever -passwd 'whatever' # on the remote, non-firewalled host

x11vnc -connect -dontdisconnect -forever # on the firewalled host

... similarly for X/VNC. The first command runs a VNC proxy on a non-firewalled host and the second pushes a VNC connection to that proxy.

for i in *.jpg;do djpeg -pnm < "$i" | pnmscale -pixels 500000 | cjpeg > "small_$i.jpg";done

El cheap thumbnails using the NetPBM utilities.

tar -czv --one-file-system -f - / /usr | ssh user@backuphost 'cat >/home/baks/whatever.tgz'

... tar-gz your data and write the tarball on another host over ssh while it works so you don't fill your harddrive up. If you have a lot of partitions you want to back up, it might be easier to do --exclude rather than --one-file-system, and exclude /proc, /mnt/whatever, etc.

cat /dev/rwd0d | gzip --force --stdout | ssh user@backuphost 'cat >/home/backs/whatever.wd0d.img'

... similar, but back up the raw partition data. That's NetBSD style partitions. You'd probably want /dev/hda1 etc. And if you have to restore from this backup, you'll find it'll need a filesystem check afterwards. If you modified the filesystem much, you may well find that it completely fails to complete a filesystem check.

/bin/busybox sh

Keep a busybox binary handy in case you hose shared libraries. In the old days, /bin and /sbin were built static so that they'd always work, even if shared libraries got hosed. Not so these days. busybox is statically linked and it has a built-in sh and numerous built-in commands. That should hopefully be enough to fix whatever went wrong. If you have a Firefox running when you screw the dynamic linker, you can use it to fetch busybox and then run it from an xterm you have open.

du -k / | sort -r -n -k 1 | more

... find out what's using up all of the drive space.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.