How can I remove the list of tmux windows from the status bar. In this case I want to get rid of (see lower left) 1:zsh*.
Screenshot of my tmux window
I tried in .tmux.conf the following
set -g status-style nolist
but it did not work. I do not want to get rid of the whole status bar, only the list of windows.
In ~/.tmux.conf, add the following:
set -g window-status-current-format ''
set -g window-status-format ''
Full credit goes to this reddit comment.
Minimal tmux screens
Users may want to hide their list of open windows for many reasons, but one of them may be to completely remove, or minimise heavily, the tmux status line. I had to do this when using tmux on a VT220 (and later, VT510) display, which are CRTs that can suffer from burn-in.
In order to only display the current time and date in the tmux status, I set the following lines:
# Remove left status, set right status formatted per https://man.openbsd.org/strftime.3
set -g status-right "%H%M %d %b"
set-option -g status-left ""
# No colours in the status line
set -g status-bg black
set -g status-fg white
# No window list
set -g window-status-current-format ''
set -g window-status-format ''
You can change status-format[0] to remove the entire window list section (the bit between the styles containing list=on and nolist).
Alternatively you could set all of window-status-format, window-status-current-format, window-status-separator to empty strings.
Related
My prompt is currently displayed like here:
[Aug-27 14:36] /x/y/z/w/u/v/dir1/dir2/dir3>
What I would like to do is replace the constant partial-path of the current working directory
/x/y/z/w/u/v
with
$WORK
so eventually what will be displayed is
[Aug-27 14:36] $WORK/dir1/dir2/dir3>
/x/y/z/w/t/u is always the same path from which I usually do my work and for which I have a local variable $WORK set (very similar to the home ~ idea).
A straight-forward solution will be most-welcomed as I really don't know much about setting a shell.
Just put those lines into ~/.tcshrc:
set WORK='/x/y/z/w/u/v'
set dollar='$'
alias precmd 'printf "%b" "\e[36m"; date +"[%b-%d %H:%M] " | tr -d "\n"; [ `expr "$PWD" : "$WORK*"` -gt 0 ] && printf "%s" "$dollar$PWD" | sed "s|$WORK|WORK|" - || printf "%s" "$PWD"'
set prompt='%#%{\e[0;0m%} '
# The default tcsh ^L binding for screen clearing does not run precmd.
# This one does.
bindkey -s "^L" "clear\n"
precmd is a command, which is run before a prompt is shown to you. You can use it to customize your prompt using other commands available on your system.
When it comes to colors, you can add them using those special color sequences like \e[36m (more details here). In the my example I turned on non-bold cyan for the whole prompt by prepending printf "%b" "\e[36m"; to the definition of precmd. You add your own colors this way, just put that a similar printf command somewhere in there. I turned off colors (bringing back the default text color of the terminal) by appending %{\e[0;0m%} to the prompt, end of which happens to be set by the prompt variable. I'm using %{...%} because this is how you change colors inside when setting the prompt variable. So basically you should use printf "%b" "..."; for the precmd alias and %{...%} for the prompt variable.
I used those for reference:
Setting a part of a PWD as a prompt and keeping a variable updated (SO)
Customizing your shell prompt (www.nparikh.org)
Setting the current path in the command prompt in (t)csh (www.unix.com)
How to write If-else statement in one line in csh? (SO)
How to get a list of tcsh shortcuts? (Unix SE)
Tested on Ubuntu 17.04 with tcsh --version returining tcsh 6.20.00 (Astron) 2016-11-24 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,nd,color,filec.
This is just a custom prompt that probably could give you an idea about how to create/improve yours:
set COLOR1="%{\e[0;32m%}"
set COLOR2="%{\e[0;33m%}"
set COLOR3="%{\e[0;36m%}"
set COLOR4="%{\e[0;0m%}"
set COLOR5="%{\e[0;33m%}"
set prompt="$COLOR2\[$COLOR3%n#%M$COLOR2\:$COLOR1%~$COLOR2\] [%p %d]\n$COLOR5>$COLOR4 "
set promptchars = "%#"
The prompt will be something like:
[user#host:/current/dir] [current date]
>
Like the COLOR variables you could set WORK.
Also, this answer could help: https://stackoverflow.com/a/20871994/1135424
I am plotting graphs in gnuplot and would like to open them in full screen and a particular size.
Previously, I have been outputting graphs in multiplot mode and updating them using reread; so, when I maximise it manually, the plots fill the screen after a few iterations. Now, I also want to save the output as a file. When I open that file, it is in the same small size as the original multiplot output. However, when I maximise it, the plots don't increase in size to fill the screen. I have 2 questions:
How can I open the multiplot file in full screen?
How can I make the output file a particular size?
Here is my current gnuplot code (in a file called gnuplotCode):
set terminal pngcairo dashed enhanced
set output 'foo.png'
set multiplot layout 3, 3
plot for [iter=1:9] path/to/file using 1:(column(iter)) notitle
unset multiplot
unset output
pause 10
reread
I have tried to type the following:
gnuplot -geometry -3360-1050 gnuplotCode # where my screen size is 3360x1050
and:
resolution=$(xrandr | grep '*') && resolution=${resolution% *}
gnuplot -geometry $resolution gnuplotCode
but neither approach works. Please can you tell me how to open gnuplots in full screen and a particular size? Thank you.
You must distinguish between pixel-based terminals (pngcairo, png, canvas (...) and all interactive terminals wxt, x11, qt, windows, aqua, where the size is given in pixel. For vector-based terminals (postscript, svg, postscript etc) the size is given in inch or centimeters.
Using the -geometry flag works only for the x11 terminal:
gnuplot -geometry 800x800 -persist -e 'set terminal x11; plot x'
For all other pixel-based terminal you can use the size option to set the canvas size in pixel:
set terminal pngcairo size 800,800
Of course you can also extract the monitor resolution and use that as size. Here you have two variants:
Extract the monitor size on the shell:
monitorSize=$(xrandr | awk '/\*/{sub(/x/,",");print $1; exit}')
gnuplot -e "monitorSize='$monitorSize'; load 'gnuplotCode'"
The file gnuplotCode must then use the gnuplot variable monitorSize as follows:
set macros
set terminal pngcairo size #monitorSize
set output 'foo.png'
plot x
Note, that the content of the string variable monitorSize must be used as macro, i.e. the value is inserted before the whole line is evaluated.
If you don't want to have that additional line on the shell, you could also call the xrand stuff from within the gnuplot script via the system function. In that case the file gnuplotCode would look as follows:
monitorSize=system("xrandr | awk '/\*/{sub(/x/,\",\");print $1; exit}'")
set macros
set terminal pngcairo size #monitorSize
set output 'foobar.png'
plot x**2
which you must call only with gnuplot gnuplotCode.
Note, that the shell command as is always extracts the information of the first monitor only.
I have recently installed byobu terminal multiplexer, and I found that I am not able to move in a fast way through the terminal. In linux you can do: Control+Arrows (Left/Right). I want to find the same but in byobu.
And I would like to configure it, in order to be able to use Ctrl+Left and Ctrl+Right if it's possible, not other combinations.
Any idea?
I have tried already this: How to make byobu forward-word and backward-word with CTRL+arrow?
But is not working for me.
Ubuntu 13.10
Thanks in advance.
One way to change your key bindings is to edit /usr/share/byobu/keybindings/f-keys.tmux (or edit ~/.byobu/keybindings.tmux).
You will find these lines :
bind-key -n M-Left previous-window
bind-key -n M-Right next-window
M is for Meta, aka the ALT key. Example. Change the lines for :
bind-key -n C-Left previous-window
bind-key -n C-Right next-window
C for Ctrl key (and S for Shift key).
Save, quit, press F5 to reload profile.
Refs : Bybobu doc, Byobu-and-mc, keybindings-in-byobu-using-tmux-backend, tmux
If the Function and other keys are bound to some other program, they won't work. Also, on some OS e.g CentOS, the keys (and their combinations) cease to function.
My solution is to use the bind-key which is Ctrl a to perform different actions. Here are a list of few important shortcuts with bind-key
Help
$ Ctrl-a ?
Create new window
$ Ctrl-a c
Horizontal split
$ Ctrl-a | #Shift + \ = |
Vertical split
$ Ctrl-a %
Rename windows
$ Ctrl-a ,
Move window
$ Ctrl-a .
To move between splits (tested on RHEL)
$ Ctrl-a (arrow-keys)
NOTE: Tested on RHEL/CentOS
I have only these 2 lines in ~/.tmux.conf:
unbind r
bind r source-file ~/.tmux.conf; display "Reloaded"
I start up tmux with just
tmux
And
/Users/.../.tmux.conf:2: can't establish current session
is the result.
Why is this, and how can I prevent it?
You have a typo in the second command; you need to escape the semicolon. See the example in man tmux:
bind-key R source-file ~/.tmux.conf \; \
display-message "source-file done"
As the manual goes on to explain:
Multiple commands may be specified together as part of a command sequence. Each command should be separated by spaces and a semicolon; commands are
executed sequentially from left to right and lines ending with a backslash continue on to the next line, except when escaped by another backslash. A
literal semicolon may be included by escaping it with a backslash (for example, when specifying a command sequence to bind-key).
I just had this error message when I had a few set commands in there which didn't have the -g flag. So if someone has that problem, try adding -g to your sets.
Is there an option for the qemu-nbd command to get the next free, i.e. unused NBD like losetup -f does? The manpage of 0.0.1 (which is version of the currently stable release 1.7.0 of qemu) doesn't mention anything.
You can query attributes about nbd devices in sysfs.
For example:
cat /sys/class/block/nbd0/size
Will return 0, or the size of the mapped image file otherwise, if /dev/ndb0 is in use.
So you could iterate each device until you find one with 0 and attempt to try that with qemu-nbd.
Something like this should do it:
for x in /sys/class/block/nbd* ; do
S=`cat $x/size`
if [ "$S" == "0" ] ; then
qemu-nbd -c /dev/`basename $x` some_file.img
break
fi
done