Useful Linux commands


Monitor processor speed:

watch x86info -mhz

Determine which filesystems are mounted:

cat /etc/mtab


Find location of command

whereis [command]

User administration

Generate random password

To generate a password 12 characters long:

makepasswd --chars 12

Create user

To create a new user [username], adding them to the users group and creating their home directory /home/[username]:

useradd -m -G users [username]

Delete user

To delete user [username], deleting their home directory /home/[username] and their mail spool:

userdel -r [username]

Query a user’s groups

groups [username]

Add user to group

To add a user to a group:

gpasswd -a [username] [groupname]

To change a user [username]’s group membership so that they are in the groups [group1,group2,group3]:

usermod -G [group1,group2,group3] [username]

Note that with the usermod command, the user will be removed from all groups that are not listed, other than their primary group (which you can change using the -g flag).

Remove user from group

gpasswd -d [username] [groupname]

Change password

passwd [username]

Last modified: 23/11/2009 Tags: (none)

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top