In linux, top can be used to monitor system status. When it is running, using f allows us to choose the columns to be displayed.
However, when you quit it and reenter top, all the settings go back to the default.
How can I make the changes persistent? Is there a config file for top?
Use W (capital w) to save the top configuration after you made your changes.
By issuing this command just before quitting top, you will be able restart later in exactly that same state (from man page)
Related
linux terminals display output on a (configurable) scrolling window. User configuration allows control of both the scrolling and the size of the window (in number of rows and columns).
The fact that we can scroll back to areas that went off screen, then select that text for cut+paste, means that there is an accessible buffer where that content can be reached directly and specifically.
Is there a process, using linux/bash built-ins or utilites, which would permit the user to access specific segments of that content buffer (which are otherwise accessible via mouse selection) from within a bash script (preferrably directly ... and, if not, possibly via prompted mouse interraction) ?
If unable to do that selectively, is there a way, again from within a bash script, to get a snapshot of that full 2000-line buffer and save it to a script-defined file, where it could then be manipulated ?
I just found out about the possibility of hooks in tmux. Since I'm still very new to the command line (and therefore not used to (say need time to) read through all relevant parts of a manpage) I just quickly wanted to ask here, if it is possible to use bash commands to trigger (e.g. when I use ssh, I want to change the color of my status bar). (Although I fear it is not possible).
If not, what could be a way to achieve what I want? Can I make an alias for the command in question and 'reload' a different .tmux.conf file (in a current session)?
Thanks for your help!
Edit:
For example:
I have two versions of a program where I source different environmental variables via aliases (say progVersionA and progVersionB).
When I have a tmux session running, I would like the current 'sourced' environment shown in the status bar (say "progVersionA"). And as soon as I switch to the other program the status bar should read "progVersionB". So, what I want is, that the status bar changes as soon as I run the alias progVersionB.
I want to know if anyone does know a way to dump or copy the whole lot of viewable messages in a xterm window on linux. The very important thing is I don't want to know how to send a command out and kapture its output for stream 1 and 2 as well as the input, as this is well known to me.
I may explain for what this is needed. You do something and expect not any complications but than you got pages of msg's als err msg or normal output. To be able to see later after it you should be able to get them in a file and as long as you are able to scroll that all back and forther with your mouse it is sure the data is there some where. But the time may be not to scroll and screenshot and scroll ....
I would be glad to help me out in such cases and it would be fine to have the full view including all your own typing and all the msg's in same order as you watch it when you scroll it back.
I don't really know where this is stored and how you could get that saved. I know that I could dump the whole lot of Memory and search it for a part of the xterm window, but that is a bit over the top I think.
There is a control sequence, which I had forgotten. This question reminded me. In XTerm Control Sequences, it is noted "print all pages":
CSI ? Pm i
Media Copy (MC, DEC-specific).
Ps = 1 -> Print line containing cursor.
Ps = 4 -> Turn off autoprint mode.
Ps = 5 -> Turn on autoprint mode.
Ps = 1 0 -> Print composed display, ignores DECPEX.
Ps = 1 1 -> Print all pages.
That dates from 1999 (patch #119), so you likely have it in your xterm. You could do this in a shell command like this:
printf '\033[?11i'
A comment mentions the page Hidden gems of xterm, which uses the corresponding action print-everything (something that can be executed via the translations resource). It is in the manual page, of course. The same comment points to Extra characters in XTerm printerCommand output, which mentions the resource printAttributes. By default, the control sequences for the printer tell xterm to send extra control characters (to reconstruct video attributes). The resource can be modified (set to 0) to suppress that. That is even older (patch #74).
Without that — Conceivably one could construct an application which used the X SendEvent protocol to construct a series of events which would be interpreted as xterm actions to scroll back, select text and copy it chunk-by-chunk via the clipboard. You could even write it in Perl (there is a module for X protocol). But seriously, no.
If you want to capture text which was written to xterm, you can do this by preparing before the text is needed by different methods (see manual):
turn on the xterm logging feature (not that user-friendly because it generates the filename). This can be enabled using the "Log to File (logging)" menu entry.
use the printer control sequences to write lines as they are written (again, not that friendly, though there is a menu entry to turn it on and off, "Redirect to Printer (print-redir)")
use script to capture all output to the terminal. I use this, because it works with any terminal on any POSIX-like system (even Cygwin).
Each of these methods produces a file containing escape/control sequences, which requires filtering out. The hypothetical program using SendEvent could in principle eliminate that.
I have a linux installation without X. When I launch a third-part application (i.e. gstreamer) it draws on a portion of the screen, let the users see through the external areas.
I want to "clear" the console so it appears black. Of course the clear command won't work because you still see the prompt.
Might you recommend any way to achieve this?
The environment variable which contains the output displayed by the prompt is named PS1. You can empty this variable when needed.
Don't forget to keep a 'backup' of the value in order to be able to set it back to its old value
Problem:
I have an extra set of top and bottom gnome-panels for a second monitor. When I undock my lenovo Thinkpad (T510), the extra top and bottom panels remain, so I have two on top and two on the bottom. I am currently running a RHEL6/Fedora (x86_64) gnome (2.28.2) instance with xmonad (0.9.1-6.1.el6) set as the window manager, using the xmonad extensions to work within gnome.
Tried:
I've used acpi and found a code for docking and undocking, but when I try to utilize a script I found in this blog post, it gets zero for the call to xrandr. The script works when called on its own from the terminal. I've tried calling a separate looping script in its own thread and it keeps getting zero for the value, long after the screen(s) update(s).
I have figured out how to have a script loop every X seconds and check for a file which is touched into existence in the event of the script getting a zero, then performing the necessary change, but I don't like that approach.
Question:
I'm hoping someone knows a place I can drop a call to the referenced script and have my panels come and go as I would expect without needing to initiate the script manually.
Thanks!
Update: I have added a bounty of 50 (max I can do) for an answer.
Ben
I guess one of the problems listed below occures (or both):
1) looks like your xrandr snippet doesn't return proper values because the $DISPLAY environment variable is not set correctly. Acpi handler script normally runs as a user which is not the user running your current X session. That way xrandr just does not know which $DISPLAY to access.
2) if $DISPLAY is set correctly, the acpid user might still not be able to access your running xsession. You might check whether the script will work over acpi handler, if you execute xhost + as the user who is currently runging the current xsession with $DISPLAY specified in your script. This will disable access control for X. You can reenable it with xhost - again.
Check it, I hope it helps or will at least point you in which direction to dig.