Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Linux Ask!

Apr 072011
 

Drop a collection in MongoDB

Answer:

To drop a collection in MongoDB, enter the interactive shell, and type:

db.foo.drop()

If you want to remove all the objects only, not dropping the collection, try

db.foo.remove()

Apr 022011
 

How to rename a user in Linux?

Answer:

Firstly, you need to have a account with root privileges (You cannot change the account name if you have this user currently logged in)

To rename a user, do the following steps:

1. Rename user

# sudo usermod -l new_user -d /home/new_user -m old_user

2. Update group (Usually the same as user name)

# sudo groupmod -n new_user old_user

That's all.