I found a solution to my problem, posting it here!
My file manager is Caja, and I am running Ubuntu-Mate.
In this website I found them asking me to make a file named 'open-terminal-here'
in the folder '.config/caja/scripts/'
. But I saw that this folder is already there in my computer and the same text they asked me to write is written there too.
#!/bin/sh
#
# This script opens a gnome-terminal in the current directory.
#
# Distributed under the terms of GNU GPL version 2 or later
#
# Original author: Keith Conger <[email protected]>
#
# Sourced from
# https://forums.linuxmint.com/viewtopic.php?p=773382&sid=9939ce160bd97313f849367231eb721a#p773382
# http://g-scripts.sourceforge.net/nautilus-scripts/Execute/Open%20terminal/terminal-here
#
# Put this file in your ~/.config/caja/scripts/ directory.
# You need to have caja-actions installed to use scripts.
cd $CAJA_SCRIPT_CURRENT_URI
exec gnome-terminal
Then as suggested in the next step I went to folder '.config/caja/'
and opened the file named 'accels' using vim(or any other editor) in this file I could see the line about making a shortcut to open terminal in current directory and I was surprized. Here in this file all lines starts with a semicolon(;), and I learnt that that means it is a commented line.
So I found this line
; (gtk_accel_path "<Actions>/ScriptsGroup/script_file:\\s\\s\\shome\\sUSERNAME\\s.config\\scaja\\sscripts\\sopen-terminal-here" " ")
*username will be your username
and removed the ':' and space at the end of the line
Now, inside the bracket in the second quote, I put the shortcut I needed.
I used "<Shift>F4"
(this is because I am used with it from Opensuse)
now, the line looks like this:
(gtk_accel_path "<Actions>/ScriptsGroup/script_file:\\s\\s\\shome\\sUSERNAME\\s.config\\scaja\\sscripts\\sopen-terminal-here" "<Shift>F4")
While saving this file, I had no problem. But I kept caja all processes killed while doing this using the commands
pkill -KILL caja
killall caja
I used both since I was not sure which will work better.
However, from the previous post I mentioned it seems like some people will still have problems editing the file, it gets rewritten automatically. In that case, try to follow the steps explained here in this page. At some point, I think I have also used it, in the beginning, I was able to save changes properly.
Now, technically the shortcut is written and it should work, but it was not :(
I realized that the file we made in the scripts folder 'open-terminal-here'
is supposed to be an executable initially. However, I forced to make it an executable again by running the command
chmod +x .config/caja/scripts/open-terminal-here
Now, just for curiosity I tried to run this executable from my home folder from the terminal. So, I have the executable 'open-terminal-here' in the folder '.config/caja/scripts/'
. now I just ran
.config/caja/scripts/open-terminal-here
It tried to run it, but showed an error which became the final solution to my problem. It was telling me can't find 'gnome-terminal'
!
Then I checked top to see what program is running while my terminal is open and it says it was mate-terminal. So, I went straight back to the file '.config/caja/scripts/open-terminal-here'
and edited the last line to
exec mate-terminal
NOTE: previously it was gnome-terminal by default
and now I tried my shortcut in any folder, and it works well!!