All commands (14,187)

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.

Share Your Commands


Check These Out

Create a directory and cd into it
This creates a bash function `take` that you can call with the name of the directory as the first parameter. Add the function to ~/.bashrc to have it available anytime.

Gathering all MAC's in your local network
replace eth0 with your ethernet or wireless network interface.

Find unused IPs on a given subnet

Place the argument of the most recent command on the shell
This works if your terminal is in Vi mode

Find and copy files from subdirectories to the current directory

mirrors directory to a ftp server
http://lftp.yar.ru/

Send a local file via email
This just reads in a local file and sends it via email. Works with text or binary. *Requires* local mail server.

easily find megabyte eating files or directories

Clean way of re-running bash startup scripts.
This replaces the current bash session with a new bash session, run as an interactive non-login shell... useful if you have changed /etc/bash.bashrc, or ~/.bashrc If you have changed a startup script for login shells, use $ exec bash -l Suitable for re-running /etc/profile, ~/.bash_login and ~/.profile. edit: chinmaya points out that $ env - HOME=$HOME TERM=$TERM bash -s "exec bash -l" will clear any shell variables which have been set... since this verges on unwieldy, might want to use $ alias bash_restart='env - HOME=$HOME TERM=$TERM bash -s "exec bash -l"'

Monitoring wifi connection by watch command (refresh every 3s), displaying iw dump info and iwconfig on wireless interface "wlan0"


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: