Questions tagged [bash]
Bash (Bourne-Again SHell), is the default interactive user shell used in Ubuntu. Use this tag for questions specific to Bash, as opposed to generic POSIX shells.
2,199
questions with no upvoted or accepted answers
11
votes
3
answers
1k
views
Can bash get out of sync with the filesystem?
I may not be phrasing my question correctly, but I'll do my best to explain the symptoms I'm experiencing. First, for context, I'm running an Ubuntu server (no GUI), version 12.04.3 LTS (according the ...
7
votes
0
answers
5k
views
System freezes during Bash auto-completion with Tab or Ctrl+R
It started about a week ago, don't know why. Now, when I type something like cd somedir and click Tab, my system completely freezes for about 10 seconds. I can move the cursor but can't switch between ...
6
votes
0
answers
101
views
Show progress in nautilus for custom script
I'm using ubuntu 19.10 without any modifications and I got a couple scripts set up so I can execute them with the contextual right click menu.
The thing is, once they are going, they are completely ...
6
votes
0
answers
1k
views
Why did an rm command executed from a pwd NOT / remove directories from it?
OK, so I've been doing different levels of sysadmin for almost a decade and yet I fell victim to an age old mistake; though I do not understand why it happened.
I was in my server sorting through ...
6
votes
1
answer
2k
views
How to configure case insensitive completion for git in bash?
I use Ubuntu 16.04 for web development. Its default shell is bash. I use git for source versioning. I would like to have git branch names with case insensitive completion. At the moment, completion ...
5
votes
0
answers
2k
views
Preserve colors in console of a Bash script output while logging
I would like to preserve colors, in console, of a Bash script output, while logging and echo it to console.
When I run a script with the following code, I lose colors in console.
LOG_FILE="Merge....
5
votes
0
answers
730
views
Delayed jobs in crontab
My OS is Ubuntu 18.04.3 LTS. I have 2 crontab jobs scheduled to run every morning at 4:00 a.m. and 4.05 a.m.
00 4 * * * sh /home/developer/script/batch_load1.sh >> /home/developer/script/log/...
5
votes
0
answers
837
views
Why are /root/.bashrc and /etc/skel/.bashrc different on a vanilla install?
I noticed on a new Ubuntu 16.04 install that my root user's .bashrc differed slightly in behavior from a new user I had just created on the same box.
From what I can find, the root user's .bashrc ...
5
votes
2
answers
7k
views
-bash: cd: HOME not set
Today when I logged into my server via SSH as I have been doing for the past 6 months,. However, I now receive this error message any time I run a command that makes reference to the $HOME environment ...
5
votes
1
answer
414
views
Ubuntu touch and cron jobs
I created a script to enable flight mode at night and disable it in the morning. I'm adding checks to avoid enabling it if there is phone of web activities.
The script has been added to cron (5 minute ...
5
votes
0
answers
2k
views
How do I force nmcli to reconnect to different uuid?
I have a bash script that checks my network environment and mounts shares accordingly. If I'm at work and have a hard-wire connection to the LAN, then I'd like to activate a hotspot connection for ...
5
votes
1
answer
5k
views
Cursor positioning using mouse in bash possible?
In Vim I can actually position the cursor in insert-mode using the mouse. So I assume this should (technically) also be enable-able for the bash. Is it possible? This would be quite useful at times ...
5
votes
0
answers
2k
views
How can I create an X server that has a backing store?
So I am completely new to Ubuntu (I am running 12.04 on a Toshiba Satellite). I am trying to remotely access my work computer but I keep getting an error reading:
"xevas: requires a X server that ...
4
votes
1
answer
1k
views
tmp directory in $HOME with behavior like /tmp
TL;DR: How can I set up either via a bash command executed as user or a bash command executed only once as sudo a temporary directory in $HOME which has the same behavior as the global /tmp directory?
...
4
votes
1
answer
248
views
Nautilus script that creates a password protected ZIP
In the latest versions of ubuntu, right clicking on a file doesn't give you the possibility to create password protected archives (see this question). I still need to do that kind of things though so ...
4
votes
0
answers
5k
views
Are there file-naming conventions for .cron and .systemd extensions?
I'm starting to rename all my existing bash scripts in /home/Me/bin and /usr/local/bin from no extension to a .sh extension. The reason is the exact same file name with drastically different contents ...
4
votes
0
answers
447
views
GNOME Terminal Title as Number/Position of the tab
Searched and not found here. So posting it as fresh question.
Usage:
GNOME Terminal Version 3.4.1.1
Ubuntu 12.04
I used to open multiple tabs in GNOME Terminal. If the count is less then 4 or 5 I ...
4
votes
0
answers
2k
views
fswatch | while read | xargs running command twice
Thanks in advance for any advice
I'm working on an fswatch command to launch a script when files hit the Downloads folder.
fswatch --event Created Downloads/ | (while read x; do echo $x | xargs -0 ...
4
votes
1
answer
587
views
Can I set up a cron job on Ubuntu Phone
I've been looking around, and can't find if Ubuntu Touch can run cron.
So my question is: Can it?
Also does it have a standard set of bash utils installed?
4
votes
1
answer
3k
views
I have problem while opening terminal
When I try to open a Terminal, it shows me this error:
There was an error creating the child process for this terminal.
getpt failed: No such file or directory.
with these two buttons:
profile ...
4
votes
1
answer
1k
views
Terminal Closes Immediately on Open 14.04
I tried to follow other answers on here that I found but I cannot stop my terminal from closing as soon as it opens on Ubuntu 14.04 LTS.
Here are my profile files.
.bashrc
.profile
/etc/bash.bashrc
/...
3
votes
0
answers
81
views
Making an ISO from a dvd once it's inserted
I'm trying to make it so that when I insert a dvd into the cdrom It exports it into an iso using dd. Here's the script for exporting to an iso
#!/bin/bash
timestamp=$(date +"%Y%m%d_%H%M%S")
...
3
votes
0
answers
403
views
How can I update to the latest bash in Ubuntu 22.04.3 LTS?
I am using mcfly (https://github.com/cantino/mcfly). There is a known bug in bash version 5.1 (https://github.com/cantino/mcfly/issues/240, https://lists.gnu.org/archive/html/bug-bash/2022-03/msg00019....
3
votes
0
answers
549
views
Why does this bash script generate Exit code 2 in i3block?
I used this bash script for i3block, but I get Exit code 2:
#!/bin/bash
sink=$(pacmd list-sinks | grep '* index:')
if [[ "${sink:11:11}" -eq "1" ]]
then
echo 'usb'
else
...
3
votes
3
answers
3k
views
How can I view the stdout / stderr from the bash login shell?
I'm trying to debug a strange issue with my ~/.bash_profile, and I'd like to be able to see if there are any errors / etc printed when it's run. Is there some log or such somewhere that contains the ...
3
votes
0
answers
629
views
How to automatically send screenshot to someone on Telegram
I want to send screenshots automatically to someone as soon as I capture my screen. I can use telegram-cli to send the screenshot but I can't figure out that how can I chose the photo on my clipboard ...
3
votes
1
answer
104
views
Bash script runs more than one times. Dont know why
I have a really simple bash script which runs as cron job every minute. It makes a log to file. Everything works fine but there is one weird thing. The script make more than one logs at the same time. ...
3
votes
0
answers
943
views
Using different browsers to open links in different apps
I'm using one app (firefox) for personal things and want to have that as my default browser. For my work, I use google chrome and I want the links from my work chat (rocket.chat) to open in chrome. I ...
3
votes
0
answers
348
views
How to make 'notify-send' work in a script that is ran by NetworkManager dispatcher?
Code:
#!/bin/bash
sleep 2
DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION
XDG_RUNTIME_DIR=/run/user/$(id -u)
DISPLAY=:0.0
notify-send "Connecting..."
Also tried:
#!/usr/bin/env bash
sleep 2
...
3
votes
0
answers
2k
views
Unable to set/reset IFS
I have Ubuntu 16.04.6 (Edit: Now updated to 16.04.7), with bash 4.3.48(1)-release (x86_64-pc-linux-gnu).
I am not able to set/reset my IFS variable. I have tried to set is using the literal CTRL+V ...
3
votes
1
answer
7k
views
How to run multiple commands in multiple terminals using single shell script command
I have tried to write a shell script to run multiple commands in multiple terminals, but I am not able to run the commands. I can only open multiple terminals.
This is written in a shell script file ...
3
votes
0
answers
241
views
why is if statement working on terminal but not as script
I am trying to make a script that checks if a service is running (sickchill in this case) and if not start it with systemctl.
My code is working as intended if I execute it from the terminal, but when ...
3
votes
0
answers
270
views
Not able to run portable chrome .desktop opening in text editor
I installed portable chrome using https://github.com/shivamgly/Google-Chrome-Portable-maker-for-linux this link I am not able to run this chrome. Chrome.desktop file opens in text-editor.
Screenshot ...
3
votes
0
answers
356
views
How to check what type of resources a server is running out of?
It is quite possible to research specific Linux/Ubuntu/Bash error messages (for example 'Cannot fork') and see what type of resource the server may be running out of.
However, this question is to ...
3
votes
0
answers
1k
views
History timestemp shows wrong dates
when running the commands
HISTTIMEFORMAT="%d/%m/%y %T "
history
the date output are wrong. For example the sudo reboot in line 1407 was done on 31/12/2019. I am not sure about the hours.
How can I ...
3
votes
0
answers
1k
views
Tab auto-completetion not working when executing python scripts
Tab auto-completion/double pressing tab does not show files or autocomplete file, only showing folders while executing python scripts with argparse arguments.
Expected behaviour:
python ~/scripts/...
3
votes
0
answers
540
views
Wait for tmux session to exit abd execute command
I have gameserver running in a tmux session and I want to make a script that automatically restarts the server.
The scheduling can be done with cron from what I've read.
The script sends keys to the ...
3
votes
0
answers
133
views
Opening applications with random theme
I'm using Canvas GTK theme and have all colors of that theme on my system.
I want to use one of those Canvas themes randomly each time I open an application.
I know I can use env GTK_THEME to open ...
3
votes
0
answers
2k
views
PPAs for updated bash and zsh shells
I would like to use newer versions of bash and zsh.
I've searched google for:
site:launchpad.net bash "ppa"
I've also searched at: https://launchpad.net/ubuntu/+ppas?name_filter=bash
Doing the ...
3
votes
1
answer
340
views
Bash auto_complete .out error
I am using a customized dotfiles from a github repo. When I am trying to execute a c++ executable named a.out and try to use TAB Key after a.out (for arguments), I get the following error:
bash: a....
3
votes
1
answer
4k
views
i want to install specific version of go programming language(1.7.5 ) in ubuntu 16.04
wget https://storage.googleapis.com/golang/go1.7.5.linux-amd64.tar.gz
extract the package
sudo tar -zxvf go1.7.5.linux-amd64.tar.gz -C /usr/local/
Added by Go Path
echo 'export GOROOT=/usr/local/...
3
votes
1
answer
247
views
Install software that uses a different shell
I would like to install cryoSPARC, and looking through the readme it looks like this program requires that the user use bash as their default shell. At the moment I'm using tcsh, and have built up a ....
3
votes
0
answers
11k
views
chroot: failed to run command ‘/bin/bash’: No such file or directory
To fix grub, I tried following codes:
sudo mount /dev/sd6 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/...
3
votes
0
answers
624
views
why won't some custom keyboard shortcuts work?
GNOME Shell 3.26.2 | Ubuntu 17.10 | Bash 4.4.12
I have tried setting xclip -o >> ~/directory/filename.txt as a custom keyboard shortcut to no avail. I have tried setting it to multiple key ...
3
votes
1
answer
18k
views
Job for NetworkManager.service failed because the control process exited with error code
I am Running Ubuntu 16.04 KDE. See this for specifications.
$ uname -a
Linux ElMaverick 4.4.0-112-generic #135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/...
3
votes
1
answer
1k
views
installing ubuntu-restricted-addons from script
I have a post-install script I use to install a few packages after a vanilla Ubuntu 16.04 LTS installation.
One of these packages is ubuntu-restricted-addons. I wold like to be able to install this ...
3
votes
1
answer
402
views
Terminal shows strange characters where is computer name
I have ssh'ed to other computer and terminal showing strange character where is computer name and time. Bash version 4.3.48(1)-release.
What should I do to fix that issue?
3
votes
0
answers
2k
views
Xsession: .xsessionrc is not executed in Ubuntu 16
I have .xsessionrc for fixing Ubuntu's mouse acceleration issue.
I have been running Ubuntu 16 for a while and ~/.xsessionrc started on login properly on but recently it stopped doing it.
Nothing ...
3
votes
0
answers
7k
views
apt-get reinstall all packages
I was facing some problems with my system, after executing:
sudo chroot aditya:aditya /*
Instead of executing:
sudo chroot aditya:aditya ./*
So I wanted to reinstall the system.
But before I ...
3
votes
1
answer
1k
views
get sh to execute the commands inside from a PDF compiled with LaTeX
I have a solution of a PDE in an executable file called demo_poisson, which I can double click to get the window to open and show the graph of the solution. I think it works with VTK but I'm not sure. ...