Tonight I’m being plagued by dropped ssh connections. 2 minutes of work, them bam everything goes away. I’ve seen screen used in the past, but never had to use its power until tonight. Ask any seasoned sysadmin and they’ll tell you that screen has saved their bacon many times, and it did for me tonight.…
You are currently browsing the Linux category
Using screen in Linux to save your bacon
SCP / SSH recipes
scp [[user@]from-host:]source-file [[user@]to-host:][destination-file]
Description of options
from-host
Is the name or IP of the host where the source file is, this can be omitted if the from-host is the host where you are actually issuing the command
user
Is the user which have the right to access the file and directory that is supposed to be…
Find to copy files into single directory
Makes copy of subset of dir/ and below with files that match the criteria. It keeps the nested directory structure. Uses
-print0 | xargs -0
to handle spaces in Windows names
find /cygdrive/f/dir1/ -name ‘*.doc’ -print0 | xargs -0 cp -a –target-directory=/cygdrive/c/Temp –parents
Search lister
This little script needs a lot of help But it will recurse down through the current directory and create a listing of files, their folders, sizes, and modification dates and times. it was written to run on Windows under Cygwin.
#!/bin/sh
# v1 jcz 30-dec-2009
# This script will search for files of a certain type and create…
Linux/UNIX/Cygwin find command
This is another one of those notes to myself because I look this stuff up every six months.
Basics of find. The following is a complete rip off of the content at: http://content.hccfl.edu/pollock/unix/findcmd.htm
But I wanted to keep a copy safe here. Thanks Wayne Pollock on 12/30/2009 10:27:30.
FIND
The -print action lists the names of files separated by…
How to set a static IP in Ubuntu from the shell
Edit
/etc/network/interfaces
and adjust it to your needs (in this example setup I will use the IP address 192.168.0.100):
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# This is a list of hotpluggable network interfaces.
# They will…
Remastersys Notes
My latest project is to turn my favorite Linux desktop configurations into stand alone distributions that I can run as LiveCDs or install anywhere.
Here are some links so that I don’t forget.
http://www.ubuntugeek.com/creating-custom-ubuntu-live-cd-with-remastersys.html
The all powerful find command
find <starting point> <search criteria> <action>
The starting point is the name of the directory where find should start
looking for files. The find command examines all files in this
directory (and any subdirectories) to see if they meet the specified
search criteria. If any do, find performs the specified action on each
found file. Here are some of the…
Another Linux Web MySQL Backup Script
I found this on on the nixcraft craft. Looks pretty good to me. Similar
in functionality to my other script posted here. I’m going to poach
some concepts from here to make a script that will auto-optimize all
tables in all databases on the mysql server.
#!/bin/sh
##################
## jcz 17-feb-2007
## copied from http://www.cyberciti.biz/tips/
## how-to-backup-mysql-databases-web-server-
## files-to-a-ftp-server-automatically.html
##############################################
## System + MySQL backup script
##…
gzip all directories in a directory
I don’t know why I keep having to do this, but I do. I always to create
separate archives of all the directories in a directory. So, here is
script from David (aka Matir aka EmptyCinema) from linuxquestions.org http://www.linuxquestions.org/questions/showthread.php?s=&postid=1839513#post1839513
to do just that (along with a sample sessions using it).
#!/bin/bash
for dir in */
do dir=`echo…