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

MPD + Digitally Imported
1.- Enter into the playlist path. 2.- Run the command. 3.- Playlists created!

print a file on a single line
Example: you have a package.txt you want to install on a system. Instead of this: cat package.txt package1 package2 package3 You want it to cat out on one line so you can print "yum install package1 package2 package3"

List the URLs of tabs of the frontmost Chrome window in OS X
This also works with Safari if you just change the application name. Replace $ window 1 with $ windows to list the URLs of tabs in all windows instead of only the frontmost window. This also includes titles: $ osascript -e{'set o to""','tell app"google chrome"','repeat with t in tabs of window 1','set o to o&url of t&"\n"&" "&title of t&"\n"',end,end}|sed \$d .

Get all upgradable deb packages in a single line
Works for debian and ubuntu based distros.

Safely remove old unused kernels in Ubuntu/Debian
Removes piling kernels from /boot, save the current one. This command DOES NOT remove the 'linux-image-generic' package, so you'll continue getting kernel updates

Search and replace text in all php files with ruby
Search for the string "search" and replace it with the string "replace", on all files with the extension php in the curret folder. Do also a backup of each file with the extension "bkp".

Take screenshot through SSH
When connected to a box via ssh you can do a quick screenshot of that box using this command. After that you can rscp it over to your box and look at it.

Create a new file

Join the content of a bash array with commas
$ DOCKER_APP_VARS=(DATABASE_USER=dbuserro, DATABASE_PASSWORD=maipass) [jeff@omniscience container] (master)$ echo docker run $(printf -- " -e %s" ${DOCKER_APP_VARS[*]}) -name 12factorapp mattdm/fedora-small docker run -e DATABASE_USER=dbuserro, -e DATABASE_PASSWORD=maipass -name 12factorapp mattdm/fedora-small Note that the printf method by itsself doesn't include a newline (\n), so you'll need to embed it into an echo statement or something that does.

Hiding and Show files on Mac OS X
These commands will mark a file as hidden or visible to Mac OS X Finder. Notice the capitol V vs the lowercase v. This will also work for directories. setfile -a V foo.bar; // This marks the file invisible setfile -a v foo.bar; // This marks the file visible I have also found that adding the following aliases are helpful: alias hide='setfile -a V' alias show='setfile -a v'


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: