LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Fedora / .bash_history (https://www.linuxquestions.org/questions/linux-newbie-8/fedora-bash_history-592528/)

deeprlyeh 10-17-2007 11:59 AM

Fedora / .bash_history
 
I have recently taken a Linux skills test for my college. I have received my grade and although I received a 97% on said test. There is one issue. The points that I have missed on the test have to do with making alias commands. During the test I directly remember setting this up, but when the teacher used the .bash_history to check my work any and all lines containing the phrase alias are not there. Now I have looked around the internet for some answers and have noticed that there are some issues with history, but nothing specific. Also some other students have no history at all. We are using Fedora Core 2 on a virtual machine install for the class and test.

The_JinJ 10-17-2007 12:06 PM

Did you run the commands as a different user?
Didi you create the aliases in the alias file and not on the command line?

Tinkster 10-17-2007 12:42 PM

Quote:

Originally Posted by deeprlyeh (Post 2927494)
I have recently taken a Linux skills test for my college. I have received my grade and although I received a 97% on said test. There is one issue. The points that I have missed on the test have to do with making alias commands. During the test I directly remember setting this up, but when the teacher used the .bash_history to check my work any and all lines containing the phrase alias are not there. Now I have looked around the internet for some answers and have noticed that there are some issues with history, but nothing specific. Also some other students have no history at all. We are using Fedora Core 2 on a virtual machine install for the class and test.


Check env, specifically HISTIGNORE ... maybe the kind folk
at dead rat have decided to drop commands that begin with
alias out of the history.


Another possibility: you have HISTCONTROL=ignorespace or
HISTCONTROL=ignoreboth set, and accidentally typed your alias
definitions with a space as the first character.


Cheers,
Tink

deeprlyeh 10-17-2007 10:20 PM

Actually some students have had their alias commands within the history file. Now that I'm thinking about the history file. There were several commands that I used that did not make it into the history file. As I understand the history is stored in system memory before it is written to the .bash_history log. The only things I can think of would be some issue with how the virtual machine handled system memory and just lost some of my commands or there is some type of issue with the history command.

Now the part of the test that involved the alias was when we needed to created an alias for a command, then use the alias to write a file with the information gained.

alias skills="grep skills* /etc/passwd | cat"

Then use the alias skills to append a file with the grep search.

Is there a different history file for each user and tty? We were using a created user as well as root to do the work.

I did everything from the command line. I actually made some mistakes then came back and redid the entire section. So there should have been two spots in my history with the alias commands.

bigrigdriver 10-17-2007 10:55 PM

Part of the problem with history lies in using more than one console to do your work from the command line. Each console has it's own history which is not reflected in another console when you use the up arrow key to scroll through the history, until all consoles are closed.

To keep history current with several consoles running, add this to your ~/.bashrc: PROMPT_COMMAND='history -a'.

Of course, this does not apply if your are working as user in one console, and as root in another console. Then you need 'history -a' in both the user's and root's .bashrc.


All times are GMT -5. The time now is 08:59 PM.