chfn command in Linux with examples (original) (raw)

Last Updated : 23 Sep, 2024

'chfn' command in Linux allows you to change a user's name and other details easily. 'chfn' stands for Change finger. Basically, it is used to modify your finger information on Linux system. This information is generally stored in the file '/etc/passwd'** that includes user's original name, work phone number etc. The '**chfn' command is particularly useful for updating user details on multi-user systems, ensuring that contact information is accurate and up-to-date.

Here, we’ll explore the syntax, options, and examples of using the **chfn command to modify user details

**Syntax

chfn [option] [login]

**where,

If no options are specified, the command will prompt the user to change various attributes interactively.

**Basic 'chfn' command Example

In this example we used default "**chfn" command without any option. In this system asks from the user itself to change the values of some basic attributes.

Basic 'chfn' command Example

**Key Options for the 'chfn' Command

**1. -f full_name:

Let you change the full name on the account.

sudo chfn -f Shivang123 shivang

**2. -w work_ph:

Let you change the work phone number on the account.

sudo chfn -w 124567890 shivang

**3. -r room_no:

Let you change the room number on the account.

sudo chfn -r 9999 shivang

**4. -h home_ph:

Let you change the home phone number on the account.

sudo chfn -h 123456 shivang

**5. -o other:

Let you change any other detail on the account.

sudo chfn -o "Manager, IT Department" shivang

Conclusion

The chfn command is a simple yet powerful tool for modifying user finger information on Linux systems. Whether you're updating your own details or managing a multi-user system, chfn makes it easy to keep user information accurate and up-to-date. By understanding the different options and how to use them effectively, you can ensure that the user details stored in '/etc/passwd' are always current, making the system more efficient and user-friendly.