In ksh is there a was to scroll thru all matching commands? For example I executed several commands over several days. Is there a way to scroll thru all the matching 'find' commands only that was executed?
No messing with the .history file. Anyway to do this from the command prompt? TIA.
I have not always had 100% success with this and don't know the reasons why but it works way more than not.
If you don't have this set already, type
at the command prompt. I don't know the official term but this lets you scroll back through the command history.
Then type command below in two key strokes. Not both keys at the same time.
This should recall the last command you executed from the command prompt.
If you just want to manually scroll though the command history hit
for next.
Then if you want to search through the command history for something specific, like the last find command in stead of hitting "n" to scroll back though the list manually you would hit the forwardslash (/) and what specific value you are looking for like below.
After typing the value simular to above hit enter and it should display the last "find" command that you executed. Then you would just keep hitting the letter "n" to display the next find command that you executed or possibly anyone else executed while logged in as that id if you happen to be using root.
Hope this helps.
Last edited by juredd1; 05-27-2010 at 03:01 PM..
Reason: correcting errors
Basically you have a vi-editor with only one line visible (and the history-file as text open) at the commandline. (Almost) every vi-command will work on the commandline too:
ESC (to set the editor from insert- to command-mode) and then:
k - a line up (therefore: last command)
j - a line down (therefore: next command, if you have already gone back some)
l - move cursor a character right
h - move cursor a character left
w - move cursor to first character of the word right to the cursor
b - move cursor to first character of the word left to the cursor
W/B - same as w/b but only taking whitespace as word boundaries into consideration
This means: let text be "abc/def/ghi". If the cursor is on "g", then "w" brings you to the third "/", the next "w" to "d", etc., while "W" brings you to "a".
0 - move to first character in the line
/ - search through command history (all regexps allowed)
n - repeat last search and go to next hit
N - repeat last search and go to previous hit
i - reenter insert mode
a - append: insert right after cursor position
A - append at end of line
v - open a full vi with the command line as text (saving & exiting executes the command)
# - put a comment sign in front of the command and put it into history
This won't execute anything, but saves a command(-part) for future use in the history file.
I hope this helps.
bakunin
Last edited by bakunin; 05-27-2010 at 10:02 PM..
These 3 Users Gave Thanks to bakunin For This Post:
Hello,
I am a beginner, I have currently Solaris 11 on a vmware machine. Whenever I type a command like 'ls' the screen scrolls to the end of the screen. I am unable to see the entire list of directories and files. I have tried ls |page command, but looking out for a better option. (3 Replies)
I have the need to check content of very many files for a block of text.
I know the data should match for instance/as an example the following
The list of characters
bugs bunny
tom and jerry
Mighty mouse
Felix the cat
/
In the first step, I isolated the interesting data by... (3 Replies)
I figured this would be simple, but I am stuck.
Variable longpath="/dir1/dir2/dir3/filename.stuff.morestuff.garbage"
I want to end up with just "filename.extra.moreextra". So, I want to get rid of the path and .garbage
I want to do this with just ksh internals. So, no sed,grep,awk,expr,... (4 Replies)
I don't have my SysV bible with me currently and I can't remember how to change the amount of lines visible in my shell. Currently I can only scroll back to see the last 100 lines of stdout.
Any help is greatly appreciated.
blessings,
Tony <>< (2 Replies)
Sorry for the duplicate thread this one is similar to the one in
https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121
Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
on a AIX sys i have been trying to get the mouse scroll wheel to page the terminal for about 2 yrs now on aixterm. any ideas. the below syntax does not work in aixterm but does work in xterm.
------------------------- this does not work in aixterm but does work in xterm,, with a cat Xdefult |... (2 Replies)
HI ,
I forgot to redirect my op to a file.The op which is quite huge , thus printed on the screen.However bcoz of the limited viewing in the screenI can not see the whole of the output..
Is there anyway I can see the full op.My run takes half a day for finnishing ..So I am refraining... (1 Reply)
I try to use the pattern substitution operators as documented in the O'Reilley "Learning the Korn Shell" but it doesn't seem to work as advertised.
This works all right:
var='Regular expressions rules!'
$ echo ${var//e/#}
R#gular #xpr#ssions rul#s!
The docs says that using !(expr)... (5 Replies)