All Questions
Tagged with command-line bash
5,421
questions
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-...
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 ...
-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 ...
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
...
-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 ...
-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 ...
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 ...
-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 ...
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 ...
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/...
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 ...
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 ...
1
vote
2
answers
632
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 ...
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, ...
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 ...
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] ...
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 ...
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 ...
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 ...
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 ...
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 ...
1
vote
2
answers
182
views
Concatenate string after grabbing environment variable
I'm trying to concatenate a string with a variable which is in .env file. My .env is this:
API_URL=http://localhost:3030
NODE_ENV=development
And here is my code:
[ ! -f .env ] || export $(grep -v '^#...
3
votes
1
answer
336
views
Is there a way to know if a file was copied?
I'm using Ubuntu 22.04, and I'm making a bash program (script) to run scripts at startup, shutdown and/or reboot. These things are sensitive and, if poorly done, it could be dangerous for the user/pc, ...
0
votes
1
answer
420
views
Getting Error in shell script "unexpected EOF while looking for matching `''"
I wrote a simple shell script in /bin/sh and getting the issue below.
/tmp/a.sh: line 14: unexpected EOF while looking for matching `''
/tmp/a.sh: line 17: syntax error: unexpected end of file
*******...
0
votes
0
answers
60
views
Reset Ubuntu dotfiles?
I recently ran and installed someone's dotfiles (it was like a popular one, from awesome-dotfiles github repo) and my terminal seems like this
How can I reset it?
0
votes
0
answers
51
views
Adding ++ctrl+enter++ key combination in bash (to allow for nvim enter key combinations)
I'm trying to make the ++ctrl+enter+ key work in nvim to be able to create a new line above in incert mode without leaving <ESC>oi similar to vscode but the following don't work:
keymap("i&...
0
votes
0
answers
20
views
Shell script doesn't recognize Python even after setting its path [duplicate]
I'm having trouble calling Python code from a shell script on Ubuntu. First of all, I confirm that Python is installed:
username@Ubuntu22:~/Documents/Script$ python
Python 3.10.12 (main, Nov 20 2023, ...
1
vote
1
answer
1k
views
Bash terminal has become extremely slow. 22.04 [duplicate]
My bash terminal has become extremely slow, I until 22.04. I don't have any extensions installed but I think it might be related to some form of auto complete/search.
Additionally gnome-shell has high ...
2
votes
2
answers
583
views
How to replace a file path with whitespace using sed?
I have many different files with a string in them. I need to replace this string with a path, although the path contains whitespace. So far, I have this:
for a in files_[a-z][a-z]_all\.conf ; do
...
4
votes
1
answer
4k
views
How to solve the response of my terminal that works very slow and badly? [duplicate]
The problem is that my terminals not work great anymore.
The typing is very bad in terminal and each command response not if I press a key.
Sometimes the command runs but it ends not, but when I hit ...
1
vote
0
answers
94
views
Can't open nautilus in home path
I'm unable to open Nautilus or Nemo in my home directory.
Behavior:
They crash immediately upon opening (when the default home path is opened).
However, I can use other paths. For example, nautilus ~/...
-1
votes
1
answer
56
views
How do I make Ctrl-arrow skip over dots and dashes
on the commandline
How do I get my cursor to jump from a to z directly if I use ctrl-rightarrow for the word a-very-long-resource-name.12.45-ending-in-z
0
votes
0
answers
74
views
set: pipefail failing on WSL windows
I cloned this repo on WSL2 https://github.com/apache/airflow/blob/main/dev/breeze/doc/01_installation.rst#docker-in-wsl-2 and tried to build a docker image that uses also this script https://github....
1
vote
0
answers
80
views
.desktop application won't open a terminal window
I have a .desktop file located in ~/.local/share/applications:
[Desktop Entry]
Name=Keg
Exec=bash -c "ssh -t rpiz 'python3 /home/pi/keg/shell.py'"
Type=Application
Terminal=True
The ...
0
votes
0
answers
109
views
How to start a named background process when using bash?
I have a script that looks like this:
#!/bin/bash
tsx watch services/$1/src/index.ts
This will start tsc for the given service:
script/start_service some-service
If I add & the end it gets ...
0
votes
1
answer
69
views
changing grep command --color from red to another color [duplicate]
I'm searching from the file using grep command with particular pattern,
sysadmin@localhost:~$ grep bash /etc/passwd
which return the output like below
root:x:0:0:root:/root:/bin/bash ...
0
votes
0
answers
44
views
here file does not fill token
I use a certain command quite frequently, but the command prompts a few things so I wanted to auto-fill it with here file, but it seems that for some reason it can't provide last value to the prompt. ...
0
votes
1
answer
269
views
What are zsh equivalent to bash's shopt -s globstar and shopt -s dotglob?
I need zsh equivalent to bash's shopt -s globstar and shopt -s dotglob. How can I do that?
UPDATE 01:
As per @muru's answer, I used setopt globdots in the zsh shell, and ran the following command:
for ...
0
votes
1
answer
42
views
Invoke a program as a command on any working directory on ubuntu's terminal [duplicate]
I have written a program in C and produced an executable from it. I want to use this program from any pwd. One method is to make its pathname a environment variable using export. But in this method, ...
1
vote
2
answers
247
views
Changing Linux file names to NTFS-compatible file names [duplicate]
I must create a bash shell to rename the file names in a directory structure. In case the file name contains \ or : or a space it should be translated to _, _, and - respectively. I'm trying to use a ...
0
votes
2
answers
245
views
How to write a bash script from two commands (Find and replace a text string in all files recursively in current directory)
On Ubuntu Server, I use two different commands to find and replace a string in all files recursively in the current folder.
The first command is:
sudo find . -type f -print0 |\
xargs -0 -r sudo ...
1
vote
1
answer
122
views
accidentally moved almost all my files in a new directory, is it the end for me?
I was working on a big Latex project and I wanted hide all the file which are not .tex, .pdf, or .png to see clearer in my directory browser.
I used the following script :
#!/bin/bash
# Create a ...
0
votes
0
answers
59
views
Bash not working in TTY/gnome-termina/Xterm
I opened the terminal today and all I could see was this white blinking bar:
I opened Xterm and there is the same problem. Also, TTY doesn't work well, I can login and then I cannot type anything. I ...
1
vote
0
answers
47
views
How to add my own shell script to be able to be autocompleted in terminal by Tab
I have bunch of shell script (.sh) command created in a folder ~/bin, I added this path to .bashrc so I can execute them wherever I like.
i.e. a sample command to create git feature branch based off ...
0
votes
1
answer
42
views
Custom alias to run and compile .c file [duplicate]
I'm trying to create custom alias to to compile and run my .c files in one command. I tried to add this line in /.bashrc_aliases alias runc='gcc $1 -lm && ./a.out' however I get an error and ...
2
votes
1
answer
137
views
Special characters 158 and 159 stopping my functions in terminal
I am having issues with the two special characters 158 (U+009E "Private message") and 159 (U+009F "Application program command").
My issue started with a function in Clisp that I ...
0
votes
0
answers
100
views
How can I run different commands in separate terminals using a shell script?
I have access to an Azure VM where I intend to run three Hyperledger Besu nodes: one boot node and two validator nodes. To automate this setup, I've created a shell script.
First, I checked the ...
0
votes
1
answer
88
views
Backporting: Does anyone have a function to mimic bash 4 associative array?
I need to make changes in my script that uses associative array, so that the script may be used in older versions (before v4.0) of bash which did not support associative array. Can someone suggest how ...
5
votes
2
answers
522
views
highlighting specific lines in different colors when starting a scipt with printf
I am using a bash script. When I launch my script, how can I highlight specific lines on the output? For example, all lines with "Enable" should be green, all lines with "Disable" ...
3
votes
2
answers
146
views
Ubuntu terminal ignoring interpreter first line
I am Windows user running WSL2 with success over the last two years. I work on a project connected to a git repository. All devs work on mac/linux so all parts of this project are targeted towards ...