Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. 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.


Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.
Hide

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:

Hide

News

May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!
Hide

Top Tags

Hide

Functions

Save a file you edited in vim without the needed permissions - (Open)solaris version with RBAC

Terminal - Save a file you edited in vim without the needed permissions - (Open)solaris version with RBAC
:w !pfexec tee %
2009-07-29 08:35:00
User: ilyxa
Functions: tee
2
Save a file you edited in vim without the needed permissions - (Open)solaris version with RBAC

Alternatives

There is 1 alternative - vote for the best!

Terminal - Alternatives
:w !sudo tee > /dev/null %
2010-03-24 20:04:26
User: idemal
Functions: tee
Tags: vim sudo tee
30

Write a file you edited in Vim but that you do not have the permissions to write to (unless you use sudo.) Same as #1204 but without the echo to stdout that I find annoying.

command W :execute ':silent w !sudo tee % > /dev/null' | :edit!
2011-10-06 20:37:54
Functions: command tee
Tags: vim sudo tee
7

Calls sudo tee like all the other lines, but also automatically reloads the file.

Optionally you can add

command Wq :execute ':W' | :q

and

command WQ :Wq

to make quitting easier

:%!sudo tee %
2011-06-17 07:16:23
User: antone
Functions: tee
Tags: vim sudo tee
2

probably just like 1204, but uses tee as a filter (+ I actually understand how this one works)

w !sudo cat >%
if test -w $1; then vim $1; else sudo vim $1; fi
2010-08-14 13:28:32
User: srepmub
Functions: sudo test vim
Tags: vim sudo tee
-2

this avoids several VIM warnings, which I seem too stupid to disable: warning, readonly! and: file and buffer have changed, reload?!

Know a better way?

If you can do better, submit your command here.

What others think

remember not to forget the space between the ":w" and the "!"

Comment by linuxrawkstar 434 weeks ago

