Questions tagged [bash]

Bash is a free shell for Unix-like operating systems from the GNU Project.

Filter by
Sorted by
Tagged with
0 votes
0 answers
195 views

Permission denied error when trying to SSH through a script

I have a set of Bash scripts designed to establish an SSH connection from a local machine to a remote server through a middle server. The local script initiates a tunnel using socat, and the middle ...
FLSill's user avatar
  • 1
2 votes
2 answers
112 views

How to convert lscpu output to JSON format with no trailing spaces?

I tried to convert it to the JSON format by -J flag, but older lscpu versions have no such functionality. The solutions I've found here didn't help me. I want to put out here the solution I got from ...
palmasd1's user avatar
0 votes
0 answers
55 views

duplicate pane to show history in tmux

Sometimes, the output of a command is very long and thin, and my screen is much wider than it is tall. Is there any way to make a new pane which is a copy the current one, but more scrolled up so that ...
guest4308's user avatar
  • 167
3 votes
1 answer
323 views

Debian Bash Associative Array Self (Internal) Referencing

I'm attempting to contruct an associative array where key-value pairs within the array, reference other key-value pairs in the same array, using Debian Gnu-Linux 12.4, 22.12.3 and Bash 5.2.15. Example,...
njc's user avatar
  • 174
1 vote
1 answer
155 views

How to put more than one image by page using img2pdf?

I have a series of images (>100) that I want to print in a specific size, that size let me put 8 of the images in a page, but when running the next command I get one image by page. img2pdf *.png --...
rurickdev's user avatar
0 votes
0 answers
136 views

How to remove left-over files from an Homebrew installation

My current homebrew has its files installed in /opt/homebrew which is correct. However, I have several hundred leftover homebrew files in /usr/local/Cellar which are still symlinked to in /usr/local/...
Cliff Helsel's user avatar
2 votes
0 answers
85 views

Program is not interactive in NuShell

Some background Qemu has a wonderful feature, which allows you to connect its stdio streams to serial ports on the guest. This allows you to connect QEMU's stdio streams to a TTY shell on the guest ...
J-Cake's user avatar
  • 261
0 votes
0 answers
871 views

Bash - node: command not found when being run in a shell script

When trying to run a node command from a .sh script I get the error node: command not found, however I can see that node is installed, running node -v shows me my current version, what could be the ...
Danyx's user avatar
  • 101
0 votes
1 answer
323 views

docker login fails when done in .bashrc

At the end of my .bashrc file I have the following: docker login -u AWS -p $(aws --region us-east-2 ecr get-login-password) 636602586062.dkr.ecr.us-east-2.amazonaws.com However, whenever I open up a ...
neubert's user avatar
  • 7,122
0 votes
0 answers
33 views

How to stop backup being deleted as soon as it is completed?

Duplicity full backup via ftp completes, then is deleted, all with no user action. There are 2 things I would like to know; is there anything in the information below that explains this problem? ...
user avatar
0 votes
1 answer
227 views

google-chrome, when ran in the background through bash, still outputs errors, despite 2>&1 > /dev/null

When I run google-chrome 2>&1 > /dev/null & and then go back to the prompt and then visit a website with, say, an invalid cert, I still get errors output to my console's screen. eg. ...
neubert's user avatar
  • 7,122
0 votes
0 answers
50 views

Is it possible to use the signalstats YAVG filter in FFMPEG to control the gamma correction in a video?

I don't know if this is even possible, but something tells me it is… You see, I want to dynamically control the gamma correction in FFMPEG/FFPLAY depending on how bright/dark the frame being ...
tuqueque's user avatar
2 votes
2 answers
616 views

What is the command line shortcut to uncomment a previously commented line?

Alt+Shift+3 can only comment out, on subsequent invocations simply adding multiple comment characters (hashes) instead of toggling on / off the comment. How to uncomment a previously commented line or ...
mirekphd's user avatar
  • 147
0 votes
1 answer
95 views

Output of atool -l for large archives

The command atool -l my_archive prints the directory structure and files of my_archive to the command line. This is very handy if the archive contains only a few files. However, if there are many ...
Syd's user avatar
  • 1
2 votes
2 answers
164 views

Debian Bash Readonly Associative Array Error Redirection

I've declared a readonly associative array in a script file on Debian Gnu/Linux (version 12.4). As with a readonly variable, error redirection is easily done as such, readonly AQUA_FG="$(tput ...
njc's user avatar
  • 174
2 votes
1 answer
241 views

How to Print, when columns have spaces - awk?

Problem: desired columns have text with spaces SAMSUNG MZNLN128HCGR-000H1 undesired columns have text with spaces, see VENDOR = M.2 SSD awk only printing the first word. awk not printing the column ...
joseph22's user avatar
  • 357
0 votes
1 answer
66 views

What command to force dd output to a fixed width of 90 characters?

using: neofetch --stdout |grep 'OS:' OS: Kubuntu 22.04.3 LTS x86_64 dd --version dd (coreutils) 8.32 Background: re-purpose a disk = objective some script is being developed some script will delete ...
joseph22's user avatar
  • 357
1 vote
1 answer
50 views

GNU "parallel" how to achieve tee behaviour

Is it possible to use gnu-parallel to run multiple commands which all read from stdin? For example: echo 'hello world' | parallel --keep-order --tagstring 'Part {=$_=uc($_)=}:' --pipe "cat" :...
smac89's user avatar
  • 398
0 votes
1 answer
42 views

How do I tell sed to stop trying to process commands?

Maybe I'm an idiot (this is the likely scenario, and I'm new to sed/bash scripting), but why does this work: NewVersion="$(echo $NewVersionFile | sed 's/^.*-\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/')&...
sirphillystax's user avatar
1 vote
1 answer
209 views

Shell command to tar directory excluding certain folders

In Bash 4, I want make a tar.gz with excluded folders, and while tons of answers about this simple case exist, nothing works in my case. I would like to keep the directory mentioned in exclude, ...
VOX's user avatar
  • 13
0 votes
1 answer
54 views

can Clear-Content be equivalent to bash 'truncate'?

This could be off-topic, if so my apologies; please re-direct me to the correct StackExchange site.😉 Can Clear-Content file.log be used in Powershell, on a Windows Server environment to empty a ...
WobblyWindows's user avatar
0 votes
1 answer
33 views

Using mlocate to search on multiple systems in parallel

I often need to search files on different systems, without knowing on which system the file I'm looking for is located. Is it possible to search with mlocate on multiple systems in parallel? By ...
Chris9834's user avatar
1 vote
1 answer
159 views

Why is this tmux option not persisting?

I would like to generate a bashrc configuration file each time I start a particular tmux session, and I want to use my user's default tmux configuration file ${XDG_CONFIG_HOME}/tmux/tmux.conf as well. ...
ardnew's user avatar
  • 260
1 vote
1 answer
256 views

What's the difference between git-bash.exe and bash.exe and how they interact with Windows Terminal?

I've installed Git for Windows. I want to run git-bash in a Windows Terminal tab. I initially configured a git-bash profile, in Windows Terminal, whose Command Line field I populated with C:\Program ...
StoneThrow's user avatar
  • 1,177
0 votes
1 answer
886 views

"ls: cannot open directory '.': No such file or directory" in Git Bash (in VS Code terminal)

I am working in a Git Bash terminal within Visual Studio Code. For some reason, when the behavior of the terminal changed so that if I execute ls, the result is ls: cannot open directory '.': No such ...
Paul Wintz's user avatar
0 votes
1 answer
86 views

Overwrite bash alias for git pull to include --recurse-submodules

Neither functions seem to affect anything for me? Is anyone able to get them working and show me what I'm doing wrong? I'm trying to override git pull to include recursive submodules whilst keeping ...
P1000's user avatar
  • 1
0 votes
2 answers
174 views

Echo the exact command used to start a Bash script

I'd like to give feedback to the user of a bash script along the lines of "You've run the following command <exact command the user entered>, better to run it like this <better command&...
Johannes Bauer's user avatar
0 votes
2 answers
81 views

How to force declare -f to respect semicolons

Given the function hello () { echo "one"; echo "two"; } Inside a script I'm using cmd="$(declare -f hello); hello" then I try executing the command using bash -c $cmd, ...
weshouman's user avatar
  • 243
0 votes
0 answers
303 views

Bash Script to Detect Monitor

I am trying to write a bash script to detect a monitor. I was able to find it with Xrandr but am not sure if this is the right method and unsure how to get the terminal to open in designated monitor. ...
user avatar
0 votes
1 answer
150 views

How to convert code from test format to if fi format?

I have code that opens a bash file in a terminal for entering the sudo password: test "$IN_TERM" || { export IN_TERM=1 konsole -e "$0" exit 0 } && true I need ...
moninah's user avatar
  • 35
0 votes
1 answer
57 views

Tmux conf returns error at start

I ssh to a remote server with TMUX. The .tmux.conf file is very simple: setw -g mode-keys vi set -g status-right '#(TZ=Asia/Kolkata" date +"%%Y-%%m-%%d %%H:%%M")' And the relevant ....
cat's user avatar
  • 3
3 votes
0 answers
177 views

Is there a good way to write a shell script compatible with both bash and zsh that addresses array elements?

The fact that bash is 0-indexed and zsh is 1-indexed can cause problems. For example the following will work as intended with bash, but not zsh (PS I am aware that I don't NEED to use an array for ...
Stonecraft's user avatar
0 votes
0 answers
132 views

How to run sh script in lxterminal using double click on Raspbian

I've read so many threads regarding running a script using double click, but none of the ways describes my case. My operating system is Raspbian Bookworm (Debian), the graphical shell is LXDE and the ...
Michal's user avatar
  • 11
0 votes
1 answer
160 views

linux terminator: configure a command on startup and don't close terminal when the command ends

I'm using terminator con Linux, and I have configure my ~/.config/terminator/config file to start at specific folders running certain commands I added a ; bash (also tried with ; bash && bash |...
opensas's user avatar
  • 305
0 votes
1 answer
47 views

Bash readline command of scrolling terminal lines up/down

What is the Bash readline command, ie. the phrasal words command, of scrolling terminal lines up/down with shift - Page up/down How to have all complete Bash readline commands (that are used by ...
itil nonok's user avatar
1 vote
0 answers
55 views

With 7z-bash, how can I extract specific filetype but keep folder structure? [closed]

As it is right now you can recursively extract files via command parameters, and filter files by type. But if you add a filetype filter they will be extracted into the destination folder. 7z.exe x &...
reYal's user avatar
  • 11
0 votes
0 answers
146 views

Can't access remote port 81 despite netstat showing it bound

I have an apache server with multiple VirtualHosts filtered by the ServerName directive. I am now attempting to have a VirtualHost filtered based a seperate port number, but am having issues. My ...
user10709800's user avatar
0 votes
1 answer
108 views

Is it possible to manipulate shell input to wrap commands?

I would like to call a function when a command is entered and modify it for example if a user enters this command touch foo.txt I want to manipulate it to run sudo -u user touch foo.txt The reason ...
phper's user avatar
  • 105
1 vote
0 answers
42 views

Why codium (vscode fork) doesn't autoclose quotes?

this is my first time using codium (vscode fork) after using atom for a while, I have installed several bash extension to enhance my shell scripting adventure, but I found that I'm unable to auto ...
Liso's user avatar
  • 69
1 vote
1 answer
347 views

Symbolic Link not working in sub-directory?

Newbie here. I was learning about ln command. So I created a symlink to a file foo.txt inside another directory bar. ln -s foo.txt bar When I try to access bar/foo.txt, I get the error "Too many ...
GrandeKnight's user avatar
0 votes
0 answers
34 views

How to determine current mozc input mode in bash (command line)?

I'm using ibus-mozc and trying to determine which input method is currently set: Direct Input or Hiragana. Is it possible to determine it via command line? Any workarounds also will be helpful For ...
rzlvmp's user avatar
  • 216
2 votes
2 answers
114 views

Replace Template String with Current Date and Time in Vim

I have a template file with the following string: {{date}} {{time24}} Some text. I want to replace {{date}} {{time}} with the current date and time on a keymap. I currently have: :nnoremap <leader&...
T H Wright's user avatar
0 votes
0 answers
22 views

How to output disk size in GB only with no rounding error? [duplicate]

Output disk size in GB only. Giga Bytes only. Not MB. Not Mega Bytes. Not TB. Not Tera Bytes. Tested thus far: sudo blockdev --getsize64 /dev/sda 1000204886016 sudo blockdev --getsize64 /dev/sda |...
joseph22's user avatar
  • 357
0 votes
1 answer
98 views

How to output disk size in GB only with no rounding error?

Output disk size in GB only. Giga Bytes only. Not MB. Not Mega Bytes. Not TB. Not Tera Bytes. Tested thus far: sudo blockdev --getsize64 /dev/sda 1000204886016 sudo blockdev --getsize64 /dev/sda |...
joseph22's user avatar
  • 357
0 votes
0 answers
743 views

Can't use ethtool | bash: ethtool: command not found

https://imgur.com/a/lM6H1v5 https://imgur.com/a/gnrydo4 I have Gigabit Ethernet on my phone and another PC(Windows), however on that one where I have Debian 12, it doesn't work. I have tried to ...
AlexPristok's user avatar
2 votes
1 answer
1k views

"set editing-mode vi" vs "set -o vi" What is the difference?

On multiple forums I have come across adding set -o vi to my .bashrc file. Today I saw the option of adding set editing-mode vi to .inputrc. I googled and both appear to do the same thing. Are there ...
Ishaan Kapoor's user avatar
1 vote
1 answer
162 views

Pipe in argument list of bash function

I'm using simple function to make my script more verbose. cmd() { echo "[#] $*" >&2 "$@" } When calling script with option -v all commands goes through cmd function: ...
yar83's user avatar
  • 13
0 votes
1 answer
282 views

awk string replacement - properly escape '&' character

I am working on one of our applications to update the docker image from using static configs for each environment to a single template using dynamic variable insertion with awk. Our Dockerfile calls a ...
kat.is.konfused's user avatar
0 votes
0 answers
91 views

While invoking bash without options -c or -s the first argument is a filename, how to execute it sourced? [duplicate]

While invoking bash without options -c or -s the first argument is a filename (see manpage bash). In such a case bash executes that file and exits. I just need this feature, yet that file has to be ...
Anton Wessel's user avatar
0 votes
0 answers
76 views

Using ffmpeg and concat demuxer producing weird video navigation behaviour

When combining multiple videos segments, each encoded with H265 and Vorbis and containing the same number of streams and frame rate, I use: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mkv ...
user112346's user avatar