Upon the request of some users, I decided to add all the intermediate steps and results to my initial post so that users can better walk me through a solution. This is added under the headline Additions below the question. Below Additions, there is a section called, "resolution," where I have added extra steps that I have taken in order to resolve this issue:


Today, as I was trying to continue running my codes in the command-line shell, I noticed that none of the commands are actually recognized by the shell in Fedora 21 (kernel 4.1.13-100.fc21.i686 on an i686 (tty2)). I thought if I restart and reboot the system, the issue should resolve. However, to my surprise I noticed that the system is not starting up after login. I tried to do diagnostics by pressing CTRL+ALT+F2 when the screen goes black to see where actually it stops working. The last line that I saw a complete stop was saying:

wait for plymouth boot screen to quit

Would you mind letting me know how to fix such issue when actually no command is accepted in the diagnostic mode in the shell by saying the following?

-bash: <...>: command not found

The only thing I can think of is some possible automatic update that I was not aware of or messing my .bashrc (which I can no longer see inside it by using the following command:)

sudo gedit ~/.bashrc


I was able to login to my system only after entering the diagnostic mode by pressing Ctrl+Alt+F2 right after reboot and login into the main startup which fails under normal conditions.

Fedora release 21 (Twenty One)
Kernel 4.1.13-100.fc21.i686+PAEdebug on an i686 (tty2)

In this mode, then the login prompt appear

localhost login:

After entering my username, then it says:


After entering my password, then it says:

Last login: Wed Mar 30 15:33:54 on tty2

[bbenjamin@localhost ~]$

It is here that none of the commands are recognized by the shell no matter what. And the error message is usually:

-bash: <...>: command not found

where <...> is basically any command. The only time I was successful in getting most commands get realized by the shell was when I ran the following code (as mentioned by in the answer):


After which at least I could look for and see my files and folders and programs (since most commands are getting realized.)

However, I still need to logging normally so that I can make use of all the graphics and other features of Fedora which is impossible in the diagnostic mode. To make this possible in particular I need to open my .bashrc file and fix its issues permanently (assuming that I can have access to its original version somehow.) To do this, I need to run commands like

(sudo) gedit ~/.bashrc

However, I am receiving error messages like:

Unable to init server: Could not connect: Connection refused

(gedit:1397): Gtk-WARNING **:cannot open display:

or running commands like this one:


which would yield error message:

bash: /home/bbenjamin/.bash_profile: Permission denied.

Now, learning from the answer, I am not supposed to run this latter command as it is not executable. And instead I should run it in the following format:

source ~/.bashrc

After which I don't know how to proceed.

However, I don't know why the former command (sudo) gedit ~/.bashrc is not working either. I remember that I always used to make slight changes in the .bashrc file depending on my need. This time I don't know how I made changes in it that it caused all the issues explained here. So now, my question is whether there is a command-line based method that I can open .bashrc and look inside it and make needed changes permanently so my system logins appropriately leads me into its normal graphical mode where I see and utilize all Fedora features.


I learned that once I am in the diagnostic mode through the command Ctrl+Alt+F2 right after unsuccessful login, I can temporarily fix the messed up file .bashrc by running the command PATH=/usr/bin:/usr/sbin. Then I could take a look inside my .bahsrc file through running the command line cat .bashrc. It was only then that I saw the contents of the file in which I had several paths added to the file. Since I had kept a record of my added files at the bottom of previous paths in a chronological order, I knew that the problematic path was the very last one. Now, in order to fix the issue, I had to actually modify the file. This was achieved by the command line nano .bashrc after which a new page appeared in which I had the chance of commenting out the problematic line by adding # in front of it. At the end, I saved my changes and exited. The last step I had to make was to reboot the system with its new modified .bashrc file through the command line telinit 6 after which the logging proved to be successful.

closed as off-topic by jasonwryan, cuonglm, Scott, MelBurslan, Anthon Mar 31 '16 at 5:24

  • This question does not appear to be about Unix or Linux within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • This is probably not related, but it's generally a bad idea to a) use sudo with graphical applications (it can cause weird issues - use gksudo or kdesudo instead), and b) ~/.bashrc should be owned by your user, and so you shouldn't need to use sudo anyways. – Xiong Chiamiov Mar 30 '16 at 20:17
  • 1
    It sounds like you're stuck in an emergency root shell. This happens when a filesystem can't mount, e.g. due to disk corruption or an invalid fstab, or a number of other reasons. Please type who -r or runlevel and let us know what it says. – Paul Mar 30 '16 at 20:39
  • 1
    Fedora 21 is EOL. You should update to some supported version. – Jakuje Mar 30 '16 at 20:41
  • 3
    @Benjamin It seems like your PATH variable is not set properly. Try to use absolute paths i.e /bin/ls /home/${USER} I – Valentin Bajrami Mar 30 '16 at 21:18
  • 3
    I'm voting to close this question as off-topic because this is turning into a general support thread... – jasonwryan Mar 31 '16 at 0:33

It sounds like you put something in your ~/.bashrc which is causing PATH to be set in a way that doesn't include /usr/bin, which is where most programs actually live. If you run this:


most commands should start working — and then you can edit ~/.bashrc and fix whatever is resetting PATH there. (And, actually — you want to set PATH in ~/.bash_profile instead of ~/.bashrc — see How to correctly add a path to PATH?)

(Note, by the way, that no Fedora update would mess with this, as updates don't alter files in your home directory. Sometimes when you run updated software that software might update its own config files, but that doesn't apply to ~/.bashrc.)

On your edit: the gedit text editor only works in graphical mode. In text mode, you'll need a text-based editor. The easiest of these is probably nano. Install it with

dnf install nano

and then use nano instead if gedit. The actual editing functions will be a little different but it's pretty simple.

  • Hi mattdm, thanks. After the first command, the second one says bash: /home/bbenjamin/.bash_profile: Permission denied. Even as a root, it yields the same output. – Benjamin Mar 30 '16 at 22:14
  • What is "the second one"? Note that ~/.bash_profile is not normally executable; you'll get permission denied if you try to run it. If you need to load it in the current shell, do source ~/.bash_profile. – mattdm Mar 30 '16 at 22:39
  • 1
    Here's some info on editors, including using text editors from the CLI. You're venturing into areas which sound like are quite a bit beyond your level of experience. Perhaps try to find someone local to you who can sit down with you and work through these problems. Also, a beginners guide to Linux would be helpful at this point, and other documentation such as docs.fedoraproject.org/en-US/Fedora/21/html/…. – Paul Mar 30 '16 at 23:16
  • 1
    Also, at this point, it would be helpful to copy/paste exactly what you have on the screen, from the beginning of the input line (including your prompt!) to the beginning of the next prompt, so it includes all the output and everything you typed. There is a lot of context we still don't have, and that lack of context does not help us help you. Lacking experience, it's impossible for you to know what information is helpful in solving this problem, so just assume that more is better - be verbose as possible. – Paul Mar 30 '16 at 23:19
  • 1
    Finally with the help of all users I figured out how to resolve the issue. Thanks for everyone. I am going to make an edition to the problem so that it better serves future questions. Sincerely, – Benjamin Apr 1 '16 at 4:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.