- 1How to Add a New User in Linux
- 2Modify Existing User in Linux
- 3Delete a User in Linux — Step-by-Step for Beginners
- 4Create a User Group in Linux - Step-by-Step Tutorial
- 5Linux: Add User to Group
- 6How to Remove a User from a Group in Linux
- 7Delete a User Group in Linux - Beginner Friendly Tutorial
- 8Linux su Command Tutorial – Switch Users Easily
- 9Linux sudo Command - Execute as Another User
- 10Change a User's Password in Linux Using passwd
- 11Set Password Expiry in Linux using chage
- 12Lock a User Account in Linux
- 13How to Unlock a User Account in Linux
- 14Configure User Login Shell in Linux
- 15How to Configure User Environment Variables in Linux
- 16Edit .bashrc and .profile in Linux - User Startup Files Tutorial

- 1Linux Topics Index
- 2How to Create a File in Linux
- 3How to Rename a File in Linux
- 4How to Copy a File in Linux
- 5How to Move a File in Linux
- 6How to Delete a File in Linux
- 7How to Create a Directory in Linux
- 8How to Delete a Directory in Linux
- 9How to Copy Directories Recursively in Linux
- 10Delete Directories Recursively in Linux
- 11How to View Hidden Files in Linux
- 12How to Create a Hidden File in Linux
- 13How to Create a Hidden Directory in Linux
- 14How to Find Files in Linux Using find Command
- 15Find Files in Linux Using locate Command
- 16How to View File Contents Using cat in Linux
- 17How to View File Contents Using less in Linux
- 18View File Contents Using the more Command in Linux
- 19Compare Files Using diff Command in Linux
- 20Compare Files in Linux Using cmp Command
- 21Check File Type in Linux with file Command
- 22Create Symbolic Links with ln -s in Linux
- 23How to Archive Files Using tar Command in Linux
- 24Compress Files with gzip in Linux – Beginner Tutorial
- 25How to Compress Files Using bzip2 in Linux
- 26Compress Files in Linux Using zip Command
- 27Extract Compressed Files using tar in Linux
- 28Extract ZIP Files on Linux with unzip
- 29How to Extract .gz Files using gunzip in Linux

- 1How to Add a New User in Linux
- 2Modify Existing User in Linux
- 3Delete a User in Linux — Step-by-Step for Beginners
- 4Create a User Group in Linux - Step-by-Step Tutorial
- 5Linux: Add User to Group
- 6How to Remove a User from a Group in Linux
- 7Delete a User Group in Linux - Beginner Friendly Tutorial
- 8Linux su Command Tutorial – Switch Users Easily
- 9Linux sudo Command - Execute as Another User
- 10Change a User's Password in Linux Using passwd
- 11Set Password Expiry in Linux using chage
- 12Lock a User Account in Linux
- 13How to Unlock a User Account in Linux
- 14Configure User Login Shell in Linux
- 15How to Configure User Environment Variables in Linux
- 16Edit .bashrc and .profile in Linux - User Startup Files Tutorial
How to Edit a User's Profile and Startup Files (.bashrc, .profile)
How to Edit a User's Profile and Startup Files in Linux
Hey there! Welcome to ProgramGuru.org. Today, we're going to understand what happens every time you open a terminal or log in to your Linux system. We'll take a beginner-friendly tour of two very important files: .bashrc
and .profile
.
These files live in your home directory and help customize your environment — things like setting aliases, environment variables, and more. Let’s get into it!
1. What are .bashrc and .profile?
- .bashrc: This file runs every time you open a new terminal window. It’s perfect for adding aliases, prompt settings, or custom functions.
- .profile: This file runs at login for login shells. You can set environment variables here that you want available across the entire session.
2. Locate the Files
First, open your terminal and go to your home directory:
cd ~
Then, list the hidden files:
ls -la
-rw-r--r-- 1 user user 220 Jul 2 10:21 .bash_logout
-rw-r--r-- 1 user user 3771 Jul 2 10:21 .bashrc
-rw-r--r-- 1 user user 807 Jul 2 10:21 .profile
You'll see both .bashrc
and .profile
listed there.
3. Editing the .bashrc File
Let’s say you want to add a custom alias. You can open .bashrc
with your favorite text editor. We'll use nano here:
nano ~/.bashrc
Scroll to the bottom and add a line like this:
alias ll='ls -la'
Save and exit:
- Press Ctrl + O to write changes
- Then Enter to confirm
- And Ctrl + X to exit nano
To apply the changes without restarting your terminal, run:
source ~/.bashrc
4. Editing the .profile File
Now let’s look at .profile
. This is ideal for environment variables that need to persist across terminal sessions.
nano ~/.profile
For example, to add a new path to your environment:
export PATH="$PATH:$HOME/my-scripts"
Save and exit as before, then load the file:
source ~/.profile
5. When to Use Which File?
- Use
.bashrc
for things you want active in every terminal window (aliases, shell functions). - Use
.profile
for things that should be set once per session (PATH, LANG variables).
6. Pro Tip: Back Up Before Editing
It’s a good idea to back up these files before making changes:
cp ~/.bashrc ~/.bashrc.bak
cp ~/.profile ~/.profile.bak
7. Summary
🎯 That’s it! Now you know how to edit your Linux user profile and startup files to make your command-line experience truly yours. Try adding a few aliases or environment paths and see how much smoother things become.
Thanks for watching this tutorial on ProgramGuru.org. If you found this helpful, don’t forget to share and subscribe for more Linux how-tos!