2019-01-10 18:35:05 +00:00
<!DOCTYPE html>
< html >
< head >
< meta charset = "utf-8" >
< meta http-equiv = "X-UA-Compatible" content = "IE=edge,chrome=1" >
< title > Balkian' s site - WELCOME< / title >
< meta name = "viewport" content = "width=device-width" >
< link rel = "stylesheet" href = "../../font-awesome/css/all.css" >
< link rel = "stylesheet" media = "only screen" href = "../../css/main.css" >
< link href = 'http://fonts.googleapis.com/css?family=Open+Sans:300|Comfortaa' rel = 'stylesheet' type = 'text/css' >
< / head >
< body >
< div id = "container" class = "container" >
< div id = "contentwrapper" >
< div id = "content" >
< header id = "header" >
< ul class = "navbar" id = "navbar" >
< a href = "../../" >
< li >
< i class = "fa fa-home fa-large" > < / i >
< / li > < / a >
< a href = "../../post/" > < li class = '' > Blog
< / li > < / a >
< a href = "../../tags/" > < li class = '' > Tags
< / li > < / a >
2019-01-11 14:45:46 +00:00
< a href = "../../cheatsheet/" > < li class = '' > Cheatsheets
2019-01-10 18:35:05 +00:00
< / li > < / a >
< a href = "../../project/" > < li class = '' > Projects
< / li > < / a >
2019-01-11 14:45:46 +00:00
< a href = "../../page/todo/" > < li class = '' > To-do
< / li > < / a >
2019-01-10 18:35:05 +00:00
< a href = "//jfernando.es" target = "_blank" > < li >
CV
< / li > < / a >
2019-01-11 14:45:46 +00:00
< a href = "../../search" > < li >
< i class = "fa fa-search" > < / i >
< / li > < / a >
2019-01-10 18:35:05 +00:00
< / ul >
< / header >
< h2 > Linux< / h2 >
2019-12-11 13:32:34 +00:00
< h1 id = "black-screen-and-lightdm-doesnt-unlock" > Black screen and LightDM doesn't unlock< / h1 >
2019-01-10 18:35:05 +00:00
< p > Add this to your /etc/lightdm/lightdm.conf file:< / p >
2019-12-11 13:32:34 +00:00
< div class = "highlight" > < div style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" >
< table style = "border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;" > < tr > < td style = "vertical-align:top;padding:0;margin:0;border:0;" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 1
< / span > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 2
< / span > < / code > < / pre > < / td >
< td style = "vertical-align:top;padding:0;margin:0;border:0;;width:100%" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class = "language-cfg" data-lang = "cfg" > < span style = "color:#66d9ef" > [LightDM]< / span >
< span style = "color:#a6e22e" > logind-check-graphical< / span > < span style = "color:#f92672" > =< / span > < span style = "color:#e6db74" > true< / span >
< / code > < / pre > < / td > < / tr > < / table >
< / div >
< / div > < h1 id = "edit-previous-commands" > Edit previous commands< / h1 >
2019-01-10 19:22:31 +00:00
< p > < code > fc< / code > is a shell builtin to list and edit previous commands in an editor.
In addition to editing a single line (which you can also do with < code > C-x C-e< / code > ), it also allows you to edit and run several lines at the same time.
You use it like this:< / p >
< p > List previous commands< / p >
2019-12-11 13:32:34 +00:00
< div class = "highlight" > < div style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" >
< table style = "border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;" > < tr > < td style = "vertical-align:top;padding:0;margin:0;border:0;" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 1
< / span > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 2
< / span > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 3
< / span > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 4
< / span > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 5
< / span > < / code > < / pre > < / td >
< td style = "vertical-align:top;padding:0;margin:0;border:0;;width:100%" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class = "language-shell" data-lang = "shell" > $ fc -l
< span style = "color:#ae81ff" > 10259< / span > nvim deploy.sh
2019-01-10 19:22:31 +00:00
10260* cd ..
10261* nvim content/cheatsheet/linux.md
2019-12-11 13:32:34 +00:00
< span style = "color:#ae81ff" > 10262< / span > cd
< / code > < / pre > < / td > < / tr > < / table >
< / div >
< / div > < p > List commands with date (in zsh)< / p >
< div class = "highlight" > < div style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" >
< table style = "border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;" > < tr > < td style = "vertical-align:top;padding:0;margin:0;border:0;" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 1
< / span > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 2
< / span > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 3
< / span > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 4
< / span > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 5
< / span > < / code > < / pre > < / td >
< td style = "vertical-align:top;padding:0;margin:0;border:0;;width:100%" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class = "language-shell" data-lang = "shell" > $ fc -ld
2019-01-10 19:22:31 +00:00
10260* 19:38 cd ..
10261* 19:38 nvim content/cheatsheet/linux.md
2019-12-11 13:32:34 +00:00
< span style = "color:#ae81ff" > 10262< / span > 19:40 cd
< span style = "color:#ae81ff" > 10263< / span > 19:40 fc -l
< / code > < / pre > < / td > < / tr > < / table >
< / div >
< / div > < p > You can add the date too:< / p >
< div class = "highlight" > < div style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" >
< table style = "border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;" > < tr > < td style = "vertical-align:top;padding:0;margin:0;border:0;" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 1
< / span > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 2
< / span > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 3
< / span > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 4
< / span > < / code > < / pre > < / td >
< td style = "vertical-align:top;padding:0;margin:0;border:0;;width:100%" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class = "language-shell" data-lang = "shell" > $ fc -fld
< span style = "color:#ae81ff" > 10262< / span > 1/10/2019 19:40 cd
< span style = "color:#ae81ff" > 10263< / span > 1/10/2019 19:40 fc -l
< span style = "color:#ae81ff" > 10264< / span > 1/10/2019 19:40 fc -ld
< / code > < / pre > < / td > < / tr > < / table >
< / div >
< / div > < p > You can edit a range of commands< / p >
< div class = "highlight" > < div style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" >
< table style = "border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;" > < tr > < td style = "vertical-align:top;padding:0;margin:0;border:0;" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 1
< / span > < / code > < / pre > < / td >
< td style = "vertical-align:top;padding:0;margin:0;border:0;;width:100%" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class = "language-shell" data-lang = "shell" > $ fc < span style = "color:#ae81ff" > 10262< / span > < span style = "color:#ae81ff" > 10264< / span >
< / code > < / pre > < / td > < / tr > < / table >
< / div >
< / div > < p > The range can be relative to the current position, so the previous command is equivalent to:< / p >
< div class = "highlight" > < div style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" >
< table style = "border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;" > < tr > < td style = "vertical-align:top;padding:0;margin:0;border:0;" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 1
< / span > < / code > < / pre > < / td >
< td style = "vertical-align:top;padding:0;margin:0;border:0;;width:100%" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class = "language-shell" data-lang = "shell" > $ fc -3 -1
< / code > < / pre > < / td > < / tr > < / table >
< / div >
< / div > < p > If you save and exit, all commands are executed as a script, and it will be added to your history.< / p >
2019-01-10 19:22:31 +00:00
< p > Source: < a href = "https://shapeshed.com/unix-fc/" > https://shapeshed.com/unix-fc/< / a > < / p >
2019-12-11 13:32:34 +00:00
< h1 id = "prevent-logoff-from-killing-tmux-sessions" > Prevent logoff from killing tmux sessions< / h1 >
< p > Lately I've noticed that logging out of i3, intentionally or when i3 fails, would also kill any tmux or emacs sessions.
This is extremely annoying.< / p >
< p > This is caused by a new default in logind (systemd's login) to kill user process on logoff.
You can revert this setting in your logind.conf (< code > /etc/systemd/logind.conf< / code > ):< / p >
< div class = "highlight" > < div style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" >
< table style = "border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;" > < tr > < td style = "vertical-align:top;padding:0;margin:0;border:0;" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 1
< / span > < / code > < / pre > < / td >
< td style = "vertical-align:top;padding:0;margin:0;border:0;;width:100%" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class = "language-cfg" data-lang = "cfg" > < span style = "color:#a6e22e" > KillUserProcesses< / span > < span style = "color:#f92672" > =< / span > < span style = "color:#e6db74" > no< / span >
< / code > < / pre > < / td > < / tr > < / table >
< / div >
< / div > < p > Or only for a specific process (e.g., tmux):< / p >
< div class = "highlight" > < div style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" >
< table style = "border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;" > < tr > < td style = "vertical-align:top;padding:0;margin:0;border:0;" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code > < span style = "margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f" > 1
< / span > < / code > < / pre > < / td >
< td style = "vertical-align:top;padding:0;margin:0;border:0;;width:100%" >
< pre style = "color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class = "language-shell" data-lang = "shell" > systemd-run --scope --user tmux
< / code > < / pre > < / td > < / tr > < / table >
< / div >
< / div > < p > Source: < a href = "https://unix.stackexchange.com/questions/490267/prevent-logoff-from-killing-tmux-session" > https://unix.stackexchange.com/questions/490267/prevent-logoff-from-killing-tmux-session< / a > < / p >
2019-01-10 19:22:31 +00:00
2019-01-10 18:35:05 +00:00
< / div >
< div id = "sidebar" class = "fixed" >
< div class = "toc" >
< h3 > Contents:< / h3 >
< nav id = "TableOfContents" >
2019-12-11 13:32:34 +00:00
< ul >
< li > < a href = "#black-screen-and-lightdm-doesnt-unlock" > Black screen and LightDM doesn't unlock< / a > < / li >
< li > < a href = "#edit-previous-commands" > Edit previous commands< / a > < / li >
< li > < a href = "#prevent-logoff-from-killing-tmux-sessions" > Prevent logoff from killing tmux sessions< / a > < / li >
< / ul >
2019-01-10 18:35:05 +00:00
< / nav >
< / div >
< / div >
< div class = "clear" > < / div >
< / div >
< footer class = "pagefooter" role = "contentinfo" >
< div class = "contact" >
< p >
J. Fernando Sánchez Rada | balkian
< / p >
< / div >
< ul id = "social" >
< li > < a href = "http://github.com/balkian" > < i class = "fab fa-github" > < / i > < / a > < / li >
< li > < a href = "http://lab.gsi.upm.es/balkian" > < i class = "fab fa-gitlab" > < / i > < / a > < / li >
< li > < a href = "http://twitter.com/balkian" > < i class = "fab fa-twitter" > < / i > < / a > < / li >
< li > < a href = "http://git.sinpapel.es/balkian" > < i class = "fab fa-git" > < / i > < / a > < / li >
< li > < a href = "http://linkedin.com/in/jfsanchezrada" > < i class = "fab fa-linkedin" > < / i > < / a > < / li >
< / ul >
< p >
< i class = "fab fa-creative-commons" > < / i > Creative Commons A-SA-NC
< / p >
< / footer >
< / div >
< script src = "../../js/jquery-2.0.2.min.js" > < / script >
2019-01-11 14:45:46 +00:00
2019-01-10 18:35:05 +00:00
< / body >
< / html >