Skip to main content
Share Your Experience: Take the 2024 Developer Survey
30 votes
Accepted

Exit shell with shortcut (not typing exit) that closes session properly

Ctrl-D will exit a shell in many cases. It is quicker than typing exit Enter. It's still not a single command to terminate everything, but holding Ctrl and hitting D several times is easier and faster....
0xSheepdog's user avatar
  • 2,750
24 votes

Screen, or similar, for automatically resuming a flaky ssh connection

You could look at using mosh: https://mosh.org/ You could set up a 'jump' server with a reliable internet connection which you use mosh to connect to, then have ssh sessions to each server you manage....
rusty shackleford's user avatar
23 votes
Accepted

Prevent Logoff from Killing tmux Session

This "feature" has existed in systemd previously, but the systemd developers decided to effect a change in the default, to enable the setting for termination of child processes upon log out of a ...
palswim's user avatar
  • 5,227
16 votes

.ssh/config to start remote session in zsh

For anyone arriving here years later, since 2017 it's possible to put everything in the config file: Host host_1 HostName 1.2.3.4 User root Port 22 RequestTTY yes RemoteCommand ...
Saskia Keil's user avatar
14 votes
Accepted

How to attach to a tmux session after deleting it's session file?

The answer was noted in this post. Sending an SIGUSR1 signal to the tmux process recreases the socket file, allowing you to reattach using tmux attach afterwards. Since the PID of the running tmux ...
Tim Visee's user avatar
  • 415
14 votes
Accepted

'dos2unix' is unable to convert a `typescript` file to Unix format

typescript saves everything what is sent to your terminal which may include escape sequences for positioning, colors, brightness etc. (0x1B is the ESC character.) The terminal output contains CR and ...
Bodo's user avatar
  • 6,088
11 votes

How to recover a shell after a disconnection

Someone added reptyr in a comment rather than an answer so I can't upvote it, but it seems a good answer to the edited question and worked great on CentOS. see: https://github.com/nelhage/reptyr ...
ingleno's user avatar
  • 111
11 votes
Accepted

Key passphrases and sshd -- cached authentication?

My best guess is that this is an ssh caching effect -- I entered the passphrase yesterday and the two machines are still trusting each other. This is ssh-agent or some gnome-keyring, which stores ...
Jakuje's user avatar
  • 21.4k
10 votes
Accepted

Processes in a session in an interactive shell vs in a script

ps' -s sessionid option is to select processes based on their session id. You can use ps -j to see the session id of processes. Sessions along with process groups are generally used for shell job ...
Stéphane Chazelas's user avatar
9 votes
Accepted

Linux Mint 18.3 Cinnamon cannot start a session

It's VirtualBox that is the problem. Fix: <Ctrl><Alt><F1> to get a shell and login to the prompt. Then: sudo apt-get remove virtualbox* Credit goes to: Mint forum
Karsten Moisen's user avatar
9 votes

'dos2unix' is unable to convert a `typescript` file to Unix format

0x1b should be part of a VT100 terminal color code or similar. http://www.termsys.demon.co.uk/vtansi.htm <ESC> represents the ASCII "escape" character, 0x1B. In general what script records ...
frostschutz's user avatar
  • 49.3k
9 votes
Accepted

XFCE4 - Session and Startup: where are autostart items saved?

The entries you see are populated from: ~/.config/autostart (user-specific) and /etc/xdg/autostart/ (system-wide) If you want to disable something from the second system-wide location, you create the ...
Artem S. Tashkinov's user avatar
8 votes
Accepted

Universal way to logout from terminal via dbus

On systemd setups you should be able to forcibly terminate a session via logind dbus interface: busctl call org.freedesktop.login1 /org/freedesktop/login1 \ org.freedesktop.login1.Manager ...
don_crissti's user avatar
  • 83.2k
7 votes
Accepted

How can I auto-close dropped SSH connections?

Enable one of the SSH keepalive messages, for example by enabling TCPKeepAlive or ClientAliveInterval in the server's sshd config. Similarly, in the client config you can use TCPKeepAlive and ...
derobert's user avatar
  • 110k
7 votes
Accepted

Running bash -v or bash --v by mistake to know bash version compared to bash -v varname

