Useful linux/unix commands

⚠️ This article was originally published in 2006 at dubi.org/useful-commands. The content is extremely outdated and is preserved here for nostalgic purposes only.

This will let cd change to a directory (exactly the same functionality as the normal cd command), but now you can type bd to go back a directory. If you keep using bd, it keeps going back in the history of folders you’ve been in.

Terminal window
alias cd="pushd $1 > /dev/null"
alias bd="popd > /dev/null"

Through subversion, move all files (NON-recursively) of type _.php from some part of the working copy to another (svn cp/mv don’t seem to support _ or *.php or any wildcards, for some reason):

Terminal window
find /some/path -maxdepth 1 -mindepth 1 -iname "*.php" -exec svn mv {} /some/other/path \;

(Replace -exec with -ok to be prompted before each svn mv)

Find all files modified in the last day:

Terminal window
find /some/path -mtime -1

Find all files modified since 4pm on Sept 15 (adjust for your date/time):

Terminal window
touch 09151600 tmp_find_file
find /some/path -newer tmp_find_file -print
rm tmp_find_file

(Thanks to linuxpowered.com for the find information)

Remove all subversion files from a directory

Terminal window
find /some/path -ipath *svn* -exec rm -rf {} \;

Kill all processes that match some filter text:

Terminal window
ps aux | grep FILTER_TEXT | awk '{print $1}' | xargs kill

<-Find more writing back at https://alan.norbauer.com