Executing alias commands in newly opened Tabs
You could try switching from an alias to a function in your .bashrc
. According to bash's documentation, functions are better than aliases for most situations. In your situation, since you're not running bash as a login environment, it might work better. Add this to your .bashrc
and comment out the alias:
router4() {
/usr/bin/ssh root@172.16.17.4
}
If that doesn't work on its own, you could try adding export -f router4
in your .bashrc
after defining router4.
I want to write a bashrc alias that launches commands in multiple new terminals
You can try:
gnome-terminal --tab -e "psql mydb" --tab -e "Jupyter lab" --tab -e "metabase"
How to open a new tab in GNOME Terminal from command line?
#!/bin/sh
WID=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}')
xdotool windowfocus $WID
xdotool key ctrl+shift+t
wmctrl -i -a $WID
This will auto determine the corresponding terminal and opens the tab accordingly.
open gnome terminal tabs programmatically and execute commands in sequence
Ok, I think i get it. As i mentioned in the comments the first thing that comes to mind for reaching your school desktop from the outside is to ssh into the school gate and from there ssh into your desktop with something like:
$ ssh -t gate.school.edu ssh desktop_name
There's only one tab then, so your problem doesn't exist.
However there's something very cool with your current setup:
From home it's almost as if you had a direct connection to your desktop machine, so you can scp
into it directly and forget about gate. With the solution above that's not possible anymore because we end up with an indirect connection: If you want to scp you have to do it from gate and that sucks.
Check out this article on using ssh's ProxyCommand feature:
- Transparent Multi-hop SSH
You get the best of both worlds then :)
Run script in new tab in gnome terminal
The reason that:
gnome-terminal --tab -- '/bin/bash -c "ls";bash'
Fails is that it is looking for a program with that as its name. This is an instance of chain loading where the rest of the arguments are passed as is to exec. Those first argument is the name of the program. With this quoting it receives the entire command and options as a single program name.
Change the quoting to:
gnome-terminal --tab -- /bin/bash -c "ls;bash"
Open gnome terminal new tab in current folder with git prompt command
function set_git_prompt() {
__git_ps1 "\u@\h:\w" "\\\$ "
[ $VTE_VERSION ] && __vte_prompt_command
}
if [ -f /etc/bash_completion.d/git-prompt ]
then
GIT_PS1_SHOWCOLORHINTS='yes'
GIT_PS1_SHOWDIRTYSTAT='yes'
GIT_PS1_SHOWSTASHSTATE='yes'
GIT_PS1_SHOWUNTRACKEDFILES='yes'
GIT_PS1_SHOWUPSTREAM='auto
PROMPT_COMMAND='set_git_prompt'
fi
Related Topics
Pipe Tar Extract into Tar Create
Awk Command to Create Sha2 of Individual Column and Paste into New File
How to Schedule a Cron for The First Thursday of Every Month
What Is The Mutex Acquire and Release Order
Downloading a Tarball from Github Without Curl
Configuring Tomat's Server.Xml File with Auto Generating Mod_Jk.Conf
How to Solve Ssh: /Usr/Lib64/Libcrypto.So.10: No Version Information Available
How to Setup Virtualhosts to Point Two Ports on Same Ip to Different Servernames
Munin Dynamic Graph Zoom (Dynazoom) Not Working (Centos6,Nginx,PHP-Fpm)
How Does The Os Know Disk Address of an Absent Page
How Does Ltrace() Display Rand()
How The Buffering Work in Socket on Linux
How to Include Debug Information with Nasm
How to Couple Xargs with Pdftotext Converter to Search Inside Multiple PDF Files
Read Performance Counters Periodically in Linux