[SOLVED] history command not showing all commands used
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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"
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)?
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
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)?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.