Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Tuesday, September 7, 2010

Copy many routes from one Linux box to another

netstat -rn | grep ^[0-9] | awk '{printf "route add -net %-15s gw %-15s netmask %s\n", $1, $2, $3}' | sort > routing_table

Monday, August 30, 2010

Simple Search & Replace in VI

In vi, this will replace any (uppercase or lowercase variation of the word "cat", or CAT, or cAt, with the word "dog" globally in the entire file.


%s/[Cc][Aa][Tt]/dog/g

Find files modified in the last 90 minutes

Find files modified in last 90 minutes:
find / -mmin -90

How to force a Linux file system check (fsck)

To reboot with fsck -- shutdown -rF now
-or-
touch /forcefsck
echo -p >> /fsckoptions
init 6
Upon reboot if the fsck is successful both files will be removed.

Quick one-liner to find large files on Linux

find / -type f -size +20000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'