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.
11,226
questions
2
votes
0
answers
392
views
how to source bashrc from the eclipse terminal?
How do I configure eclipse so that I have access to bash complete with my aliases? I ran:
[org.eclipse.Java ~]$ alias
[org.eclipse.Java ~]$ source /home/thufir/.bashrc
but that seems awkward. Also:...
0
votes
2
answers
396
views
How to create a bash script using a bash script?
I am trying to create a post-installer script which itself creates a bash script (startapp script).
This is the original startup script:
#!/bin/bash
if [ `wmctrl -l | grep -c "$2"` != 0 ]
then ...
0
votes
0
answers
177
views
Modified .Bashrc file unable to boot ubuntu
I just update my .bashrc file in ubuntu to insert enviroment,
after i reboot my pc i manage to show GRUB dual boot menu and when i choose ubuntu i gave me black screen,
like this
blank screen
can ...
3
votes
2
answers
2k
views
Rename multiple files with variable extensions to remove beginning and end of filename
I have multiple files I need to rename as below:
5891_1_0_AD3884_ACTCTCGA_S10.bam
5891_1_0_AD3884_ACTCTCGA_S10.bam.bai
5891_1_AD3875_GAGCTTGT_S1.bam
5891_1_AD3875_GAGCTTGT_S1.bam.bai
...
0
votes
1
answer
4k
views
Eclipses: no consoles to display at this time
How do I get a bash terminal or console from within Eclipse itself?
but no prompt:
I just see:
no consoles to display at this time
"Window->Show View->Other". Search for Terminal and select "Open"....
0
votes
2
answers
1k
views
When using a shell script, minecraft/java throws errors
Basics:
This is a learning experience, I am new and doing this to expand my knowledge. So if you can please explain in detail...it would be appreciated.
This is a new install of Ubuntu Server, it is ...
2
votes
1
answer
1k
views
Automatically Resize Partitions to Bare Minimum Needed to Store Files
I am currently writing a bash script in Ubuntu 20.04 LTS that automatically backs up devices that are running ubuntu-server 18.04 LTS. I don't think this is version-specific, so I didn't tag it that ...
1
vote
1
answer
402
views
How to list partition in a dialog menu?
Is there any way to allow the user to select a partition from dialog’s menu (--menu) selection feature? If so, how do you do it?
Of course, this does not work:
dialog --menu "Select a partition" 0 0 ...
0
votes
1
answer
287
views
How does redirecting a command output to a file deals with opening and closing that file?
If we redirect a command such as sar -r 1> a_file.txt how does this works with opening, writing the output of the command and closing the file?
In other words, how does redirecting a command ...
2
votes
1
answer
2k
views
How to give input to a script running using nohup?
I have a script running on my server, say test.sh. I executed it using the following command -
nohup test.sh
Now I want to pass an input quit to this script so that it'll terminate itself ...
1
vote
0
answers
503
views
Oh My Bash problem
After I installed oh my bash, I used some themes like agnoster for my bash and i started to code, but when I used command cd and pressed tab it said there's about 360 possiblities and there was at ...
2
votes
1
answer
468
views
Restricted shell is not working for a newly created user (ubuntu 18.04)
I want to create a new user with a restricted shell so I :
ln -s bash rbash # create a symbolic link to bash with a name "rbash"
useradd -s /bin/rbash student # add a new user with a shell ...
0
votes
0
answers
526
views
How can I view the output of multiple bg processes?
This is a follow-up question to this. But since, they are not related I created another question.
So, in this scenario, I am running multiple background processes in order to speed up my program ...
2
votes
1
answer
265
views
Distribute processes to cores
I am trying to minimize the run-time of a program as much as possible which is handled by "master" bash script I wrote.
My way of parallelizing the process (since is fully-parallelizable) is the ...
0
votes
1
answer
7k
views
Change the cURL response encoding for some characters
The response of the below curl command is a json and it has some japanese characters which it is showing in utf-8. I can't share the url but this is how I am sending the request.
curl https://some-...
2
votes
0
answers
63
views
Plan multiple commands (sequence) and execute them live (presentation)
I saw this many times in live coding presentations but never remembered the used tool.
The presenter prepared a sequence of commands. Then he started this like a "playbook", so that he was able to ...
0
votes
0
answers
2k
views
mv: missing destination file operand when special characters are involved [duplicate]
This one's silly. I saved my vim session with :Obsess -S Session.vim instead of :Obsess Session.vim, so now I have a -S/ Session.vim file in my project and can't open it with vim as the following is ...
0
votes
0
answers
18
views
What is the easiest way to run a script automatically at startup in Ubuntu 20.04? [duplicate]
I'm using a touchscreen in vertical position as a monitor and I need to run a script at startup, otherwise Ubuntu does not flip the touch interface to fit the vertical position of the monitor and the ...
0
votes
1
answer
102
views
Multiple Aliases triggering same function
I'm trying to create a function, but I want to trigger by either aliases : debugApp, debugApi
Rather than creating 2 functions to do the same thing
debugApp() {
#update .env to generate log
...
0
votes
1
answer
2k
views
Command inside another command - Bash
I know how to run a simple command inside another command, but in my case is special. My command contains " (date "+%Y-%m-%d").I need to display my log via 1 command.
If I do this date &...
1
vote
1
answer
1k
views
Tab autocomplete in bash does not work for directories but does work for programs Ubuntu 16.04
I'm getting the same message each time I try and [TAB] to autocomplete into a directory:
test being the directory within var/www/html
# hitting [TAB] after typing 'test'
$ ll test-bash: cannot create ...
8
votes
1
answer
6k
views
zsh: read:-p: no coprocess error while using read command with -p flag
community. I recently started to use zsh instead of bash and now i'm getting some problems that cannot be found on bash.
One of theme: when i use read -p command, obviously with flag -p, i get an ...
0
votes
0
answers
48
views
Write bash history when connection is terminated abnormally [duplicate]
How can I make sure that my bash history gets written to ~/.bash_history when I am disconnected abnormally?
I work on several remote Linux hosts, and my connection is frequently terminated abnormally....
0
votes
0
answers
2k
views
How to refer environment variable in terminal command?
I am new to Linux world, here i am trying to pass the env variable in command to aws in this way
sudo aws s3 cp s3://bucket/path/to/file.sh file.sh
Should download the file.sh to my local, here i ...
4
votes
1
answer
8k
views
Error installing DroidCam in Ubuntu 20.04
I want to use my phone camera as a webcam in my computer with Ubuntu. I read that DroidCam is the easiest way...
So, I tried following the official script: https://www.dev47apps.com/droidcam/linuxx/
...
6
votes
3
answers
28k
views
Kernel - make menuconfig error
Working with a Headless Raspberry PI 4 with an Ubuntu Server 18.04.4 LTS.. I am trying to configure the source kernel. I have installed libncurses-dev, kernel-package, qt4-dev-tools.
When I run '...
0
votes
3
answers
12k
views
can't find directory and file created with ubuntu
So I downloaded ubunto to start working with command line. It seems ubuntu created a directory that it named my username in my desktop (as discovered via pwd). I since created a file called colors.txt ...
-2
votes
1
answer
376
views
Write line containing # character to a file
Having done these previous steps:
Created a new directory called missing under /tmp.
Used touch to create a new file called semester in missing.
How do I write the following into that file, one line ...
2
votes
0
answers
35
views
bash_aliases are not working in Ubuntu run (Alt+F2) dialog [duplicate]
bash_aliases are not working in Ubuntu run (Alt+F2) dialog. It shows a "Command not found" error.
But it works perfectly in Terminal.
How can I make it working in run command box?
2
votes
2
answers
455
views
Customize bash shell
I'd like to customize my bash shell in a very specific way, so specific that I don't know if it is possible. Currently, my shell looks like this:
myname@ubuntu /home/myname:
>>
Where myname is ...
0
votes
2
answers
278
views
how to create auto paste in script bash with touch?
I want to make automatically fill the text file that I made but I don't know how, I want to make a .sh script to work automatically but I don't know how. the script that I have thought of for example ...
0
votes
0
answers
218
views
Is it possible to create a keyboard shortcut to run a script in Terminator?
I am fairly new to Ubuntu. I am currently trying to create a keyboard shortcut (Ctrl+P) to execute the script below in terminator. I got this shortcut to work with the gnome terminal via Settings → ...
0
votes
1
answer
936
views
how to create multi file with touch and using spaces?
I want to create multiple file creation with touch, but I am constrained by space, because I want to use space in my files like this
1 Joe Arnold
2 lucky man
3 directory lib
I try like this
touch ...
0
votes
1
answer
491
views
How to Update Many Symbolic Links at Once
I recently upgraded my computer and along with a new OS I have a new username. Because of that I have a References directory full of links that don't work anymore, but they would if I could simply ...
0
votes
1
answer
814
views
Shell Not Able read files written with python
I made a python file which tells every .java file in the folder it is placed in and you can select which java file to execute, the selected java file's name is then written in a file named Input.txt, ...
9
votes
1
answer
3k
views
Bash doesn't expand variables when pressing Tab key
In the previous versions of Ubuntu 18.04, the variables in Bash are expanded when I press the Tab key. But in Ubuntu 20.04 (using bash 5.0.16), the variables are not expanded. Instead, the dollar sign ...
0
votes
1
answer
127
views
How to run a script 4000 time for files names from 1 to 4000 in order?
I have 4000 file named from 1 to 4000 inclusive the 1 and the 4000.
I wrote the below command which I want to run the script I wrote 4000 time for all the files from 1 to 4000, so I wrote:
for ...
3
votes
1
answer
2k
views
How to disable automatic backslash insert when using environment variable names on Ubuntu 20.04 LTS terminal(s)
When I use environment variable name and press Tab for auto-complete on Ubuntu 20.04 LTS terminal (I have tested both the terminal which comes with Ubuntu 20.04 LTS install and Terminator, same ...
-2
votes
1
answer
829
views
echo all URLs matching regex
For a project I'm working on I need to get a list of all URLs in a certain folder of a domain, or better yet all URLs matching a regular expression.
I want to do this using bash so as to avoid ...
3
votes
1
answer
645
views
Need help figuring out SystemD timer with wake up from Suspend
I have a systemd service file and timer file that wakeup laptop and should run a python script. Then when that's done, run a bash script that puts it back into suspend. It currently wakes up the ...
2
votes
1
answer
3k
views
I'm trying to verify my ISO for Ubuntu in windows 10 using WSL Bash command line, Im not getting a DSA key no matter what I do
I just want to know if I have no DSA key just an RSA key if my ISO is ok. I ran everything, It says the ISO is OK when I check it and verifies with the RSA key but is this OK with no DSA key or is ...
1
vote
1
answer
801
views
How can I have a script run whenever I start a zoom meeting?
I'm trying to write a script that will execute when I start a zoom meeting.
I found a command wmctrl -l which outputs
0x05e00020 0 N/A Zoom - Free Account
But, I can't figure out ...
0
votes
2
answers
2k
views
Script for conversion audio files to mp3 recursively in another folder with same names of sub folders
I have this script for conversion of video files to another folder with same hierarchy. This works fine.
#!/bin/bash
SAVEIFS=$IFS
IFS=$'\n'
find . \( -name '*.mkv' -o -name '*.mpg' -o -name '*.3gp' -...
1
vote
2
answers
389
views
how to execute a file/script when i save a file
for example;
#!/bin/python3
print("Hail Hydra")
so , how to execute this file without typing python3 *filename.py on my terminal when i save this
0
votes
1
answer
61
views
What is wrong with my bash script?
#!/usr/bin/env bash
gnome-terminal --window-with-profile=app
# Execute exe1
pathToExe1=./dir1/exe1
gnome-terminal --tab-with-profile=app -t "exe1" -- $pathToExe1
# Execute exe2
pathToExe2=./dir2/...
1
vote
1
answer
167
views
rbash does not work when set as the default shell for a user
Even though /etc/passwd and $SHELL confirm that the default shell is rbash, the restrictions as described by rbash manual does not apply.
For example, I can change directory with cd, I can change the ...
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?
...
-1
votes
1
answer
892
views
bash /home/andyman/.bashrc :Permission denied
After doing chmod 600 ~/.ssh/id_rsa according to this answer, I cant access my home directory with cd and I get the above mentioned bash /home/andyman/.bashrc :Permission denied error every time I ...
1
vote
1
answer
90
views
How to move files from directory /foo (1) to directory /foo
I know this is basic, but I'm failry new to bash.
Due to some duplication I have many photos in many folders and I'd like to clean them up. Here is an example of my file structure
- 12-30-14
- ...
1
vote
1
answer
3k
views
Logging all terminal input/output history
Ubuntu 20.04 on Hyper-V VM
I am trying to do something similar to what is written in this answer. I think this answer logs all the terminal to a certain file. I would like to be able to log all my ...