0

A newcomer to linux here, I was trying to set a custom display resolution and make the changes permanent but looks like I've forgotten something and the login screen won't come up (the only thing I'm seeing is the black login screen that asks for username and password.)

I was trying to create a new file with two commands for xrandr so I could have a custom resolution, but after the recent reboot, I'm stuck on the black screen (tty1 thing)

Anyway, I tried to reverse the process and find the file I created somewhere which I can't remember the exact location. The only way to undo this, is to use the command line as normal user (and not the root), so that I can figure out which file and where I've created.

So far I've tried using command line in the recovery menu but since it's root, I won't be able to view the history of the previously used commands and using the "exit" command will bring back the menu.

How can I achieve that? Unfortunately I cannot use live flash / cd to fix this because there's something wrong with my pc bios. Any help and suggestion is highly appreciated. P.S: I used google's web history to find out which websites I've visited so I could find what command I used, but failed; I couldn't find it.

1 Answer 1

0

I managed to solve this myself and for anyone (probably a beginner to the Linux world) having the same problem, the process is this: Boot to the recovery menu, choose shell prompt (root) and enter your password then enter su username (case sensitive) and for the username you should enter yours. Then you will be able to see the history of your commands.

There are a few more useful commands worthy of mentioning: The user's command history is normally stored in a file named .bash_history, located in the user's home directory. Instead of using su username,use less ~username/.bash_history to view username's command history as root. Or you could have used the commands locate or find to find the exact path of the file you were looking for, if you remembered even a part of its name. Or you could've checked the logs at /var/log/ and probably found a helpful error message. [credits: user telecoM]

This could be useful when there's a file you've edited but don't know where it is and that you're combating the black screen intro the way I did.

2
  • 1
    In the Linux world, there is almost always many ways to achieve a specific goal. The user's command history is normally stored in a file named .bash_history, located in the user's home directory. Instead of using su username, you could have done a less ~username/.bash_history to view username's command history as root, for example. Or you could have used the commands locate or find to find the exact path of the file you were looking for, if you remembered even a part of its name. Or you could've checked the logs at /var/log/ and probably found a helpful error message. Commented Dec 31, 2022 at 20:33
  • Thanks so much for the info. I added the detail to the body of the answer. Believe or not this might be helpful for a newcomer stuck at somewhere just like me! Commented Jan 1, 2023 at 2:51

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.