Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restore default ~/.bashrc ubuntu

I messed up my ~/.bashrc file and am trying to restore it.

I tried doing this:

cp ~/.bashrc ~/.bashrc_bak
cp /etc/skel/.bashrc ~/
source .bashrc

but I get this error:

cp: /etc/skel/.bashrc: No such file or directory

I looked in /etc but there's no skel file there.

I'm a complete beginner. Thanks for your help.

like image 946
John Dillon Avatar asked Oct 23 '16 18:10

John Dillon


People also ask

Where is default bashrc Ubuntu?

As you might already know, there is a default version of the bashrc file in the /etc/skel/ directory in Ubuntu. So if you have problems with bashrc file, you can easily restore it to its default settings like below.

How do I open ~/ bashrc?

From a login or other node on the cluster, type nano ~/. bashrc to open the file in the nano editor. My . bashrc has already been added to, so you'll see additional definitions below the # User specific aliases and functions section.

What is the ~/ bashrc file?

The . bashrc file is a script file that's executed when a user logs in. The file itself contains a series of configurations for the terminal session. This includes setting up or enabling: coloring, completion, shell history, command aliases, and more. It is a hidden file and simple ls command won't show the file.


1 Answers

Type the following in your terminal,

/bin/cp /etc/skel/.bashrc ~/

It will replace your corrupt ~/.bashrc with a fresh one. After that you need to source the ~/.bashrc so that the change take place immediately, write in terminal,

source ~/.bashrc

or if that does not work you can close the terminal and open it again.

like image 72
RpR Avatar answered Sep 29 '22 02:09

RpR