Quickly list all files recursivly

More hackery today with this dirty little script to print out all files within a directory recursively. This is by no means perfect; any directory that includes a period/full stop (.) will be treated like a file, and any file that doesn’t include an extension (.txt, .jpg, .php etc) will be treated like a directory and ignored. Hey, I told you it was dirty.

find . | grep -Pv "^\.\/\." | grep -v ^\.$ | grep -Pv "^\.[^.]*$"

That’s obviously a little hard to remember so as always you can download the program here and place in /usr/bin or /home/user/bin.

Literally the only reason this came about is because I wanted to see how many lines of code I’d written – now I can find out by simply running

wc -l $(findall)

For anyone interested, it was 1507.


Read More

SCP commands for reference

SCP (secure copy) is a command which allows you to transfer files from one machine to another using SSH and is an extremely useful tool. Unfortunately the documentation can be a little confusing; the syntax for this command is:

scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port]  -S program] [[user@]host1:]file1 [...] [[user@]host2:]file2

And so I’ve documented some uses of the command here for future reference, which I will update as necessary.


Read More