Questions tagged [bash]
Bash is a free shell for Unix-like operating systems from the GNU Project.
11,695
questions
0
votes
0
answers
15
views
merge numbered files from different directories into same directory in correct order
I have some directories named FOO and BAR and etc. that have files in form
FOO/
1.png
...
18.png
BAR/
1.jpg
...
12.jpg
...
and I would like them to be all copied into the DESTINATION directory ...
0
votes
1
answer
32
views
Broken pipe, write error: An epidemic of unnecessary output
In the last few months, a problem has been spreading across my systems. That of broken pipe errors:
# Solution:
# silenced by replacing /bin/bzip2 -> bzip2-reference
# to /bin/...
1
vote
0
answers
35
views
What's a good way to encode a file name for caching a video thumbnail?
I'm writing a previewer script for lf using chafa to display preview images as sixels.
I'm writing the part of the script for previewing videos, and decided to just display the first frame of the ...
0
votes
2
answers
28
views
An incorrect path is displayed in my custom command line prompt in bash
I would like to display the current and parent directories in my Linux command prompt. For example, if the current directory is /home/user/proj/src, I'd like the prompt to display proj/src.
I found ...
0
votes
0
answers
13
views
Arch linux: How to exclude files from subfolder while using rsync for copying
I wanted to make a copy of files from one directory (folder "test2") to another directory (folder "Destination") while using rsync in linux console. The only problem? I want to ...
2
votes
0
answers
39
views
Why my terminal throws control characters while using arrows in mysql-client?
I have a situation with remote servers (all Debians) where I get control chars into mysql-client command line when I try to search in history (CTR+R) and try to make the first move:
mysql> update ...
0
votes
0
answers
11
views
Set terminal color without having bash history look wrong? [duplicate]
A site suggested I wrote the below to set the color of my terminal in `~/.bashrc
export PS1=`printf "\033[32m$ \033[39m"`
If I log in through ssh, press up, home, up text will be garbled.
...
0
votes
2
answers
64
views
How to output a bright Green check mark?
OS: Kubuntu 22.04.4 LTS x86_64
to display above:
neofetch --stdout |grep 'OS:'
Terminal or bash script:
printf '\u274c\n' # works fine. Bright red X.
❌
printf '\u2714\n' # outputs a check mark, ...
0
votes
1
answer
28
views
The last command output in linux for reboot is not giving the uptime instead it says still running twice
[root@localhost test]# last -x reboot -s -30days
reboot system boot 5.14.0-325.el9.x Sun Mar 10 10:51 still running
reboot system boot 5.14.0-325.el9.x Tue Mar 5 03:05 still running
In the ...
-1
votes
0
answers
56
views
notify when terminal output added
It would be helpful to know if there's a way to get notified e.g. a sound, or better a notification popup, when a line is added to the terminal output.
e.g. while true; do; sleep 5; echo "notify&...
0
votes
0
answers
18
views
How to make a script to launch different scripts in different workspaces in linux?
I have limited access to a linux machine, meaning I cannot install any external tools. I want to make a script to open terminals with ssh at different workspaces. However, I found that one way to move ...
0
votes
0
answers
13
views
How do I change the current user contact icon in macOS 13.4.1?
I want to make a script for macOS 13.4.1 that changes the current users contact photo (or whatever is displayed on the lock screen when you log is as them) to a specific one.
However I want to be able ...
2
votes
1
answer
48
views
How can I use the last changed file as an argument in linux?
I'm thinking of using the last changed file as an argument to commands like ls, echo, or cat, is there a simple and efficient way? this question arose when I was faced with analyzing the latest log ...
0
votes
1
answer
75
views
How to tell if SIGWINCH has been activated in bash
I am trying to get it to were if the window size changes in the terminal it redraws a box. I am unsure of how to catch this signal, the documentation I was able to find online was not particularly ...
10
votes
4
answers
3k
views
How to achieve side by side output in Bash?
I have a script, let's say it's this (obviously, my real one is much more complicated):
echo A
echo a
echo B
echo b
echo C
echo c
echo D
echo d
Is there an easy way to have the lines side by side?
A ...
1
vote
2
answers
53
views
How can I sort my file by date if there are different number of spaces between the name and date?
How can I sort my file by date if there are different number of spaces between the name and date?
My example file:
Ivanov 03/01/1980
Petrov 10/05/1992
Sidorov 21/07/1985
Kovtun 15/...
0
votes
3
answers
64
views
Replace X linebreaks with comma and delete every Nth linebreak
I have records in a text file formatted in the following way:
Record1
Record1
Record1
Record1
Record2
Record2
Record2
Record2
...
I need to convert this file to CSV by replacing the first 3 line ...
0
votes
0
answers
8
views
How to run EdgeOS configuration commands in python fabric [migrated]
I'm trying to programmatically update configuration in EdgeOS using a python script. I'm using fabric as an ssh client. https://docs.fabfile.org/en/latest/index.html
Below "---original question---...
0
votes
1
answer
25
views
How to bring a job to foreground and then disable job control in bash?
I have a program running in a terminal window. I wish to disable the Ctrl+Z shortcut from suspending the process.
After pressing Ctrl+Z, the command fg && set +m unfortunately disables job ...
1
vote
1
answer
33
views
Bash: execute in parallel some processes but wait the slowest
Hello I'm writing a bash script where I have to restore around 8+ big sets of ip with ipset-restore command.
Actually my shell script basically has a list like
ipset-restore < list1.txt
ipset-...
0
votes
1
answer
37
views
no-ignore-case in grep command
In man page of grep --no-ignore-case matching control has the following description:
Do not ignore case distinctions in patterns and input data. This is the default. This option is useful for ...
0
votes
1
answer
50
views
Bash function to make function for menu
I am trying to make a nicer menu in the terminal to improve my bash skills. I have been able to do so if i hard code all of the values. However, if the number of options varies then I am not sure what ...
-2
votes
2
answers
57
views
execute command after switch to different user with sudo
I am trying to execute this command:
echo hello | sudo su - dp-postgres
But I get this:
-bash: line 1: hello: command not found
I also tried this:
sudo su - dp-postgres -c 'echo hello'
But that is ...
0
votes
1
answer
118
views
How to view a folder with the name of "."?
A folder that is named ".", just dot and nothing else, does not appear in dolphin or krusader file managers.
ls -a shows the folder.
Terminal output:
drwxrwxrwx - root 29 Feb 17:05 .
...
0
votes
2
answers
69
views
How to select a file named by strange character in a folder which has 2 same prefix file existed in linux?
such as:
admin@DESKTOP-M6V5E4A MINGW64 ~/Workspace
$ vi file_
file_2.json file_▒▒▒ָ▒▒▒▒ģ▒顣.json
I can't use my mouse,how can I select the file_▒▒▒ָ▒▒▒▒ģ▒顣.json?
I'v tried press my tab.but ...
0
votes
1
answer
28
views
Bash script error issue with Debian preseed dpkg-configure string
I am working on some bash scripts to configure various packages the way I need them. When installing Debian 'unattended-upgrades' normally one of the user intervention required is to run *user@...
0
votes
0
answers
25
views
Unsing ranger fm, how can I preview a file's thumbnail
I have images in HEIC format on my Synology NAS. I installed ranger in a docker container, and I can preview most videos and images (connecting using iTerm on mac), but HEIC is not supported.
Synology ...
1
vote
0
answers
23
views
Why can the tree view of MC have a folder as root in the version for PowerShell but not the version for Bash?
MC (Midnight Commander) has versions for both Linux Bash and Windows PowerShell. It has tree view but the feature seems different.
In order to open a tree view with a folder as root of the tree on the ...
-4
votes
1
answer
162
views
Issue Decrypting File with OpenSSL: "hex string is too short, padding with zero bytes to length"
I'm encountering an issue while trying to decrypt a file using Open SSL. I have a file named fc382Crypto.bin provided by my instructor, and I need to decrypt it using the blowfish algorithm with CBC ...
0
votes
0
answers
79
views
Cmder bash failures after DockerDesktop installed [closed]
I have been using Cmder on my laptop for development and to execute bash scripts successfully until installing DockerDesktop. DockerDesktop works fine and is using WSL, but now when I run my bash ...
0
votes
1
answer
28
views
grub-mkconfig doesn't populate /etc/grub.d/10_linux menu entries (Void Linux)
I have been writing a script to install Void Linux (I need something more granular that void-installer). I am able to install grub without issue on UEFI but the BIOS install doesn't work.
I do grub-...
0
votes
1
answer
32
views
shell helper function wrapping `find` and ignoring some dirs
I have a bunch of scripts which follow the pattern of:
find files which match a pattern
do something
The problem is that there are several "hazard" directories which are large and slow, ...
1
vote
1
answer
42
views
git is unable to properly determine the terminal width (git-bash, windows)
As you can see in the screenshot, the terminal is currently 100 characters wide, and both methods of detecting such that I'm aware of are returning the correct value. Despite this, unless I explicitly ...
0
votes
1
answer
36
views
How to insert argument separating space into brace expansion preamble?
I want to use brace expansion to generate the following argument sequence: ./some_command -c root.foo -c root.bar -c root.baz. Brace expansion at first glance looks as a perfect tool: use -c root. as ...
0
votes
1
answer
50
views
Why does zip --exclude only exclude files in the folder but not the folder itself?
I have the following command run in the bash shell which excludes the files in the folder scripts/. I tried the answer in Zip command for excluding directories and files but unfortunately it did not ...
1
vote
1
answer
86
views
Default shell zsh but responding bin/bash
I have no idea what I did! I was installing maven and one of the guides had me do something and now I'm stuck in default zsh. I've tried changing my terminal preferences to be /bin/bash, as well as my ...
1
vote
0
answers
57
views
WSL run a non-login shell even with `--shell-type login`
Previously running wsl sourced .profile for me, as expected:
As of build 16188 when running bash.exe without arguments (or with the ~ argument) bash will be launched as a login shell. The same is ...
0
votes
1
answer
30
views
Unable to discard output from redirection followed by &
In the instruction containing a redirection, neither of 1 or 2 or nothing, on the lhs of >/dev/null discards the output, in this case [24] 1073640. This is contrary to my expectation, What could I ...
0
votes
1
answer
49
views
How to extract parts of the international conference video based on spoken language using command line
I have an international conference video which contains two spoken languages, i.e. the video is mixed with sentences of English and Chinese. I would like to remove the Chinese part by command line.
...
0
votes
2
answers
100
views
Why is a newly created user account using my personal bashrc?
I set up a home server running Rocky 9 with a minimal install and one user account [mine]. I then created a new user, but when I login as the new user, the bash prompt is using the custom PS1 scheme ...
0
votes
0
answers
42
views
Run custom shell script through udev
I'm trying to make an udev rule that'll play sound upon connecting the charger. The rule seems to work fine except I can not get the shell script to run. This is my udev rule:
$cat 01-mru-battery-...
2
votes
1
answer
146
views
Behavior of SIGINT with Bash
I am running this Bash script:
#!/bin/bash
for i in $(seq 1 100);
do
echo $i
sleep 1
done
When I issue kill -INT <pid> nothing happens -- the script keeps running. If I issue kill -...
0
votes
1
answer
76
views
What do black (dark grey) files in Debian represent?
I've been racking my brain over this one for awhile now. I have scraped the web and can't find an answer anywhere.
What are black (dark grey),font files/file-types in Linux, specifically Debian 12 ...
0
votes
0
answers
49
views
Bash - autocomplete .bat file
I'm working with MINGW Bash on Windows and run .bat files. My problem is when I type ./<tab><tab> only .sh files are autocompleted. Is there a way to autocomplete all .bat files ?
-1
votes
1
answer
50
views
passthru background process sudo multiple commands
Have problem running the command in background. Below is configuration of code.
1] Using php passthru running a command as a different user than current
2] The command has multiple commands to run ...
1
vote
0
answers
54
views
ls in Docker on Windows not showing one directory
I'm running Windows Server 2016 Datacenter version 1607 (build 14393.6614) with Docker Desktop Community Version 2.0.0.3 (31259).
I'm running an Ubuntu docker container in an interactive mode with my ...
1
vote
1
answer
60
views
What does it mean to "run something in a shell profile"
I'm installing Homebrew and I get a message that says:
Next steps:
⁃ To add Homebrew to your PATH run brew shellenv in your shell profile (e.g. ~/.bash_profile or ~/.zprofile)"
What does it ...
1
vote
0
answers
69
views
Issue with Ctrl + Arrow Keys in (Neo)vim using PuTTY
When I establish a SSH connection to my machine using PuTTY, I find that the Control + Arrow keys behave unexpectedly when working with vim or nvim in the bash terminal.
For instance, in Vim, escaping ...
0
votes
0
answers
87
views
Install a language with ASDF through Ansible on Debian
I'd like to write playbooks to install my development environment. Most steps went well, but I'm struggling to install Ruby through asdf.
Playbooks are splitted and called from a main.yaml. The one ...
0
votes
1
answer
31
views
remove duplicate character from string in pure bash - works in CLI but does not work in script
I want to remove all duplicate minuses from a string using pure bash (no sed/awk/etc). This works great in CLI:
s="com---strig-3-1080p-----mp4"
echo "${s//+(-)/-}"
com-strig-3-...