Hot answers tagged

25

If someone wants to record their terminal sessions automatically (including SSH sessions(!)) using the `script* utility here is how. Add the following line at the end of .bashrc in your home (or /etc/bash.bashrc if you only want to record all users' sessions). We test for shell's parent process not being script and then run script. for Linux: test "$(ps -...


24

Does Ctrl+Alt work? Found it mentioned in a bug tracker, but I can't test it myself as I don't use KDE.


19

As per the tmux FAQ, add this to your ~/.tmux.conf: set -g default-terminal "screen-256color" Then add this alias for tmux: alias tmux='tmux -2' No need to override the TERM variable in your profile or when starting tmux. More information: http://vim.wikia.com/wiki/256_colors_setup_for_console_Vim


17

There are actually two different settings. The one you described in your question, Ctrl+Shift+M or Settings > Show Menubar is for the current window only. You can disable the menubar for newly created windows permanently by unchecking Settings > Configure Konsole > General > Show menubar by default or by changing/adding [KonsoleWindow] ...


14

When you press a key or key combination in a terminal, it is transmitted to the application running in the terminal as a sequence of one or more characters. For example, when you press a, the application receives a. When you press Enter, the application receives the character CR (a.k.a. ^M (pronounced “control-emm”), a.k.a. character number 13, a.k.a. \r or \...


12

The newest version of ncurses ships with a tmux-256color terminfo entry (the FAQ does mention this). As an example, a benefit of using tmux-256color over screen-256color is that italics is properly rendered (screen doesn't support italics). So if you have the latest ncurses package, the following will work as well: set -g default-terminal "tmux-256color"


12

Perhaps you ran a subshell from an editor, and it left the terminal in the alternate screen. You can test that by tput rmcup which would return to the normal display. While in the alternate screen, some terminals may override the scroll-wheel action by sending up/down cursor escapes.


10

Although this question was asked by an individual wanting to record his own sessions, an alternative use case might be a system administrator who wants to keep track of what various users are doing. I fear running script inside the system-wide bashrc might not be suitable in the case when users of the machine are reluctant to have recordings made of their ...


9

(1) gives you an emulation of the terminal. Programs such as Gnome Terminal an Konsole are called "terminal emulator". (2) gives you a real terminal. Alright, it's still an emulation of a terminal, but it's "more real" than (1), because the emulation is done by the kernel itself. (3) is actually the same as (2). When you don't have X you will see tty0, ...


9

It appears write is interpreting the high bit as ‘meta-’ (Meta+key or Esc key). A quick look at the source code (function wr_fputs() in write.c) confirms this: control characters are shown as ^X, characters with the high bit set are shown as M-X. Locale settings, terminals and encodings have nothing to do with it, I'm afraid. write is just 7-bit. Now, I'm a ...


8

I'm sure you could make a command with dbus. But there is a shortcut for clear scrollback and reset by default. Ctrl + shift + x.


8

Using strace you can see what konsole is up to. $ strace -s 2000 -o konsole.log ... ... open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=2655, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f316d8fc000 read(3, "root:x:0:0:root:/root:/bin/bash\nbin:x:1:1:bin:/bin:/sbin/nologin\...


8

This is reported to have been resolved in QTBUG-66036 with version 5.12. As of the time I am writing this, QT on Arch Linux is version 5.11.2-1. Other common distros have also not released packages with Qt 5.12. However, when Qt 5.12 is released, the developers expect this issue to be resolved. To check your Qt version, you can open a terminal and type: ...


7

For the same reason ls -l reads /etc/passwd, it is the data that associates UIDs with names. When ls calls stat(2) on a file it gets a numeric UID for the owner of the file. In order to display that as a human readable name, it needs to look it up in the only place that has those associations, /etc/passwd. For example a typical first line in /etc/passwd is ...


6

You need to first go to settings of konsole: settings -> configure current profile -> Tabs -> Tab title format = %w The konsole by default ignores what is asked for, it does its own thing, as configured. %w tells is replaced by what ever the shell wants it to be. There are other codes, use the insert button it knows all the codes. A brief note on getting ...


6

Upgrading to Qt 5.12 is fine, but does not seem to fix the issue straight away. In Konsole profile settings under the advanced tab, change "Line Spacing" to 1. This has fixed the issue with horizontal lines for me.


5

I'd say it's a bug. What version of bash are you running? Your command-line is incorrect, but it shouldn't crash the shell. I'd expect to see output like this: $ cp p2 &2 & [1] 24800 [2] 24801 $ bash: 2: command not found cp: missing destination file operand after `p2' Try `cp --help' for more information. [1]- Exit 1 cp -i p2 [2]+ ...


