LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Accidentally changed the bashrc file when making a change cannot find it in terminal though it appears in file browser (https://www.linuxquestions.org/questions/linux-newbie-8/accidentally-changed-the-bashrc-file-when-making-a-change-cannot-find-it-in-terminal-though-it-appears-in-file-browser-4175615742/)

HectorMHH 10-16-2017 04:16 AM

Accidentally changed the bashrc file when making a change cannot find it in terminal though it appears in file browser
 
I was making a change to bashrc to set JAVA as a login variable when i accidentally saved it with a new name, when i go into file browser i can see the file but when i look for it in console it isn't there, I am very new at linux so any help is appreciated.

bloodh101 10-16-2017 04:18 AM

May be a silly answer, but have you tried:
Code:

ls -la
The 'l' outputs it in list format (so optional)
but -a shows all files, including hidden files, which wouldn't show up with a standard ls.

brianL 10-16-2017 04:23 AM

Quote:

Originally Posted by HectorMHH (Post 5770445)
I was making a change to bashrc to set JAVA as a login variable when i accidentally saved it with a new name, when i go into file browser i can see the file but when i look for it in console it isn't there, I am very new at linux so any help is appreciated.

If it's .bashrc, you need to enter:
Code:

ls -a
in the terminal or console to show hidden files, starting with a .

onebuck 10-16-2017 05:03 PM

Member response
 
Hi,

Welcome to LQ!
Quote:

Originally Posted by HectorMHH (Post 5770445)
I was making a change to bashrc to set JAVA as a login variable when i accidentally saved it with a new name, when i go into file browser i can see the file but when i look for it in console it isn't there, I am very new at linux so any help is appreciated.

Other members have offered good suggestions for your query. For the future I recommend that you can learn from the following;
Quote:

Just a few links to aid you to gaining some understanding.


Hope this helps.
Have fun & enjoy!
:hattip:

HectorMHH 10-17-2017 03:30 AM

Found
 
I can see the bashrc file in there and it seems fine, its just that when i try to do nano~/ .bshrc it can't perform the action as it can't locate the file

bloodh101 10-17-2017 03:33 AM

Quote:

Originally Posted by HectorMHH (Post 5770785)
I can see the bashrc file in there and it seems fine, its just that when i try to do nano~/ .bshrc it can't perform the action as it can't locate the file

Just in case that's not a typo.
Code:

nano ~/.bashrc
Make sure theres a space after nano. If it can't find the file it should still open nano; It will say "[ New File ]" at the bottom.

fatmac 10-17-2017 04:07 AM

As said above, it is a 'dot' file, generally hidden from a user because it affects how your system works.

To edit it use
Code:

nano .bashrc

HectorMHH 10-17-2017 04:55 AM

I have done that and now the files empty.

I forgot to mention i located the file already using the nano ~/.bashrc and then when i edited to set up a variable i accidentally saved it under a different name and i can't find that file

bloodh101 10-17-2017 05:20 AM

If you know what you called the file you could try:
Code:

locate filename

ondoho 10-17-2017 12:20 PM

^ locate might not help in this case.
try
Code:

find -name '*filename'
instead

suicidaleggroll 10-17-2017 12:41 PM

You could also try
Code:

ls -lrta
in your home directory to list all files and sort them by last modified time. If you did this recently, your file should be listed near the end.

Shadow_7 10-18-2017 06:55 AM

The environment variable $HOME and the shorthand ~ are equivalent depending on your shell / use case.

$ nano $HOME/.bashrc

fatmac 10-18-2017 01:20 PM

If you are saying that you saved the file under a different name, & can't remember what name, you can search by using the date that you created the file. :)


All times are GMT -5. The time now is 05:50 AM.