Essentially the most http://www.huaracherunpas-cher.fr/chaussure-huarache-nike_173.html popular Basketball models http://www.huaracherunpas-cher.fr/nike-huarache-safari_52.html makes money http://www.huaracherunpas-cher.fr/huarache-4_118.html with a modern perspective. You http://www.huaracherunpas-cher.fr/huarache-2017_99.html can buy http://www.huaracherunpas-cher.fr/air-huarache-run_157.html The year 2010 cheap http://www.huaracherunpas-cher.fr/huarache-noir-et-blanc_96.html Nike Atmosphere shoes http://www.huaracherunpas-cher.fr/nike-huarache-gris_59.html in case you search http://www.huaracherunpas-cher.fr/nike-air-huarache-light-ultramarine-og_75.html meticulously on the internet. http://www.huaracherunpas-cher.fr/nike-air-huarache-rouge_47.html They are http://www.huaracherunpas-cher.fr/air-huarache-og_71.html very popular and http://www.huaracherunpas-cher.fr/nike-huarache-ultramarine_125.html also known for comfort and ease http://www.huaracherunpas-cher.fr/nike-huarache-2_166.html and also model.Nike http://www.huaracherunpas-cher.fr/nike-air-huarache-blanc_41.html is one of the most http://www.huaracherunpas-cher.fr/nike-air-huarache-prix_120.html in-demand http://www.huaracherunpas-cher.fr/huarache-acheter_83.html models of athletics http://www.huaracherunpas-cher.fr/nike-air-huarache-run-chaussures_174.html shoes. They've got a http://www.huaracherunpas-cher.fr/chaussures-huarache-nike_152.html huge variety of sportswear http://www.huaracherunpas-cher.fr/nike-air-huarache-light-pas-cher_44.html and also http://www.huaracherunpas-cher.fr/nike-huarache-premium_126.html shoes which has been http://www.huaracherunpas-cher.fr/nike-air-flight-huarache-og_48.html designed for certain applications. It is http://www.huaracherunpas-cher.fr/nike-air-huarache-2_92.html very important http://www.huaracherunpas-cher.fr/nike-huarache-magenta_51.html obtain the right http://www.huaracherunpas-cher.fr/air-max-huarache_39.html shoe for all of your http://www.huaracherunpas-cher.fr/nike-air-huarache-light_168.html physical activities. Should http://www.huaracherunpas-cher.fr/air-huarache-grise_142.html you not http://www.huaracherunpas-cher.fr/ develop the right shoe, it http://www.huaracherunpas-cher.fr/huarache-instagram_169.html can result in foot http://www.huaracherunpas-cher.fr/nike-huarache_93.html in addition to mutual http://www.huaracherunpas-cher.fr/nike-air-huarache-retro_70.html incidents, especially http://www.huaracherunpas-cher.fr/air-huarache-femme_90.html the knees in http://www.huaracherunpas-cher.fr/nike-air-huarache-taille_172.html addition to .Our clients http://www.huaracherunpas-cher.fr/nike-huarache-id_164.html are an experienced and http://www.huaracherunpas-cher.fr/huarache-light-og_105.html high level branded products exchanging http://www.huaracherunpas-cher.fr/nike-air-huarache-run-pas-cher_98.html business in addition http://www.huaracherunpas-cher.fr/air-flight-huarache_68.html to concentrates on http://www.huaracherunpas-cher.fr/nike-huarache-light-og_115.html several http://www.huaracherunpas-cher.fr/huarache-vintage_42.html designs and high quality Nike http://www.huaracherunpas-cher.fr/chaussure-air-huarache_180.html Air Max Shoes and also http://www.huaracherunpas-cher.fr/huarache-noir_86.html Nike Shox, and http://www.huaracherunpas-cher.fr/huarache-leopard_77.html also Nike http://www.huaracherunpas-cher.fr/huarache-light_50.html Air Jordan, and http://www.huaracherunpas-cher.fr/chaussures-huarache_56.html so forth.The Nike Atmosphere Optimum comes http://www.huaracherunpas-cher.fr/nike-air-huarache-run_43.html in various http://www.huaracherunpas-cher.fr/nike-huarache-marron_165.html sizes and hues. As a http://www.huaracherunpas-cher.fr/chaussure-nike-air-huarache_76.html result, just about http://www.huaracherunpas-cher.fr/nike-huarache-run-pas-cher_61.html every player http://www.huaracherunpas-cher.fr/huarache-noir-femme_60.html incorporates a installing sizing http://www.huaracherunpas-cher.fr/nike-huarache-taille_49.html and a range of the http://www.huaracherunpas-cher.fr/nike-huarache-leopard_57.html favored color. By collecting http://www.huaracherunpas-cher.fr/nike-huarache-agassi_133.html http://www.huaracherunpas-cher.fr/nouvelle-nike-huarache_82.html that shoe, form ease and comfort, http://www.huaracherunpas-cher.fr/nike-air-huarache-international_104.html you'll search stunning. The http://www.huaracherunpas-cher.fr/huarache-noir-et-rose_109.html way they look don't http://www.huaracherunpas-cher.fr/huarache-nike-blanche_127.html hurt and it's http://www.huaracherunpas-cher.fr/nike-air-huarache-light-ultramarine_64.html also one more http://www.huaracherunpas-cher.fr/huarache-femmes_170.html gain if http://www.huaracherunpas-cher.fr/basket-nike-huarache_45.html you destroy into magnificence immediately http://www.huaracherunpas-cher.fr/chaussures-air-huarache_128.html after successful the particular http://www.huaracherunpas-cher.fr/huarrache-blanche_135.html competition. http://www.huaracherunpas-cher.fr/nike-huarache-boutique_147.html Your Nike Air http://www.huaracherunpas-cher.fr/huarache-chaussure_122.html Max involves many models, Nike http://www.huaracherunpas-cher.fr/nike-huarache-free-light_134.html Oxygen Maximum Ninety days, http://www.huaracherunpas-cher.fr/nike-huarache-jd_46.html Nike Air http://www.huaracherunpas-cher.fr/nike-air-huarache-og_162.html flow Greatest extent BW, Nike http://www.huaracherunpas-cher.fr/air-huarache-nike_87.html Air flow Maximum 89 http://www.huaracherunpas-cher.fr/nike-air-huarache-pas-chere_161.html , Nike http://www.huaracherunpas-cher.fr/free-huarache_103.html Air Greatest extent LTD, Nike Fresh http://www.huaracherunpas-cher.fr/nike-huarache-3_108.html air http://www.huaracherunpas-cher.fr/huarache-bleu_111.html Greatest extent The year 2010, Nike http://www.huaracherunpas-cher.fr/huarache-og-2017_143.html Atmosphere Optimum 2012, variations http://www.huaracherunpas-cher.fr/nike-huarache-light-ultramarine_171.html present your own various http://www.huaracherunpas-cher.fr/huarache-free-run_145.html mindset along with http://www.huaracherunpas-cher.fr/nike-air-huarache-turquoise_160.html taste. http://www.huaracherunpas-cher.fr/huarache-usa_100.html Now Nike Shox has turned into http://www.huaracherunpas-cher.fr/nike-huarache-paris_69.html a fairly older product http://www.huaracherunpas-cher.fr/acheter-huarache_84.html or service http://www.huaracherunpas-cher.fr/huarache-og_183.html variety, we have involving http://www.huaracherunpas-cher.fr/nike-air-huarache-1991_65.html Shox is said along http://www.huaracherunpas-cher.fr/achat-nike-huarache_137.html with support, or impact http://www.huaracherunpas-cher.fr/huarache-nike-noir_149.html moderation. Aside from, http://www.huaracherunpas-cher.fr/nike-air-huarache-solde_181.html the actual safety net http://www.huaracherunpas-cher.fr/nike-huarache-free-run-pas-cher_156.html occur the particular http://www.huaracherunpas-cher.fr/nikeair-huarache_88.html midsoles on the http://www.huaracherunpas-cher.fr/huarache-nike-chaussures_131.html sporting activities http://www.huaracherunpas-cher.fr/nike-huarache-noir-et-rose_58.html shoes, just like a planting http://www.huaracherunpas-cher.fr/air-huarache-noire_117.html season, will probably http://www.huaracherunpas-cher.fr/nike-huarache-chaussures_129.html early spring this runner http://www.huaracherunpas-cher.fr/huarache-air-max_163.html returning http://www.huaracherunpas-cher.fr/nike-air-huarache-beige_112.html and combine power to http://www.huaracherunpas-cher.fr/nike-huarache-blanc_85.html your pet. Your Nike http://www.huaracherunpas-cher.fr/nike-air-force-1-huarache_113.html shoes make sure a http://www.huaracherunpas-cher.fr/nike-air-flight-huarache_102.html more secure plus more http://www.huaracherunpas-cher.fr/nike-huarache-beige_91.html cozy expertise for the http://www.huaracherunpas-cher.fr/nike-huarache-usa_114.html jogger with the help http://www.huaracherunpas-cher.fr/nike-air-huarache-homme_150.html of shox engineering. http://www.huaracherunpas-cher.fr/nike-air-huarache-90_110.html So if you http://www.huaracherunpas-cher.fr/huarache-enfant_62.html go after an exceptional http://www.huaracherunpas-cher.fr/nike-huarache-rouge_81.html life style, you could http://www.huaracherunpas-cher.fr/air-huarache-paris_138.html at http://www.huaracherunpas-cher.fr/air-huarache-noir_116.html the same time trust shox http://www.huaracherunpas-cher.fr/air-huarache-light_139.html sneakers. Nike Shox NZ http://www.huaracherunpas-cher.fr/air-nike-huarache_107.html along with Nike http://www.huaracherunpas-cher.fr/nike-air-force-huarache_124.html Shox R4 http://www.huaracherunpas-cher.fr/nike-air-huarache-mid_78.html are a couple http://www.huaracherunpas-cher.fr/nike-huarache-homme_141.html of associated with basic http://www.huaracherunpas-cher.fr/nike-huarache-solde_94.html type of Nike Shox to fulfill http://www.huaracherunpas-cher.fr/nike-huarache-femme-pas-cher_140.html the necessity of http://www.huaracherunpas-cher.fr/huarache-montante_179.html the two man and http://www.huaracherunpas-cher.fr/huarache-chaussures_95.html woman. Each of our http://www.huaracherunpas-cher.fr/nike-huarache-free-run-2012_146.html affordable http://www.huaracherunpas-cher.fr/nike-id-huarache_158.html Nike Shox additionally classic http://www.huaracherunpas-cher.fr/nike-air-huarache-bleu_167.html models will provide you with http://www.huaracherunpas-cher.fr/nike-huarache-femmes_182.html an entirely distinct emotion. http://www.huaracherunpas-cher.fr/nike-huarache-toute-noir_154.html Beside http://www.huaracherunpas-cher.fr/nike-air-huarache-blanche_153.html the astonishing Nike http://www.huaracherunpas-cher.fr/nike-huarache-noir-et-bleu_130.html Fresh air Maximum string and http://www.huaracherunpas-cher.fr/nike-air-huarache-chaussures_80.html Nike Shox string, you http://www.huaracherunpas-cher.fr/huarache-5_74.html will also find http://www.huaracherunpas-cher.fr/nike-air-max-huarache-hybrid_121.html your preferred http://www.huaracherunpas-cher.fr/air-huarache-blanc_123.html Nike jordans, Nike Atmosphere http://www.huaracherunpas-cher.fr/nike-huarache-1991_55.html Push 1, Nike rift http://www.huaracherunpas-cher.fr/nike-air-huarache-og-retro_101.html to select your current http://www.huaracherunpas-cher.fr/huarache-bordeaux_53.html sports activity spirit along with http://www.huaracherunpas-cher.fr/nike-huarache-violet_54.html ideal http://www.huaracherunpas-cher.fr/nike-huarache-run_72.html and your perspective towards http://www.huaracherunpas-cher.fr/huarache-beige_106.html activities. Not only http://www.huaracherunpas-cher.fr/nike-air-zoom-huarache_89.html Nike line, you http://www.huaracherunpas-cher.fr/huarache-nike-pas-cher_79.html can also find The http://www.huaracherunpas-cher.fr/nike-huarache-2013_159.html puma company shoes, Gucci http://www.huaracherunpas-cher.fr/nike-air-huarache-original_144.html shoes to meet http://www.huaracherunpas-cher.fr/nike-huarache-prix_66.html up with ones diverse require http://www.huaracherunpas-cher.fr/boutique-nike-huarache_151.html irrespective of you might http://www.huaracherunpas-cher.fr/nike-air-huarache-safari_73.html be a woman or http://www.huaracherunpas-cher.fr/basket-huarache_63.html man. http://www.huaracherunpas-cher.fr/air-huarache-solde_40.html Regardless of coloring or http://www.huaracherunpas-cher.fr/huarache-run_132.html even type you desire. http://www.huaracherunpas-cher.fr/nike-air-huarache-noir_97.html We will be the http://www.huaracherunpas-cher.fr/nike-huarache-fille_148.html specialist company online which http://www.huaracherunpas-cher.fr/nike-huarache-pour-femme_155.html you can http://www.huaracherunpas-cher.fr/air-huarache-homme_67.html invest in The new year affordable Nike shoes, Please feel free to e mail us, you could enjoy free shipping and much more price reduction. Just view the site as well as our own item and occasional cost will certainly astonish you.

Comment by scott154 11 weeks and 1 day ago

Your point of view

You must be signed in to comment.