5

Go to Settings->Edit Current Profile. Select the Mouse tab. There's a check box there: Allow Ctrl+scrollwheel to zoom text size. Untick that and click Apply.


3

You can open Konsole in fullscreen mode with konsole --fullscreen (That should work only with KDE 4.11 and newer). However, I assume that you want to be able to open Konsole in fullscreen mode with just clicking icon somewhere, maybe in taskbar. To achieve that, do the following steps: Copy /usr/share/applications/konsole.desktop to either /usr/share/...


3

Really important note here if you're running an Ubuntu older than Bionic (18.04). If you're running tmux 2.1 or older, and you probably are, basically no advice you read online about tmux will work..for anything. tmux -V is an easy test for this. If you see 2.1 or older, you can build tmux from source, or you can add an unofficial repository. I updated ...


3

ef bf bd is the UTF-8 encoding of REPLACEMENT CHARACTER (�), which is "used to replace an incoming character whose value is unknown or unrepresentable in Unicode". What you describe is not "extended ASCII", but rather binary data. Some bytes in the range 0x80-0xff are not valid ISO 8859 anything, so it's understandable that some programs treat that as an ...


3

It depends on how terminal works, really. Some terminals aim to be lightweight, others do not. Some features require more overhead which can have visible impact(this is what you've encountered). You may want to look for lightweight terminal emulators, try out few and pick the one that fits you best. I've personally used Sakura nad Terminator, both of which ...


3

Konsole ignores that, because it relies upon a hard-coded list of keys which cannot be mapped: // Override any of the following shortcuts because // they are needed by the terminal int keyCode = keyEvent->key() | modifiers; switch (keyCode) { // list is taken from the QLineEdit::event() code case Qt::Key_Tab: case Qt::Key_Delete: case Qt::Key_Home: case ...


3

tl;dr: Get used to Alt+Enter (a.k.a. ESC followed by Enter) instead. Ctrl+Enter generates the exact same sequence in terminal emulators as Enter, so there's no way for an app to distinguish these two. Well, no way by looking at the input stream it receives from the terminal emulator. mc has an interesting feature called "X11 support". It does not only look ...


3

Background After the expansion is done for special prompt sequences, every character remaining in the prompt is counted in order to calculate the length of the prompt. Problem Since you've added the color sequences, which in fact shouldn't be counted for the length of a prompt, bash now actually thinks that your prompt is longer than it really is. ...


3

They are also defined as global Konsole shortcuts to switch to the previous/next tab. Go to Konsole's Settings -> Configure Shortcuts and remove them there. (I performed this first, followed by the step you described. I also had to restart konsole for the changes to take effect; not sure if you'll need to restart too.)


2

One option is to run it with nohup: nohup mycoollittlescript Another would be to run it inside a terminal emulator like tmux or screen. These are terminal apps that are themselves terminal emulators. When the parent terminal is closed, they stay running in the backgrounmd and tyou can reconnect to them from another terminal window. Try this: screen -R -...


2

Instead of: test "$(ps -ocommand= -p $PPID | awk '{print $1}')" == 'script' || I would use: grep -qx "$PPID" <(pgrep -x "script") || The double-quotes aren't necessary in this case, but I tend to use them anyway as a standard practice. I definitely recommend using the "x" switch to both the grep and the pgrep, to avoid a rare-but-problematic match ...


2

I could not explain why this works but it solved the problem for me. ~/.tmux.conf set-option -g default-command bash


Only top voted, non community-wiki answers of a minimum length are eligible