sudo and apt-get not working after editing ~/.bashrc

New to Debian (Or Linux in general)? Ask your questions here!

sudo and apt-get not working after editing ~/.bashrc

Postby liamorourke » 2019-09-30 17:35

Hi I'm new to linux so i might need you to bear with me.

I just added a line into my ~/.bashrc in order to open LADSPA plugins in a program called pure data.
I then saved and exited the ~/.bashrc and now none of my basic commands such a sudo, apt-get etc work.
It says: "bash: sudo: command not found"
I noticed that when i edited the ~/.bashrc I was in the directory: /home/liam#
is it not working because i've accidentally moved the ~/bashrc? or is something else going on here?
Does anyone know how i can fix this please?
Thank you
liamorourke
 
Posts: 3
Joined: 2019-09-30 17:22

Re: sudo and apt-get not working after editing ~/.bashrc

Postby 4D696B65 » 2019-09-30 17:38

liamorourke wrote:I noticed that when i edited the ~/.bashrc I was in the directory: /home/liam#
Does anyone know how i can fix this please?
Thank you

You edited a user file as root. Check permissions.
User avatar
4D696B65
 
Posts: 2438
Joined: 2009-06-28 06:09

Re: sudo and apt-get not working after editing ~/.bashrc

Postby liamorourke » 2019-09-30 19:15

Hi sorry, I'm still very new to this. How do i check permissions?
ANd then what should I do to/ with them?
Thanks for your help
liamorourke
 
Posts: 3
Joined: 2019-09-30 17:22

Re: sudo and apt-get not working after editing ~/.bashrc

Postby kedaha » 2019-09-30 19:18

4D696B65 wrote:You edited a user file as root. Check permissions.

If you su - to root to edit and save a file owned by the regular user that won't change the file permissions which will stay the same:
Code: Select all
# ls -a -l |grep .bashrc
-rw-r--r--  1 youruser youruser      3526 Jul 20 11:32 .bashrc

The file permissions show the owner, youruser has read & write permissions while the group & others only have read permission.
@ liamorourke See, for example, this how-do-i-restore-bashrc-to-its-default
Looks like editing .bashrc has somehow messed it up so just restore it from /etc/skel
Mate DE & OSSv4.
FreedomBox in Debian
ispmail
Debian Stable

Words, as is well known, are the great foes of reality. Joseph Conrad.
Kedaha's Conjecture
User avatar
kedaha
 
Posts: 3000
Joined: 2008-05-24 12:26

Re: sudo and apt-get not working after editing ~/.bashrc

Postby liamorourke » 2019-10-01 05:34

that has worked nicely.
Thank you for you help :)
have a good day
liamorourke
 
Posts: 3
Joined: 2019-09-30 17:22

Re: sudo and apt-get not working after editing ~/.bashrc

Postby kedaha » 2019-10-01 06:54

Thanks, the same to you.
Just for reference:
This command will make a new copy of it in home:
Code: Select all
user@debian:~$ /bin/cp ~/.bashrc ~/my_bashrc

Back up present bashrc file, if you like:
Code: Select all
user@debian:~$ mv .bashrc .bashrc-bak

Copy the file my_bashrc as .bashrc, with the dot in front because it's a hidden file.
Code: Select all
user@debian:~$ cp my_bashrc .bashrc
Mate DE & OSSv4.
FreedomBox in Debian
ispmail
Debian Stable

Words, as is well known, are the great foes of reality. Joseph Conrad.
Kedaha's Conjecture
User avatar
kedaha
 
Posts: 3000
Joined: 2008-05-24 12:26


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable