LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   history command not showing all commands used (https://www.linuxquestions.org/questions/linux-newbie-8/history-command-not-showing-all-commands-used-4175583644/)

hawkeyesc72 07-03-2016 01:45 AM

history command not showing all commands used
 
Greetings all! Having a little head-scratcher here and hoping someone can enlighten me.

I am working on a class assignment. I am NOT looking for the answer, just an explanation of something. I am working in an online simulator (Webminal) so it's like a mini-VM but command-line only. No specific version of Linux is used as far as I can tell.

Basically the assignment is we do a bunch of commands in vi to a file then use history command to show our work. I go through all the steps successfully then type history but not all the commands I used are showing in the list.

Here's a rough idea of what history output SHOULD look like:
33. w new_directory/filename (to write the file to a new directory location)
34. pressed Ctrl+6 (to make newly saved file the current working file)
35. %s/2015/2016/g (change all 2015s to 2016s)
36. typed gg (to go to top of document)
37. hit Insert button twice to go into REPLACE mode (to replace a word at top of doc)
38. escape'd back into command mode and hit Shift+g (for G, to go to end of doc)
39. entered Insert mode to type in 4 new lines at end of doc
40. 10 (to go to line 10)
41. typed 5dd to delete 5 specific lines (to delete lines 10-14)
42. history (which should show all of this but doesn't)

This is what my history output returns:
33. w new_directory/filename
34. %s/2015/2016/g
35. 10
36. history

All commands worked successfully except history command. I noticed the commands missing from the history output are commands I did not have to hit Enter to execute. Is that why they aren't showing up?

Any thoughts?

Thanks!!!

spiky0011 07-03-2016 02:15 AM

Hi

The history is terminal commands executed, Like cp -v a file to somewhere or mv a file "etc"
Not Action done, (34. pressed Ctrl+6 ) is an action. If using a GUI the commands dont get registered in history file. only 1,s run from a terninal. So basically you are correct about only when "enter button is used"

hydrurga 07-03-2016 06:03 AM

I'm not a vi user, but you could have a look at vi macros and mention that in your assignment as a means of recording all keystrokes.

Also, look through all the commands you mentioned in your list and consider whether you can convert any of them into commands that will be recorded by history. For example, would 1 work instead of gg? Can you issue commands to operate on specific (and thus history recordable) lines/data rather than using "current" line/data commands (e.g. :[start_line_no],[end_line_no]d)?

hawkeyesc72 07-03-2016 08:06 AM

Success!!
 
Thank you! My class is an online class and instead of a textbook we watch training videos and the videos only discussed and demo'd the basic commands like gg and G. Your shortcuts worked great. I got a full history list now to show all the commands I used. Thank you for the assist!

Quote:

Originally Posted by hydrurga (Post 5569666)
I'm not a vi user, but you could have a look at vi macros and mention that in your assignment as a means of recording all keystrokes.

Also, look through all the commands you mentioned in your list and consider whether you can convert any of them into commands that will be recorded by history. For example, would 1 work instead of gg? Can you issue commands to operate on specific (and thus history recordable) lines/data rather than using "current" line/data commands (e.g. :[start_line_no],[end_line_no]d)?


hydrurga 07-03-2016 08:20 AM

Quote:

Originally Posted by hawkeyesc72 (Post 5569719)
Thank you! My class is an online class and instead of a textbook we watch training videos and the videos only discussed and demo'd the basic commands like gg and G. Your shortcuts worked great. I got a full history list now to show all the commands I used. Thank you for the assist!

Excellent!

If you want to mark the thread as "Solved", you can use the "Mark this thread as solved" link at the top of the thread.


All times are GMT -5. The time now is 05:13 PM.