All Tips


11

Tip #300   Find and replace on specific files

Selective content replace on files. For example to replace '<?' with '<?php' in all PHP files:
Read more »

16

Tip #295   Portscan in one line

$HOST=127.0.0.1;for((port=1;port<=65535;++port));do echo -en "$port ";if echo -en "open $HOST $port\nlogout\quit" | telnet 2>/dev/null | grep 'Connected to' > /dev/null;then echo -en "\n\nport $port/tcp is open\n\n";fi;done Read more »
  • TAGS:

11

Tip #294   Mass-renaming files

Mass-renaming files using find and sed:
Read more »

10

Tip #290   Crawl a web page for links

lynx -dump http://www.spantz.org | grep -A999 "^References$" | tail -n +3 | awk '{print $2 }' Read more »

7

Tip #286   Addition with dc.

Add one number per line from stdin until a 0 is found, then print the result. Read more »
  • TAGS:

8

Tip #282   Highlight Grepped Text

Grep file(s) and highlight the grep matches using less...

Read more »

110

Tip #275   Get an ordered list of subdirectory sizes

This piece of code lists the size of every file and subdirectory of the current directory, much like du -sch ./* except the output is sorted by size, with larger files and directories at the end of the list. Useful to find where all that space goes.

Read more »

87

Tip #267   Remote network restart

I guess anyone who's administered several remote boxes has had the unfortunate problem of (when not thinking straight) taking down the network card on a machine you have no physical access to. The result being that the ssh session you used to connect dies. The typical mistake is to do something like (as root):

Read more »
  • TAGS:

-13

Tip #265   multiple file ftp

During an ftp session, get multiple files like this:

Read more »
  • TAGS: