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.

Universal configuration monitoring and system of record for IT.

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:



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!

Top Tags



Psst. Open beta.

Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:

  • » The open beta is running a copy of the database that will not carry over to the final version. Don't post anything you don't mind losing.
  • » If you wish to use your user account, you will probably need to reset your password.
Your feedback is appreciated via the form on the beta page. Thanks! -Jon & CLFU Team

Add a line for your username in the /etc/sudoers file, allowing you to sudo in Fedora

Terminal - Add a line for your username in the /etc/sudoers file, allowing you to sudo in Fedora
echo 'loginname ALL=(ALL) ALL' >> /etc/sudoers
2009-03-19 13:23:43
User: refrax
Functions: echo
Add a line for your username in the /etc/sudoers file, allowing you to sudo in Fedora

I am new to linux, and I was trying to figure out why I could not sudo with my username in Fedora 10. This command, when run as root, will add a line to the sudoers file allowing the loginname supplied to sudo. The above line will require a password when you sudo, if you wish to sudo without password, use:

echo 'loginname ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

instead. you have to run this command as su, and this is just an easier way of using visudo, just adds it right from the terminal.


There are 3 alternatives - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think


Better to use: visudo

Comment by mpb 418 weeks and 6 days ago

I'm curious why it's better to use visudo? Like I said, new to linux, wanting to learn what is good.

Comment by refrax 418 weeks and 6 days ago

Visudo checks for correct syntax, so you can be sure your sudoers file will work:

[email protected]:14:39:0:/home/alanceil> visudo


>>> /etc/sudoers: syntax error near line 2

What now?

From the manpage:

visudo edits the sudoers file in a safe fashion, analogous to vipw(8). visudo locks the sudoers file against multiple simultaneous edits, provides basic sanity checks, and checks

for parse errors. If the sudoers file is currently being edited you will receive a message to try again later.

Comment by Alanceil 418 weeks and 6 days ago

You should use visudo, or atleast substitute "$(echo whoami)" for 'loginname' ;-)

Comment by ozymandias 418 weeks and 6 days ago

I'm sorry -- $(who am i | awk '{print $1}') would work better...

Comment by ozymandias 418 weeks and 6 days ago

Use 'visudo' and nothing but 'visudo' (not 'awk', not 'echo', etc).

If you don't have visudo, install it; if you still can't access it, then (and only then) you might resort to hacks--or rebuild your computer from the ground up!

Comment by alexandersafir 418 weeks and 6 days ago

ok, well, no don't do that. sudo is an administrative tool, but that's what ubuntu has taught.. be root and do it all.

There is a reason why windows fails giving the user administrative rights, and why root is a different user in Linux, and other users have less rights (the monolithic hiracy)

visudo is good, but knowing your system is better.

I voted down not because the method was wrong, but the idea was wrong.

Comment by JesusSuperstar 418 weeks and 6 days ago

root is a design error

Comment by maht 418 weeks and 6 days ago

@koukos Sudo is not a wrong idea. Sudo has been around long before Ubuntu. Mac OS X, for example, has been using sudo since day one, further by disabling root entirely (as does Ubuntu). Most major distributions and Unix derivatives ship sudo. Just because Ubuntu has made sudo popular doesn't make it a problem. Sudo has many advantages over just plain 'su - root':

1) It logs the actions of who is performing the command.

2) You can enforce granular control over who has access to what command and what hosts.

3) It creates a mindset of using least privilege, and preventing root logins.

@maht I'll argue that with you. While the paradigm of an all-powerful user 'root', then everyone else is unfortunate, it's been addressed through the wheel group, sudo, and RBAC. Unix today is 100x better than it was 20 years ago. The root account now means more than it did.

For @refrax who submitted the command, as people have already mentioned, 'visudo' is the tool you want to use, so you can check syntax errors. If a tool exists for editing a configuration file, then the tool should be used. 'visudo' is it.

Comment by atoponce 418 weeks and 5 days ago

Your point of view

You must be signed in to comment.