bashoneliners.com

Welcome to bashoneliners.com, a curated collection of practical and well-explained Bash one-liners, snippets, tips and tricks. We aim to make each published one-liner to be of high quality: useful, easy to read, follows best practices, with clear, detailed, accurate explanation. These one-liners should help you automate tasks, troubleshoot problems, whether it be in system administration, file management, networking or programming.

Get streamed FLV from Chrome with lsof

export psid=$(pgrep -f libflashplayer.so); cp /proc/$psid/fd/$(lsof -p $psid | grep eleted | awk {' print $4 '} | sed -e "s/[a-z]//g") saved.flv

May 11, 2013GNA

Replace symlinks with the actual files they are pointing at

find /path/to/dir -type l -exec sh -c 'cp --remove-destination "$(readlink "{}")" "{}"' \; 

April 24, 2012bashoneliners

Copy a directory with a large number of files to another server

tar cp -C /path/to/dir . | ssh server2 'tar x -C /path/to/target'

November 17, 2011bashoneliners