LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-17-2007, 11:59 AM   #1
deeprlyeh
LQ Newbie
 
Registered: Oct 2007
Posts: 2

Rep: Reputation: 0
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.
 
Old 10-17-2007, 12:06 PM   #2
The_JinJ
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Suse, OpenWRT
Posts: 299

Rep: Reputation: 30
Did you run the commands as a different user?
Didi you create the aliases in the alias file and not on the command line?
 
Old 10-17-2007, 12:42 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by deeprlyeh View Post
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
 
Old 10-17-2007, 10:20 PM   #4
deeprlyeh
LQ Newbie
 
Registered: Oct 2007
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
Old 10-17-2007, 10:55 PM   #5
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
.bash_history question stakhous Linux - Newbie 1 05-24-2005 06:24 PM
.bash_history t3gah Linux - Software 2 05-05-2005 03:45 AM
bash_history linj Linux - Software 6 08-08-2003 10:13 AM
.bash_history gone togeno Linux - Security 3 06-30-2003 07:10 AM
.bash_history question iceman47 Linux - Security 4 06-06-2003 04:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration