How to use the chfn command in Ubuntu Linux with examples

|

|

This tutorial guides beginners on using the chfn command in Ubuntu Linux OS to update users’ ‘finger’ information, including name, work details, and phone numbers. The chfn command is a utility used via command-line, and its syntax and several of its options are explained. Examples of modifying a user’s full name, home/work phone numbers, and…

This brief tutorial shows students and new users how to use the chfn command in Ubuntu to change or update users’ “finger” information.

Fingers information is stored in the file /etc/passwd and includes the user’s real name, work, home phone numbers, work room, and others.

If you’re a student or new user looking for a Linux system to start learning on, the easiest place to start is Ubuntu Linux OS. It’s a great Linux operating system for beginners and folks looking for easier distribution.

Ubuntu is an open-source Linux operating system that runs on desktops, laptops, servers, and other devices.

About chfn command:

The chfn command is a command line utility used to update or modify the user’s “finger” information on the system. This info is stored in the /etc/passwd file and includes the user’s real Name, work room, work, home phone numbers, and others.

Syntax:

The syntax is the rule and format of how the chfn command can be used. These syntax options can be reordered, but a straight format must be followed.,.

Below is an example syntax of how to use the chfn command.

chfn [options] [LOGIN]

Options:

The command line options are switches or flags that determine how the commands are executed or controlled. They modify the behavior of the commands. They are separated by spaces and followed after the commands.

Below are some options for the chfn command:

  LOGIN Replace LOGIN with the account login name you want to update or modify
    -fIf you use the -for –full-name option to specify the full Name of the user
     -hUse the -h or –home-phone to specify the home phone of the user
     -rUse the -r or –room to specify the user’s room number
      -RThe -R or –root option to specify the user’s directory to chroot into
–helpDisplay a help message and exit.

Examples:

Below are some examples of how to run and use the chfn on Ubuntu Linux.

Simply run the chfn to invoke it.

When you run the chfn command, it should prompt for your password and allow you to update your finger info.

Changing the user information for jdoe
Enter the new value, or press ENTER for the default
Full Name: John Doe
Room Number [301]:
Work Phone [87738484733]:
Home Phone [7390-2938239]:

To gather info on a particular user, simply run the finger command followed by the user account name.

Example:

finger jdoe

It should display the user Richard’s account info:

Login: jdoe Name: John Doe
Directory: /home/jdoe Shell: /bin/bash
Office: 301, +8-773-848-4733 Home Phone: 7390-2938239
On since Mon Nov 4 14:27 (CST) on :0 from :0 (messages off)
No mail.
No Plan.

If you want to use the chfn command to change a user’s full Name or Real Name for user Joe, simply run the command with the option below:

Example:

chfn -f "John Doe" jdoe

The command above modifies the user account jdoe with its real Name, John Doe

To change the user’s home and work phone number, simply run the chfn command with the -h and -w options:

Example:

chfn -h 1112225555 -w 1113334444 jdoe

To change the user’s room number, simply run the chfn command with the -r option.

Example:

chfn -r 500 jdoe

Finally, run the finger command to display the user’s updated info:

Login: jdoe Name: John Doe
Directory: /home/jdoe Shell: /bin/bash
Office: 500, 111-333-4444 Home Phone: 111-222-5555
On since Mon Nov 4 14:27 (CST) on :0 from :0 (messages off)
No mail.
No Plan.

That’s it!

Congratulations! You have learned how to use the chfn command on Ubuntu Linux.

Like this:



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.