### What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

### Check These Out

escape any command aliases
e.g. if rm is aliased for 'rm -i', you can escape the alias by prepending a backslash: rm [file] # WILL prompt for confirmation per the alias \rm [file] # will NOT prompt for confirmation per the default behavior of the command

Piping Microphone Audio Over Netcat
Send microphone audio to another computer using netcat and arecord. Connect to the stream using "nc [other ip] 3333|aplay" You can set up two-way communication by piping audio the reverse direction on another port: Machine #1: $arecord -D hw:0,0 -f S16_LE -c2|nc -l 3333 &;nc -l 3334|aplay Machine #2:$$ip=[machine1_ip];arecord -D hw:0,0 -f S16_LE -c2|nc$ip 3334 &;nc \$ip 3333|aplay

Randomize lines in a file
This appends a random number as a first filed of all lines in SOMEFILE then sorts by the first column and finally cuts of the random numbers.

Gets a random Futurama quote from /.

create an emergency swapfile when the existing swap space is getting tight
Create a temporary file that acts as swap space. In this example it's a 1GB file at the root of the file system. This additional capacity is added to the existing swap space.

Get a free shell account on a community server
Bash process substitution which curls the website 'hashbang.sh' and executes the shell script embedded in the page. This is obviously not the most secure way to run something like this, and we will scold you if you try. The smarter way would be: Download locally over SSL > curl https://hashbang.sh >> hashbang.sh Verify integrty with GPG (If available) > gpg --recv-keys 0xD2C4C74D8FAA96F5 > gpg --verify hashbang.sh Inspect source code > less hashbang.sh Run > chmod +x hashbang.sh > ./hashbang.sh

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Convert CSV to JSON

enable all bash completions in gentoo

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)