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

Get current Xorg resolution via xrandr
Not sure if it works the same on any shell.

Quick notepad
Quick write some notes to a file with cat. Ctrl+C when you have finish.

Print macOS current power delivery max wattage
Print the max wattage of the current power draw source for a Mac. Note that the current amount of watts drawn may be lower, particularly if a high-wattage adapter is plugged into a Mac that has a full battery.

VI config to save files with +x when a shebang is found on line 1
Add this to .vimrc to automatically give scripts with a shebang (e.g., #!/usr/bin/perl) executable permissions when saving. Found @ http://stackoverflow.com/questions/817060/creating-executable-files-in-linux/817522#817522

Watch contents of a file grow
In this case, I'm keeping an eye on /var/log/messages, but of course any file will do. When I'm following a file, I generally don't want to see anything other than what has been added due to the command or service I've executed. This keeps everything clean and tidy for troubleshooting.

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

sends a postscript file to a postscript printer using netcat

find an unused unprivileged TCP port
Not really better - just different ;) There's probably a really simple solution out there somewhere...

Search commandlinefu.com from the command line using the API
Usage: cmdfu hello world

Get Your IP Geographic Location with curl and jq


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: