Skip to main content

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.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
44 views

How to move files matching patterns from file?

I have a file storage directory used together with a MySQL DB. Some of the files in the directory are orphaned (i.e. created by mistake, deleted in the DB but not on disk, otherwise not used). I was ...
Anton Duzenko's user avatar
0 votes
0 answers
21 views

Bash Script that zips a directory as "cert_$date.zip", then upload the zip file with curl to external server

I have a folder that I want to zip a directory, then upload it to a web server with curl. Backup folder: /opt/ladapter/data Zip File: /opt/ladapter/cert_$date_ymd.zip Bash script: cert_script="#...
Europa's user avatar
  • 213
0 votes
0 answers
14 views

Wine not properly uninstalled [duplicate]

So i installed wine a long time ago, However its pretty heavy so i decided to uninstall it. However, There's still a wine folder in the x86 64 linux gnu Folder: thearchcoder@thearchcoder-HP-EliteDesk-...
OSEnjoyer's user avatar
1 vote
0 answers
32 views

Changing bash doesn't work

I'm using Starship, but don't get the proper changes, and I have to run the command bash just to see the starship terminal. I want this to happen by default. I also have Tmux, when I load that, it ...
Fizcakez's user avatar
-1 votes
0 answers
53 views

X11 DISPLAY Configuration for SSH and Nvidia Optimus Graphics

There are one Intel integrated graphics and the other Nvidia graphics card in my remote box, where OpenSSH and X11 servers run on Ubuntu Desktop 24.04. The graphics drivers and utils are installed ...
sof's user avatar
  • 495
-3 votes
1 answer
78 views

script does not work

I can successfully execute this command from the terminal: sudo cp -R -u "/media/gabriela/Windows/Data/Untitled Folder" /media/gabriela/USB But the following script does not work, with the ...
Gabriela Remow's user avatar
0 votes
2 answers
130 views

How to use asterisk (*) in bash array

I want to stored all command args in an array but it only works when all args have no any (*). Here is a test without using array: mkdir -p /tmp/hello echo "hello" > /tmp/hello/hello.txt ...
stackbiz's user avatar
  • 393
-2 votes
1 answer
89 views

Unexpected grep Messages During SSH Command Execution

When attempting to execute SSH commands on remote servers using grep within a Bash script, I encounter unexpected grep messages instead of the expected command output. error message : The issue ...
KaaaaaaaaaK's user avatar
-2 votes
1 answer
29 views

Transmission Remote List magnets/URLs

I use transmission remote terminal command and I want to re-create the current state of my torrent files in other computer using a bash script. I want to create a bash script that will list all the ...
Federico De Rocco's user avatar
-1 votes
0 answers
32 views

Ubuntu Login Loop because of $PATH problems

I need your help. I'm stuck with the Ubuntu Login Loop and I guess, it happened because I tried to add the PATH for Laravel to .bashrc. This went wrong and now I tried a lot to put into .bashrc, ....
Rastatux's user avatar
-1 votes
0 answers
29 views

My clickable .sh shell script keeps opening in text editor and does not run the command when clicked [duplicate]

I am trying to write a script that when clicked runs commands. For example: "open browser and go to website" etc. etc. Here is what I have done: I have ran chmod +x test.sh on the file I ...
F41k0r's user avatar
  • 1
0 votes
1 answer
72 views

bash: hash: hashing disabled

When opening a terminal window on Ubuntu 24.04, I get this message: bash: hash: hashing disabled Its caused by this line: [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" ...
Alexander Zeitler's user avatar
1 vote
1 answer
85 views

.desktop file not launching on double click

I'm having trouble getting my .desktop application to launch with a double click. I've created a .desktop file that runs a .bash script, and I've given all necessary permissions to both the .desktop ...
Dragon's user avatar
  • 11
2 votes
2 answers
500 views

How can I print the result of a comparison that uses "=~"?

I try to check whether there is a window with a certain title ("Enter password") in the list of windows. To understand whether my script works, I'd like to print the result of the comparison....
Julian's user avatar
  • 29
0 votes
1 answer
36 views

Shell script to get specific file names as string from particular directory which are modified before 1 day [closed]

I written shell script to get names of all the files that start with a certain name, as well as all the files that have been edited within the previous day. These file names should be assigned to a ...
Sanjay Surve's user avatar
-1 votes
1 answer
88 views

is there a default folder /etc/bin in ubuntu 24.04

I recently tried to move an executable to somewhere as part of the PATH and I accidentally renamed it and put it as /etc/bin instead of inside /etc/bin : sudo mv exec /etc/bin Now my /etc/bin is the ...
Kaki Master Of Time's user avatar
0 votes
0 answers
70 views

"Permission denied" even when trying to open file (/proc/sys/vm/drop_caches) as root

When I do cat /proc/sys/vm/drop_caches as root (sudo bash) I get this error: cat: /proc/sys/vm/drop_caches: Permission denied So how do I see the contents of that file? ()kswapd0 is running at 50% ...
neubert's user avatar
  • 221
0 votes
1 answer
70 views

Bash script doesn't work when used with keyboard shortcut, but works in the console

With the help of AI I made a script, which toggles between the two audio devices chosen by me. Since the name of the device changes on each system reboot, the script finds the devices by their ...
Ap0st0l's user avatar
  • 111
-1 votes
0 answers
39 views

Using Perl rename with minus sign

I am using the official Ubuntu verion of Perl rename. After batch renaming some files need a second round but I have problems with following remaining filenames: ' - <filename>' -- that is: ...
roelvdh's user avatar
0 votes
1 answer
65 views

Listing Folders and Files with the same name

I have a folder with extracted ZIP files in it. (Extracted ZIP folders are the same name as the ZIP file without ZIP in the folder name Example: File1.zip extracts to the file1 folder I need to show ...
Brian Jester's user avatar
5 votes
2 answers
437 views

Fake ext4 file creation dates for a large number of files by setting the system time

Recently, I downloaded a large number of photos from a cloud service to my local machine (Ubuntu 23.10). As is expected, the creation/birth date of those files was set to the actual download date. Now,...
junjios's user avatar
  • 152
3 votes
1 answer
143 views

How to use setfacl for adding the same permission

I found the setfacl from this link: https://stackoverflow.com/questions/39397548/how-to-give-non-root-user-in-docker-container-access-to-a-volume-mounted-on-the sudo setfacl -m u:$(id -u):rwx -R /some/...
stackbiz's user avatar
  • 393
0 votes
2 answers
66 views

Permission Denied Error When Cloning Cheatsheets with Cheat

I'm trying to set up cheat on my Ubuntu system. When I run the command to initialize the config file and download the community cheatsheets, I encounter a permission denied error. Here is the process ...
melvio's user avatar
  • 308
0 votes
1 answer
37 views

How to escape a GVariant dictionary in bash script

I'm writing a bash script to change the display scale: #!/bin/bash cmd="dconf write /com/ubuntu/user-interface/scale-factor \"{'DP-4': 7, 'eDP-1': 7}\"" $cmd The dconf command ...
macho's user avatar
  • 41
0 votes
1 answer
68 views

Commands in the same line with sshpass not recognized

I was running a script normally. But suddenly, all the commands in the same line with sshpass started being not recognized. For instance: sshpass -p "$password" rsync -a -e "ssh -o ...
Dimitris Tsiaousidis's user avatar
0 votes
0 answers
36 views

X session is not starting with the network disabled

I have an Ubuntu 22.04.4 installation with a Xanmod 15 khz patched kernel and bash startup and a tty1 override for a custom script launch. This script launches an X session with openbox plus a ...
albmm's user avatar
  • 1
0 votes
2 answers
101 views

Rename files by changing the position of strings

I want to renaming several files with names, such as: YL.BIRA..BHE.M.2001.324.210818.SAC I want to rename it as: YL.BIRA..M.2001.324.210818.BHE.SAC I would appreciate your help. Thank you!
Shiba Subedi's user avatar
6 votes
1 answer
707 views

Should I use the "time" keyword, the "/usr/bin/time" command or the "times" builtin to time the execution of commands in bash?

I have been delving into bash for the first time and want to try to test some code to compare different ways of achieving the same end. As part of this I have come across the time and times methods of ...
dmkonlinux's user avatar
1 vote
2 answers
630 views

"unknown option: --bash" when opening the terminal

Whenever I open the terminal, I get the following line as the first line in the terminal: unknown option: --bash Here is a screenshot of my terminal: Here is my ~/.bashrc file: # ~/.bashrc: executed ...
Harshal Chaware's user avatar
2 votes
1 answer
63 views

How to mount host directory and modify its contents inside the Docker layer

Here are the docker layers I want to implement: https://stackoverflow.com/questions/31222377/what-are-docker-image-layers I want to mount a folder from host to docker with: docker run \ -v /path/to/...
stackbiz's user avatar
  • 393
6 votes
3 answers
1k views

Can I get the location of bash before executing a script?

I have a stupid question. Can I get the bash location, such as "/bin/bash" or "/usr/bin/bash", before I execute the script? I tried to do this: #!`which bash` Or this similar ...
ilie alexandru's user avatar
4 votes
1 answer
430 views

Understanding the meaning of the + and - signs after completion of a task run in background

I am often running multiple tasks in the background by launching my commands as follows for ...; task...; done > log 2>&1 & When my tasks are done, I will receive in the prompt a ...
Thierry Grange's user avatar
1 vote
0 answers
56 views

Error reading CPU table when running `apt` inside a chroot environment on Ubuntu server

Following this question, I am trying to set up a chroot environment on my Ubuntu server running on a Raspberry Pi. Here are the steps I followed to create the chroot environment: mkdir -p myenv mkdir -...
Foad's user avatar
  • 893
0 votes
0 answers
47 views

Setting prompt using PS1 in a script puts cursor at beginning of line

I want to set the title and prompt in a command line window using the following command: PS1='\[\e]0;deploy\a\]\[\e[1;32m\]\u@\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\$ ' If it is entered interactively, ...
robin's user avatar
  • 1
1 vote
0 answers
27 views

Download file from TeamCity with SSO using bash

I need to download an artefact from TC using a bash script (it should work in Ubuntu 22.04.3 deb based server). TeamCity authentication mode is SSO only via MS account and 2FA authentication. Is it ...
NorrtT's user avatar
  • 11
2 votes
1 answer
96 views

Adding error handling to simple backup script

I have created the following simple backup script for my Ubuntu machine: #!/bin/bash set -e echo "Mounting network share" sudo mkdir -p /var/backup sudo mount -t nfs 192.168.178.33:/...
Boris's user avatar
  • 121
0 votes
0 answers
44 views

useradd: group '' does not exist when using -g to define primary group upon user creation

I'm following the exploratory exercises from https://learning.lpi.org/en/learning-materials/010-160/5/5.2/5.2_01/ and according to them this should work yet, when I try this on ubuntu 22.04 ,brand ...
Francisco Cortes's user avatar
0 votes
0 answers
33 views

Use netplan to have a failover wifi interface between two wifi adapters

I have two wifi adapters on my devices, one built in and the other requiring drivers. I use unattended upgrades and have been having issues when a kernel upgrade happens the drivers for the device ...
Charlie Smith's user avatar
0 votes
1 answer
95 views

ubuntu server 24.04 print [0.004s] or bash: 1716451538,009859: value too great for base (error token is "009859") each command

I've just installed ubuntu server 24.04 on bare metall. After each command terminal print "time" in square brakets: [0.004s] like [0.006s] andrey@bonanza-server:~/iso$ rm -r ./* [0.-55s] ...
andreykyz's user avatar
  • 780
0 votes
0 answers
66 views

Trying to concatenate 2 bash variables doesn't work

Trying to concatenate 2 bash variables doesn't work. I've got the following script: #!/usr/bin/env bash echo Backup WSL bdir=/mnt/f/wslbackup/ echo Backup Dir is $bdir rel=$('/mnt/c/program files/...
Rich Guagliardo's user avatar
0 votes
1 answer
61 views

Running multiple bash scripts at once

I've like 10 repos running in the same machine, I some times change machines and want to deploy them automatically and fast so I made this script to execute each repo installation file at the same ...
Mohamed Naser's user avatar
0 votes
0 answers
34 views

Existence of utility use distribution dataset?

I'm not sure if this is the right board to ask this. I'm curious if anyone has stumbled upon a dataset or study of terminal input distributions. Separation of data by fields such as general tasks or ...
jbrags42's user avatar
0 votes
0 answers
38 views

Unable to boot into GUI on Ubuntu, stuck at tty1

I'm encountering an issue with my Ubuntu system where it boots into tty1 instead of the graphical user interface (GUI) after startup. Here are the steps I've taken and the details of the problem: ...
Nirjhar Das's user avatar
1 vote
0 answers
31 views

Asus TP500LA screen flipping issues

A little while ago i manages to pick up a Asus TP500LA off the side of the road and installed Ubuntu 20.04.6 LTS onto it. works great but the screen doesn't flip when rotated 360 degrees. what i have ...
Matthew Williams's user avatar
0 votes
0 answers
26 views

Managing applications with different installers sources and automatic updates: solving the problem

At the same time different versions of the app are installed from different sources one version of the app is installed from flatpak, another from snap and the third from a third party ubuntu repo, i....
Ha-Nuric's user avatar
0 votes
2 answers
89 views

How to execute scripts from a samba drive (cifs mounted)?

If I'm starting a shell script "test.sh" from a samba share, I've got an error: bash: ./test.sh: /bin/sh: Defekter Interpreter: Eingabe-/Ausgabefehler (bash: ./test.sh: /bin/sh: bad ...
dschoni's user avatar
  • 97
6 votes
1 answer
331 views

`command echo --help` invokes bash internal echo function

According to help command, the help of bash, command can be used to trigger the external program x, if x exists as a builtin function too: command: command [-pVv] command [arg ...] Execute a ...
user unknown's user avatar
  • 6,825
0 votes
1 answer
85 views

bash/sed replace string of repeating string within a string

I have a file where each line represents data that may be encompassed with a string like "o o ". I need to replace the string between the encompassing characters with another string. The &...
SprRdHwk's user avatar
2 votes
1 answer
55 views

Remove /dev mount point without unmount in Host

Here is the unmount method for unmounting all previously mounted folders: https://unix.stackexchange.com/questions/61885/how-to-unmount-a-formerly-chrootd-filesystem I use the following command to ...
stackbiz's user avatar
  • 393
0 votes
1 answer
73 views

Bash script not launching correctly

Right now I am working on a project for which there is a custom conda environment. I created the environment and the project works, so I created a bash script to activate the conda environment, launch ...
Samuel Kostadinov's user avatar

1
2 3 4 5
226