LinuxQuestions.org
Visit Jeremy's Blog.
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 07-03-2016, 01:45 AM   #1
hawkeyesc72
LQ Newbie
 
Registered: Mar 2016
Posts: 10

Rep: Reputation: Disabled
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!!!
 
Old 07-03-2016, 02:15 AM   #2
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Centos6.3/Debian
Posts: 2,194
Blog Entries: 1

Rep: Reputation: 327Reputation: 327Reputation: 327Reputation: 327
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"

Last edited by spiky0011; 07-03-2016 at 02:18 AM.
 
Old 07-03-2016, 06:03 AM   #3
hydrurga
Senior Member
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 18.1 MATE
Posts: 3,073

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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)?

Last edited by hydrurga; 07-03-2016 at 06:04 AM.
 
1 members found this post helpful.
Old 07-03-2016, 08:06 AM   #4
hawkeyesc72
LQ Newbie
 
Registered: Mar 2016
Posts: 10

Original Poster
Rep: Reputation: Disabled
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 View Post
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)?
 
Old 07-03-2016, 08:20 AM   #5
hydrurga
Senior Member
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 18.1 MATE
Posts: 3,073

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Quote:
Originally Posted by hawkeyesc72 View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
linux showing up in my Google account history...can't remove it. idk how it got there lpzz Linux - Newbie 13 10-26-2015 12:11 PM
Why does BASH history command have no history when run in script ? lump_of_lard Programming 4 01-30-2015 09:45 AM
How to erase duplicates of commands from the command history ? techie_san778 Linux - Software 2 03-28-2013 02:55 AM
histroy command- not showing all the history files ? smv18 Linux - Newbie 2 01-13-2012 01:04 AM
History commands u2u2u2 Linux - Newbie 1 04-13-2011 03:26 PM


All times are GMT -5. The time now is 01:50 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration