HACKER Q&A
📣 endorphine

Tips/tricks for Linux workstations that everyone should know


Linux users, what are your favorite little hacks, convenience scripts or essential things that you managed to make work (and that are traditionally hard on Linux)?

Alternatively, what is a simple thing you have in your system that you think everyone should have?

I'm interested in potentially learning any essential stuff that I might be missing out. Could be related to usability, accessibility, security, battery life or anything else really.


  👤 ragingrobot Accepted Answer ✓
I had tried to do it on logout, but .{bash,zsh}_logout turned out to be unreliable, so now I do it on logon:

1. Save your history!

Unless you have an insanely long history length set (and by default, you really won't), that one off command you never think you're going to need again? You're going to need it. And all those commands you typed after it will push it out of history and it's gone forever.

So, in your .{bash,zsh}rc, do something like

  cp .histfile histories/$(date).histfile
Name it however you like. There are ways to avoid duplication and saving excessive amounts, but I'll leave that up to you.

2. tmux/GNU screen

For some reason I can't stand tabbed terminal windows, and use a multiplexer. Plus tmux's scrolling is a little easier to use that a mousewheel.

3. zsh

If you chose zsh over bash, you get easier to use expansion tools, for example, the equivalent of basename in bash is

  ${FILE##*/}
in zsh

  ${FILE:t}
Helpful in scripting and the like.

👤 ofalkaed
My linux setup has barely changed in 20 years and many of my configs are 20 years old now, fairly proud of that. Been using Slackware with ion/notion wm and it frees me from having to relearn things every major release, stays out of the users way like a system should.

The most useful thing I have done in years is bind my Print Screen key to toggle touchpad on and off which is great for the modern massive touchpads that laptops have. I ended up doing it in a rather hackish way, I have not had a need to use Lua since ~ion3 days so had forgotten it, ended up just writing the script in bash and the lua script just executes the bash script. It works, I am happy even if I would be embarrassed to show it to anyone especially since it probably would have only taken 15 minutes to relearn enough lua to avoid the bash script.