Finally switched to Linux Mint

Pages: 123
Raise Extant Window To Front on Hand-off

As noted before, I tend to use Notepad++ for (most) of my editing tasks.

On Windows, I have (had) a macro that just started the program, so I can, at the terminal, type “npp a.cpp” and Notepad++ will start, raise, and open a.cpp. If there is already an existing instance, Notepad++ will do (as programs of this type very much should do) just hand-off to the existing instance, which should raise itself and take focus.

Linux WMs, however, are a little less bright about letting programs take focus. A good window manager will not let background processes take focus willy-nilly. Windows Explorer is smart enough to know that the program is handing off control to an existing (duplicate) process, though, and allows the action.

To remedy this lack in Linux I have updated my npp alias (a shell function, actually) to use a useful little utility called wmctrl.

function npp() {
    wmctrl -a Notepad++
    wine C:\\Program\ Files\\Notepad++\\Notepad++.exe "$@" &

That is, if Notepad++ is already running, raise it and give it focus, then launch the duplicate process that will terminate itself after signalling the extant process to open the desired file.

(Nicely, too, is that it will also move the existing instance to whatever workspace I am on. Win win win!)

If you are wondering where to put all these little functions (and aliases), they go in a convenient little file named ~/.bash_aliases, which ~/.bashrc conveniently loads (by default — I didn’t actually have to write the code to do it, lol).

Last edited on
Your experience and explanations of what you are doing is making me less leery of at the very least of trying Linux. Thanks for doing the running commentary, D. :)
Mint and RHEL seem to have different .bashrc
The latest major version of RHEL, 9, has in its .bashrc (after other stuff):
# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
	for rc in ~/.bashrc.d/*; do
		if [ -f "$rc" ]; then
			. "$rc"

unset rc

Last edited on
Hmm, I had never considered a ~/.bashrc.d/ directory before. But that is another (good) way to do it.

From what I read online people typically have a file in that directory just for random user aliases too. I’d be disinclined to create an entirely separate file for every single alias, but I can see where it would be nice to have initialization/alias files specific to a given software.

That’s not something I really need, at least not ATM. But who knows?
The cool thing is that it can easily be changed to work as desired.

(BTW, you can do the same on Windows, too. But again, I have never needed anything more complex than a single, simple alias/macro file.)
While I wrote "RHEL", I actually use AlmaLinux. Practically the same thing. Anyway, RHEL has gradually[1] added those directories for configuration. Where before was just one file "XX" (or XX.conf) there are now both that file XX and (optionally) directory XX.d. The program includes files from the directory -- the .bashrc above is an example of that.

The apparent logic is that since the XX is from package, it is easier and more clear that all user customizations are added as separate file(s) rather than edited into the XX. After all, update of the package may include changes into XX, which then requires a merge of upstream and user edits. Besides, it is way easier to remember what I did when all of it (and only it) is in a file (that is not in package management).

I can tell that configs created years ago that have somehow survived many systems, can (A) have bad practices from poor understanding, (B) may have lost relevance, and (C) have long forgotten rationale. But all of that ought to be painfully familiar on programming forum.

[1] Example: openssh
* RHEL 7 had only two files: /etc/ssh/sshd_config and /etc/ssh/ssh_config for server and client config
* RHEL 8 did add /etc/ssh/ssh_config.d/ for client config
* RHEL 9 did add /etc/ssh/sshd_config.d/ for server config
Unlike MacOS or Windows there are more than one option available for an install-it-and-use-it Linux distro AFAIK.

while very few people do it -- they are designed for corporate use more than anything else -- there are options for windows.

There is an embedded version that you can strip the junk out of, all the way down to a console only bootup if I recall it correctly (but I haven't used 11's, not touched since win7 or so). There are also the better known server, home, pro, enterprise flavors.

The thing is they all came from the same place, so unlike linux, the difference is more about features and pricing than really alternative setups.
Alas, just a bump to keep from archiving.

I think I have a couple more things I’m gonna share, but... not yet.
Please do share, my next PC will probably be a Minty Fresh Linux box, the cost of satisfying Win 11's hardware and resources lust is outside my price range.
Okay, here’s another.


I spend untold hours at the shell prompt. No, no traipsing through menus for me. Clickity-clack on the keyboard and it’s done, faster than you can say “get off my lawn!”

Alas, on Linux the terminal prompt string is always initialized to something kind of ugly like


(Where Eirinn is using her computer, which she has named “go-braugh-pc” for network identification, and the current working directory is her home folder.)

Nicer terminal emulators even try helping with that jumble by highlighting the different parts with pretty colors.

But for a simple home PC, you just don’t need all that stuff for your local hacking. On Windows all you need to see is the current working directory.
Okay, so, the current username is nice too. We’ll keep that.


First, we are absolutely not going to change the system prompt. Just my local user prompt. For example, if Seamus comes and sits down and types su seamus, he wants to see his prompt, not Eirinn’s.

Likewise, if Eirinn use internet magic to log in on another computer somewhere, she wants to see a different prompt — the default one telling her which computer she is logged into is a Good Thing™.

And it is especially important when switching to root, where you need to sit on your hands every time you even consider pressing Enter. A switch from your everyday, friendly-looking prompt to something that screams “YER NOT IN KANSAS ANYMORE DOROTHY!” is A Very Good Thing™.

Alright, enough rationalizing about it. Let’s make stuff happen.


An R-C file is the old name pirates used to refer to excess rum consumption when managing CTSS systems. These days we just call them config scripts or something stupid like that.

In your home directory you have a number of files beginning with a period (or “dot”), some of which also end with “rc”. For some odd reason we call them dot-files. You can only see them if you give ls the correct Vulcan nerve pinch. Open up a terminal (press Ctrl+Alt+T or mouse over to the start menu). Type:

    ls -adF .*

You’ll notice there are quite a few dot-files. Some of them are directories, even.

The one we are interested in is named “.bashrc”. Go ahead and open it up in a text editor. (Type xed .bashrc to open it in the Linux version of Notepad. And if you are unfortunate enough to have opened it with a Dark theme, you can go to ViewHighlight mode and select “Plain Text” from the top. That or spend time dinking with the highlighting theme. You might want to turn off Word Wrap as well. Or if you are comfortable with Nano or Emacs or Vim or something, you can type that instead: vi .bashrc.)

Remember, when on Linux, if you don’t know what it is, don’t touch it! This will remain true as we look through this file.


About 60 lines down you’ll see stuff about “$color_prompt”. Alternately, you can just search for the text “PS1”. (That’s papa sierra one.)

You will find an unholy-looking incantation something like:

PS1='\n${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\ [\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

Don’t worry, it isn’t as bad as it looks. (It’s worse.)

A few lines below it you’ll also see:

    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

That line is a whole lot less scary. The difference is that the first line has terminal control color codes mixed in to it, but otherwise the two lines are the same. And these are the two lines we will modify. (There is also a line somewhere below those two for an xterm, but unless you intend to dial in to your computer from the library or something, you can safely ignore it.)

What it says is this:

  • If you are using chroot, show it in parentheses.
  • Show the username.
  • Show an @.
  • Show the hostname (what your computer calls itself on the network).
  • Show a :
  • Show the current working directory.
  • Show a $ (or %) which means you are a normal user.

I am going to change that to get rid of the hostname and uncrunch it a little. We’ll keep the chroot string — it’s dead useful when developing programs, and besides, I’d definitely like some indication to remind me if I chrooted. My new prompt string looks like this:

    PS1='\n${debian_chroot:+($debian_chroot) }\u \w $ '

Now I see a much less cluttered:

    michael ~ $ 

It even adds a blank space between the end of the last command and the new prompt. Very pretty!


All righty then, time to get out the magic chickens. We’re gonna wave a couple of them around.

The first is this little script obtained from
    for c; do
        printf '\e[48;5;%dm%03d' $c $c
    printf '\e[0m \n'

IFS=$' \t\n'
color {0..15}
for ((i=0;i<6;i++)); do
    color $(seq $((i*36+16)) $((i*36+51)))
color {232..255}

Save it somewhere useful. Don’t forget to make it executable! (chmod +x

The next is a website:
Skip all the others that claim to make PS1s for you. They suck.
Noah explains why on that page itself, but you can just Trust Me™ that he’s one of the Elder Ones.

On his site, build your PS1. The components of mine look like this:

  Text      : "\n${debian_chroot:+($debian_chroot) }"
  Set color : Green
  Text      : "\u"
  Set color : Blue
  Text      : " \w"
  Set color : Magenta
  Text      : " $"
  Reset style
  Text      : " "

Copy from the Result text box below and replace the color PS1 string in your .bashrc.

Now run that little shell script in a terminal (./ It will print out all the colors available to you and their indices. For example, color 001 is bright red.
Don’t worry, the color is what matters. Color 001 is simply bright red and can be used for both foreground and background colors.

Choose the color you like best for each part of your prompt and change the “tput setaf 4” to use the index of the color you wish to have it. I have a “dark” desktop theme going, so my final prompt string reads:

PS1="\n${debian_chroot:+($debian_chroot) }\[$(tput setaf 10)\]\u\[$(tput setaf 12)\] \w\[$(tput setaf 13)\] $\[$(tput sgr0)\] "

Save the changes and start a new terminal emulator to see the new prompt.

    while (!satisfied)
        edit_and_save( ".bashrc" );

That’s it! You have now conquered Level 1 of the deep magic.

More to come... Post size limit ’n all...
Last edited on
For comparison, in RHEL 9, the default shell is bash and default .bash_profile for regular accounts is:
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc

# User specific environment and startup programs

Corresponding default .bashrc is:
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
export PATH

# Uncomment the following line if you don't like systemctl's auto-paging feature:

# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
	for rc in ~/.bashrc.d/*; do
		if [ -f "$rc" ]; then
			. "$rc"

unset rc

I have thus created directory ~/.bashrc.d and dropped in a file:
$ cat ~/.bashrc.d/history 
PS1="\\h:\\l:\\w\\$ "

(Yes, I'm not into fancy colours, but I do like timestamps on the short history of time.)

Furthermore, admin could add *.sh files into /etc/profile.d/ and they would be sourced too by every user's shell.
Last edited on
I still agree that the ~/.bashrc.d/* stuff is a fabulous design structure.

I do find it odd that PS1 is defined in isolation in the history config. Where does Red Hat put the PS2..PS4 prompts? Or are they just ignored (hence, left at the system defaults) in user scripts?

In any case, dear reader, no matter where PS1 is defined, you can modify it as described above to make it look like you want.

If you are unsure where it is, in your home directory just search grep -lr PS1 *. That’ll tell you which files you should look into.

Oh, and thanks, K, for updating us with the RHEL info!

I do find it odd that PS1 is defined in isolation in the history config.

That is just me being lazy. I had mainly history-related customizations for myself, so used name "history" rather than "my_awesome_things", and ended up adding the PS1 there too, rather than separate file or renamed file.

(Remember kids, names are difficult.)

Overall, Red Hat has gradually proliferated the "drop your customizations for X into X.d/" for most services. Red Hat family of distros uses RPM package manager. Each package tells what files it owns, so can be easily installed and removed (and thus updated). If user edits a (config) file that is from package, then future package updates will face a merge issue. (I remember how Subversion boasted: "branching is easy" and later Git responded: "merge is easy too", but package manager is not a psychic.) Besides, it is way easier to remember what you did when it is in separate files.

Where does Red Hat put the PS2..PS4 prompts? Or are they just ignored (hence, left at the system defaults) in user scripts?

The PS0 is apparently set in /etc/profile.d/ when $TERM matches xterm*|vte*
That file comes from:
$ rpm -qf /etc/profile.d/
$ rpm -qif /etc/profile.d/ | grep -A3 Summary
Summary     : Profile script for VTE terminal emulator library
Description :
The vte-profile package contains a profile.d script for the VTE terminal
emulator library.

The PS1 is changed from default in /etc/bashrc:
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
grep -r PS[0-4] /etc did not find other hits, so PS[2-4] must be on defaults.
I only mentioned it in passing earlier, but the Compose Key really is the cat’s meow.

I wish I had known about it years before. It makes typing special symbols SOOO much easier than having to memorize stupid Alt-codes.

And while it does typically exist Out of the Box™ on Linux (as it does on Mint), it is also possible for you poor saps on Windows or OS X to use as well.

To keep this short, and perhaps to convince y’all on Windows or OS X to give it a try, here’s a short blog I found on the internet you should definitely read before dismissing outright:

Honestly, once you discover it, you won’t go back.
Last edited on

There are lots of keyboard shortcuts enabled by default as well. For example to Quick Tile Window Left is Meta + left-arrow which is the same as windows. I use Fedora with KDE, so this is found in Settings -> Shortcuts -> KWin -> Quick Tile Window Left. These shortcuts are configurable in that same app, probably in some config file somewhere too.

When should I expect to see you back on Windows? 👀

As soon as I buy a KVM switch, then I’ll boot up my old Windows PC again.

But outside of frobbing MSVC under Windows 10 or some other esoteric Windows thing I’m unaware I need, I’m pretty happy here on Mint.
Aww I see:) Have fun on the other side hehe

Linux systems these days don’t tend to install with swap partitions. They have swap files. And the default swapfile is two gigabytes.

My system was a brand new computer, so I was installing on new storage media, so I didn’t have to do any partitioning myself. I kind of assumed that it would create a swap partition, and was somewhat confused when later listings didn’t show it, but didn’t really let that bother me. The system worked just fine!

So, full disclosure, I’m a bit of a blenderhead. You can actually check out my meager portfolio here:

Sorry for all the stuff that is missing. The missing things are old — from before blenderartists had on-site image hosting and before I lost all my data when both of my hard drives died within one week of each other. Rest assured, you are missing something mildly cool, but it won’t affect your life negatively in any way whatsoever.

I have a scene I’ve been working on (an arch viz) which isn’t particularly heavy — my scrappy old Windows box could handle it — but with a 2G swap the Linux OOM Killer kept putting the axe to Blender any time I tried to render it (using the default Cycles ray tracer engine).

You can read some interesting stuff about how memory management works on Linux here: Taming the OOM killer A basic reading is: Linux over-commits (says it has memory even when it can’t guarantee it can produce it later) and the OOM killer thereafter prunes processes that are gobbling up bytes, leaving only the message “Killed” behind.

In any case, I needed a bigger swap. Fearing I would have to play with partitions, I looked at my system again and... had to use the internet to learn about swap files. ’Cause that’s what I had.

A thread on the Linux Mint forums helped me out significantly ( I am actually just going to repeat information found there, which is:

# Look for your swap file
swapon -s
# It will show you something like this. In this example, the swap file is /swapfile which is 2 GB 
# Filename				Type		Size	Used	Priority
# /swapfile                              	file    	2097148	0	-2

# Assuming /swapfile is your swap file (otherwise replace with the real name), turn it off
sudo swapoff /swapfile

# Increase the size.  In this example, it is being increased to 32 GB
sudo fallocate -l 32G /swapfile

# Now tell the system this is a swap file
sudo mkswap /swapfile

# Then turn it back on
sudo swapon /swapfile

# Check it
swapon -s

# You should see something like this
# Filename				Type		Size	Used	Priority
# /swapfile                              	file    	33554428	0	-2

# Have a look at memory and swap usage
free -h
#              total        used        free      shared  buff/cache   available
# Mem:           15Gi       1.8Gi        11Gi        86Mi       2.1Gi        13Gi
# Swap:          31Gi          0B        31Gi

BE AWARE that typing this in carelessly can still booger your system if you are not careful. When I checked mine out, it was currently using the swapfile. So I had to fix that.

Safest of all routes is always to work on an inactive system. For this purpose the following sufficed:


When I got to the graphical login screen, I pressed Ctrl+Alt+F1 to get to a terminal login. (Pick a function key. They all have purposes but the first one will do just fine here. On another system you might have to start at F3.)

I then followed the commands listed above, first making sure that swapon -s did indeed report  0  under “Usage”.

You can choose how big to make your new swapfile. I made mine 32G just like the example. (I want to render some big scenes.)

When done, I typed reboot — just to be sure I had all my ducks properly lined up — and that’s it!

And now I can now render my fancy scene with all the objects with bazillions of vertices and stuff very happily.

You can have more than one swap area, so you could have both files and partitions for swap. Granted, one lump is simpler.

I never let installer to decide the partitioning, I can let it suggest, but I do customise. (The Red Hat's installer continues to make a partition for swap.) I also prefer to leave some of the disk unallocated, in case (i.e. for when) I want to install next distro (or whatever). That way there is no need to overwrite old partitions on install.
Yeah, I should have done that. I’m glad it turned out not to be problematic.

Resizing partitions is when the potential for data loss becomes worrysome, and I’d definitely want to do a defrag kind of thing first, just to make sure all the data is packed right at the front end of the partition before shrinking it any, and a full backup just to be sure.

But yeah, true that.
Pages: 123