|
|
#1 |
|
All Star
Join Date: Jan 2002
Location: Dexter, MI, USA
Posts: 704
|
.history weirdness
I stumbled upon a rather odd problem recently. I usually keep a terminal window open at all times, so I didn't notice that my history no longer works, for lack of a better term. When I say history, I mean the ability to hit the up/down arrow keys to scroll through previous commands. This works fine if the commands were made in the same terminal window, but it won't remember anything if that window is closed, whether or not Terminal.app is quit before opening a new window. It used to keep the recent history stored in the .history file, then, after changing something (possibly the december dev tools install, at least it's from that time period) it started storing them in .tcsh_history. Now, however, they aren't able to be written too. I (stupidly, in hindsight) deleted them before looking at the ownership and such, and when I tried to recreate them, they still wouldn't work.
Sorry this isn't making much sense. Anyways, I tried reading "man history", which, while being quite informative, didn't help me out all that much. It basically said that the history was stored in ~/.history, and explained what the codes meant and such. As a side note, typing history into the terminal will list all the commands that you can get using the arrow keys. I've tried (as mentioned before) rm'ing the .history and .tcsh_history files. I'm about to try creating a new user, see if I can cp the files to my user and see if the system will then use them. Any other ideas would be welcome. Thanks for putting up with the rambling, and thanks in advance, Greg
__________________
- Greg Happy user of OS X since the Public Beta. Help Team Mac OS X cure cancer, Alzheimer's, ALS, Parkinson's, and more! |
|
|
|
|
|
#2 |
|
All Star
Join Date: Jan 2002
Location: Dexter, MI, USA
Posts: 704
|
OK,
I made a new user, opened up the terminal, hit the Up-Arrow. Nothing happened, as expected. Then, I typed in ls. Hit up, ls popped back into the prompt. Then, I closed the window and opened a new one. Hit up, nothing happens. Hmm.. Typed ls again, quit Terminal.app, opened Terminal.app, hit up. Nothing happens. Was this all just a pipe dream? I could have sworn it used to remember the history between different windows.
__________________
- Greg Happy user of OS X since the Public Beta. Help Team Mac OS X cure cancer, Alzheimer's, ALS, Parkinson's, and more! |
|
|
|
|
|
#3 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
i think you have to exit a shell window properly for it to flush your history buffers.
yep. i just checked. just closing a shell window no remember commands. poop. instead of just closing the window, type exit, or logout or control-D |
|
|
|
|
|
#4 |
|
Moderator
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
|
As MervTormel says,
make it a habit of typing "exit" before quitting the shell window. Cheers... |
|
|
|
|
|
#5 |
|
All Star
Join Date: Jan 2002
Location: Dexter, MI, USA
Posts: 704
|
Excellent, that works for me. For the record, the commands actually does get stored in .tcsh_history, not .history, at least for me.
Thanks
__________________
- Greg Happy user of OS X since the Public Beta. Help Team Mac OS X cure cancer, Alzheimer's, ALS, Parkinson's, and more! |
|
|
|
|
|
#6 |
|
Moderator
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
|
Yes, it's true, they go in ~/.tcshrc_history
Cheers... |
|
|
|
|
|
#7 |
|
Major Leaguer
Join Date: Jan 2002
Location: Adelaide, South Australia
Posts: 470
|
Aaah, but vee haf vays und meens around eeven zaht!
I probably shouldn't go here, but should you feel a burning need you can set the name of the history file in your (ahem!!!) .cshrc by using the line: set histfile = .history What I really wanted to add was a quick point about the .history/.tcshrc_history file. I think by default you get the contents of the last shell that exited cleanly deposited in that file, which is helpful, but not all that exciting. (Of course you also have the "current history" buffer available.) A bit more useful is to allow the contents from any of the terminal windows that you've had open (and exited cleanly) available via the line: set savehist = ( 250 merge ) You can of course pick your favourite number of commands --here 250-- that the shell should keep track of. The commands are "interleaved": that is, they'll pop up in other terminal windows that you open ordered by the time at which they were executed. Very slick stuff. Of course the hard bit is, as with all the history stuff, remembering *not* to enter command-w to close a window. Again, at the risk of sounding like a chronically scratched record, it would be nice if Terminal.app could act better here; maybe it's impossible for it to "do the right thing" and exit the shell cleanly? To try and encourage myself to do the right thing I've just installed a new alias, the old and familiar alias lo logout Rant, rant... rave, rave: "but I'm *not* logging out sir. Really!". "Shut-up and type 'lo' boy, and if I ever see you close a terminal window using the gui or via that command key...". Cheers, Paul |
|
|
|
|
|
#8 |
|
Moderator
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
|
Cuando sali de Cuba, deje mi vida, deje mi amor...!
pmccann, To make sure: I can add the following to my .cshrc file: set histfile = .history set savehist = ( 250 merge ) alias lo ' logout ' If yes, that's great... Guantanamera....guajira Guantanamera....! Cheers... |
|
|
|
|
|
#9 |
|
Major Leaguer
Join Date: Jan 2002
Location: Adelaide, South Australia
Posts: 470
|
Hey Sao, that's not fair: I speak in Hogan's Heroes-ish and you go and break out in Cuban song! (Let's see: something like "When I left Cuba, I left me life, I left my love".) Then "guajira Guantanamera" (hmm, must be Carnival-time!).
"Young peasant girl from Guantomo" (or something like that), but of course it's really an invitation to break into song... I'm just a man who is trying To do some good before dying, To ask each man and his brother, To bear no ill toward each other. This life will never be hollow, To those who listen and follow. To answer your question: Yes! (ObMusic: Kate Bush, The Sensual World. Not that I own it or listen to it...) Cheers, Paul (monolinguist and not proud of it) |
|
|
|
|
|
#10 |
|
Moderator
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
|
Great, are Hogan and his heroes from ....Adelaide.. too?
Sorry, just to add a needed latin touch from my friends. Beatus ille qui procul negotiis ut prisca gens mortalium... (Horatio) and..maybe Je ne dis pas un mot : je regarde toujours La chair de leurs cous blancs brodés de mèches folles : Je suis, sous le corsage et les frêles atours, Le dos divin après la courbe des épaules. (Rimbaud) pmccann, thanks, it works like a charm, please tell me what else do you stick in your... .cshrc file? Come on man, no more secrets here. and also, pleaseeeee.... open up your .login file, we all want to know what you have inside. thanks again... Cheers... Last edited by sao; 02-13-2002 at 02:34 AM. |
|
|
|
|
|
#11 |
|
Major Leaguer
Join Date: Jan 2002
Location: Adelaide, South Australia
Posts: 470
|
From Adelaide? I sink not! You can hear the sort of thing that I was trying to transcribe in some of the .wav files at
http://www.geocities.com/Hollywood/2545/sounds2.htm particularly (in this context) http://www.geocities.com/Hollywood/2...nds/german.wav Google is *my* (special) friend again. It's definitely not worth tracking down much beyond these sounds, but there are some ludicrously detailed web sites devoted to that rather lame television series. As for my .cshrc file: that's like asking to see my petticoat: errr, my stockings... ummm, my underwear. Phew: got there eventually. I've just scoured the file in question and can't find anything that's incredibly interesting: maybe this bunch might be of general worth... set complete=enhance set color alias lsc 'ls-F' alias work 'ssh -L 2001:my.server.com:110 my.server.com' alias vnc 'ssh -C -L5910:my.work.com:5901 my.work.com' alias top 'top -u -s 10' The first one was kicking around osxhints relatively recently: it just makes your tab completion in the shell case insensitive. That is, if you enter cd /sy and then hit the tab key it'll fill out the directory to /System (note the capitalization) and so on. I think the pros of this approach outweight the cons, (basically, if you have two files, say "makefile" and "Makefile.PL" to choose a decidedly loaded example you can't discriminate by entering the capital M, but enter m[tab] -> makefile -> makefile.[tab] if you can see what I mean.) Yep, on further consideration, it's definitely worth it: to get to the cgi directory, for example... /l[tab]w[tab]c[tab][return] instead of having to enter three capital letters. I have e e cummings' disease when it comes to entering commands. (And no, he's not from Adelaide either!) The second and third are linked, and provide a colour coded directory listing in your terminal readout when you enter "lsc" (ie ls"coloured", but call it what you will. Not particularly stunning, but fine and possibly helpful if you don't have too many items in your directories. The fourth is a command I run every time I connect with my modem. It just logs me on to my old work server using ssh, and tunnels port 2001 locally to port 110 (the pop port) on that machine. So in my email application I enter the server as 127.0.0.1 and the port as 2001, and my pop requests travel in an ssh tunnel to the server instead of my all-too-powerful password being thrown out there in the clear every time I collect my mail, which is a bit of a horrifying thought. The fifth is almost identical, except that it connects me to a vnc server that's running on another machine, and again tunnels local requests to port 5910 through to port 5901 on the other machine. (vnc servers grab the first open port after 5900, and you need to know which one your server started on to get this right: I basically leave mine running all the time, so tying it down this way doesn't cause any difficulties.) The -C requests that compression should be used on the data travelling in that tunnel, which is worthwhile here because the *amount* of data that vnc must send back and forth is non-trivial. The final one just calms "top" down. MacOSX and FreeBSD just crank up top with a refresh rate that's way too high for me (every second?), so I just modify the command so that it refreshes every ten seconds instead, and is sorted by cpu usage. Only (slight) downside of this command is due to what I think is a bug in the version of top on OSX: it starts out will all proc's consuming 0.00%, and doesn't give real results until the first refresh. Just hit space to invoke the refresh manually. Actually the top we get is terribly lame compared to the utility on other platforms (and don't mention the way that terminal. app draws the characters at the bottom of the screen: even the "q" that you enter to quit.) For a short post this is awfully long. Enough... Paul |
|
|
|
|
|
#12 |
|
Moderator
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
|
Really, really now, had to force myself a lot to spend a couple of minutes listening to the sounds of all your Adelaide friends.
But not with e e cummings who just told me in a dream, and I quote: "my mind is a big hunk of irrevocable nothing which touch and taste and smell and hearing and sight keep hitting and chipping with sharp fatal tools in an agony of sensual chisels i perform squirms of chrome and execute strides of cobalt nevertheless i feel that i cleverly am being altered that i slightly am becoming something a little different, in fact myself Hereupon helpless i utter lilac shrieks and scarlet bellowings." And then told me, in my dream, that he was born in Adelaide too! so I took the google bus and found at his web page: Edwardo Estlin Cummings October 14, 1894 * * September 3, 1962 E. E. Cummings was born in Adelaide, Australia to Edwardo and Rebecca Haswell Clarke Cummings. Intensely creative, Cummings was also a fine artist, playwright and novelist; his life and art were tightly interwoven. Known for typographic innovation, Cummings controlled both the look and the content of his poems. By the way, pmccann, thanks for opening up. set complete=enhance is really useful. Please, do you know what's the difference between --color=always and set color. This is a really good one, alias top 'top -u -s 10' Thanks a lot. But wait, what is in you .login file, then? Cheers... |
|
|
|
|
|
#13 |
|
Major Leaguer
Join Date: Jan 2002
Location: Adelaide, South Australia
Posts: 470
|
My .login is about as interesting as driving from Adelaide to Perth, and contains nothing but a large handful of environment variables.
One relevant to the coloured ls output from the previous message: setenv LS_COLORS 'di=35:fi=0:ex=31:or=90' Actually that's a bad (indeed *ugly*) joke, but does give you the format required to change the colours that you see. (I seem to recall that all this is in "man csh".) Dunno re "--color always": what's that? Where do you use it? Cheers, Paul [[edited to remove YAIS: (yet another inadvertant smiley)]] Last edited by pmccann; 02-13-2002 at 09:05 PM. |
|
|
|
|
|
#14 |
|
Moderator
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
|
I swear to you my terminal is dancing salsa now, may it has to be somethings with your joke above...?
Well, don't worry, will calm her down with some classical stuff. I installed with fink: fileutils-4.1-3: Common shell commands like ls, touch, chmod The GNU fileutils package contains common shell commands that work on files and directories. This includes stuff like ls, mkdir, cp, rm, chmod and touch. The GNU versions of these utilities often have extra features like colored directory listings and heaps of command line options. So I have in my ~/.cshrc file : alias l 'ls -Ahl --color=always' alias lh 'ls -Al --color=always' alias ls 'ls -A --color=always' What I wanted to know if "set color" was for the same purpose. Cheers... |
|
|
|
|
|
#15 |
|
Moderator
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
|
I feel, I have to set the thing straight:
E. E. Cummings was born in Cambridge, Massachusetts Not Adelaide, Australia and you can read about him at: http://members.tripod.com/~DWipf/cummings.html great poet, great artist. He wrote in SONNETS-REALITIES, XVIII : my girl's tall with hard long eyes as she stands, with her long hard hands keeping silence on her dress, good for sleeping is her long hard body filled with surprise like a white shocking wire, when she smiles a hard long smile it sometimes makes gaily go clean through me tickling aches, and the weak noise of her eyes easily files my impatience to an edge--my girl's tall and taut, with thin legs just like a vine that's spent all of its life on a garden-wall, and is going to die. When we grimly go to bed with these legs she begins to heave and twine about me, and to kiss my face and head. Very beautiful, very touching and precise. If anybody would like to read more of his writtings, just pop in here: http://www.geocities.com/SoHo/8454/eec.htm from is 5, 1926, (and i imagine : and how do i prefer this face to another and why do i weep eat sleep--what does the whole intend" they wonder. oh and they cry "to be, being, that i am alive this absurd fraction in its lowest terms with everything cancelled but shadows --what does it all come down to? love? Love if you like and i like,for the reason that i hate people and lean out of this window is love,love and the reason that i laugh and breathe is oh love and the reason that i do not fall into this street is love." Sorry, to have taken you away from the computer world, for a moment. Cheers... |
|
|
|
![]() |
|
|