You are confusing two things. Starting bash as bash -v will start a bash shell in which the set -v (set -o verbose) shell option is set. It is equivalent to bash -o verbose and to bash --verbose (...
Kusalananda's user avatar
  • 337k
7 votes

Can attaching to tmux sessions be password protected, similar to gnu screen?

This isn't possible with tmux yet. You can only lock the terminal so far. The developers argue something about if someone has access to another shell on the system then you are toast anyway. However, ...
Jeff A's user avatar
  • 481
6 votes
Accepted

Reopen Terminal windows after restarting

Technically it depends upon the chosen desktop. The question has been asked here and there without any good answers. For gnome-terminal, a commonly proposed solution is adding the --save-config ...
Thomas Dickey's user avatar
6 votes

Is the number of tty the maximum number of simultaneous sessions?

Entries are added to /dev/pts dynamically, so you’re not limited by the number of entries already present. The kernel uses character devices with majors from 136 to 143 (see the kernel’s device list), ...
Stephen Kitt's user avatar
6 votes
Accepted

How to close XServer session via command

Kill the master process of the X session. The master process is the one that started out in life as the child of xinit, i.e. ~/.xinitrc (which is typically a shell script). Usually the last thing ....
Gilles 'SO- stop being evil''s user avatar
6 votes
Accepted

w command doesn't show all pseudo-terminal sessions

w displays the information stored in utmp (/var/run/utmp typically on Linux systems). This generally is only updated by “login” sessions, i.e. login (for logins on virtual consoles or serial ...
Stephen Kitt's user avatar
6 votes
Accepted

Is there a way to change the process group of a running process?

A process can set its own PGID and SID with the system calls setpgid setsid. The target group/session can't be chosen arbitrarily: setpgid can only move to another process group in the same session, ...
Gilles 'SO- stop being evil''s user avatar
6 votes

Exit shell with shortcut (not typing exit) that closes session properly

Typing ~. actually does the trick of closing all the "nested" connections through to the deepest. It does so with the amicable exit you want as long as all your shells are configured to handle SIGHUP ...
LL3's user avatar
  • 5,438
5 votes

override session for a user (without user list)

In lightdm.conf: [Seat:*] session-wrapper = /usr/local/bin/lightdm-session-wrapper In /usr/local/bin/lightdm-session-wrapper if xfce4 is the default DE: case "$USER" in you) i3 ;; *) $@ ;; ...
Ipor Sircer's user avatar
  • 14.6k
5 votes
Accepted

Detach all other terminals except current one from a tmux session

If I've understood your question correctly, the -d option to attach-session does what you want: tmux -2 attach-session -d -t $WHOAMI This attaches to the named target session and detaches all other ...
Stephen Kitt's user avatar
5 votes
Accepted

In which file does Chromium store session storage data of the HTML5 webstorage

https://www.google.co.uk/search?q=leveldb%20log https://www.quora.com/Why-does-a-LevelDB-database-use-a-directory-instead-of-a-single-file New writes are first appended to a binary log file and ...
sourcejedi's user avatar
  • 50.7k
5 votes
Accepted

Save xfce4 session from the command-line

@guest123 pointed to this page. To sum it up, you have to run this: $ dbus-send --session --dest=org.xfce.SessionManager --print-reply \ /org/xfce/SessionManager org.xfce.Session.Manager....
tokland's user avatar
  • 321
5 votes
Accepted

How to launch a command at the startup of only the very first shell of an X session?

Given the precise requirement “once per X session”, the most natural place to store the information that this has already been done in the current X session is in the state of the X server. There isn'...
Gilles 'SO- stop being evil''s user avatar
5 votes
Accepted

Can you rescue a shell from an accidental "yes" command?

Graphical terminal emulators normally have a limited number of strings to keep in the scrollback buffer, so if your previous lines have been rotated they are lost. You could increase the number of ...
Artem S. Tashkinov's user avatar
5 votes
Accepted

Surprise: Interactive Bash runs commands in a separate Process Group

Strictly speaking, interactive Bash with job control runs commands in separate process groups, not sessions: SESS PGID PID PPID COMMAND 1082760 3784151 3784151 1082760 bash 1082760 ...
Stephen Kitt's user avatar
4 votes
Accepted

Xscreensaver on startup, i3wm

if I understand it you want to put xscreensaver after starting i3wm ? if you enter into the i3wm config file as the last line exec xscreensaver
Oscar Andrea Merandi's user avatar

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