Now let's find out how to actually use this user command.
Again since it's a file on the file system we know we can use the man subsystem to get some information
and help on this particular command.
Briefly the user Dell command deletes a user account and related files.
We look forward here to the dash f option.
It stands for force and it removes the account even if the user is logged in.
And it also deletes the user's home directory.
Even if that home directory is shared with another user normal user accounts don't share the same home
directories usually or they shouldn't.
But in some cases you might have multiple application accounts that share the same home directory.
Here's a little note here that says to use caution when using this option.
Now let's keep looking through the options here.
The dash r option is the one that we're most interested in as it removes the user's home directory.
So let's try out this user Dell command.
First let's look at some users on our local system here will do tell at sea password and we can see
we have Einstein Isaac t Edison J Locke et cetera and these are all accounts that were created through
previous exercises and through some of my previous work I've been doing on this virtual machine.
So if we do this let's delete the Einstein user pseudo user Del Einstein and hit enter.
Now if we run ID against the Einstein user it will say hey there is no Einstein user available.
So sure enough the user DEL command got rid of Einstein.
And let's look in the home directory.
So this really prove to us that running user Dell without any options removes the user but leaves their
files because you can see here the Einstein directory is still listed in for home.
This might come in handy if you want access to a user's files after they have been removed.
Now there's something else to notice here.
Notice that the user and group for the Einsteins home directory are actually numbers.
This is because there is no account associated with UAD 1001 any longer because we deleted that account.
They had the ID of 1001 which is the Einstein account.
So if you ever run an ls command and see numbers where you would normally see a user then know that
you're looking at a UI ID Orji ID and that there is no account associated with that particular ID or
ID.
So while we're talking about you IDs let's look at a couple of users.
The root user always has the idea of zero.
So if we do ideaspace DSU which returns a user id follow that with the root account we should always
get back zero.
Now there are some other accounts on the system that are considered to be system accounts or application
accounts.
Let's look at another one of those.
Let's look at the as each account here.
It has an ID or user id of 74.
Now let's look at the ID for our current vagrant user.
It has a new idea of 1000.
As you saw earlier Einstein has a new idea of 1001.
So I don't know if you notice a pattern here but really system accounts have lower you IDs.
This is actually set in a file called log in daat deaths and that's located in SC.
So let's just look at that really quickly.
A page down here until we get here.
Here we see you I.D. men you I.D. man.
So these are the minimum and maximum values for automatic selection and user add.
So when you create the very first user on a Linux system it's going to have a user id of 1000.
And by the way that is the user id of our bigger user because that was the first account created on
the system.
Then the next time we enter an account the number will get incremented by 1.
So Einstein was the next account that was created so it had a new idea of 1001 so on.
By the way if you look below this you see sis you I.D. men and you ID Max.
This means that the maximum user ID for a system account or what's considered a system account is nine
hundred and ninety nine if you want to make sure that you're not deleting a very important account.
Perhaps it's a good idea to check your ID first if it's less than 1000 then clearly be careful of what
you're doing because it could operate a service that you may need on your server.
Ok let's jump out of here and let's move on to our next user id dash you Isaac.
This user has a new idea of 1002 let's delete this user but this time remove its home directory.
All right.
If we try to get the user id of the user again it says now it's deleted it's gone there is no such user.
And if we look for a home directory for this user it doesn't exist.
So again that proves the dash or option removes the home directory and all the files that were within
that home directory as well.