Questions tagged [bash]

Bash is the Bourne Again SHell, the successor to the classic Unix sh (shell).

Filter by
Sorted by
Tagged with
1 vote
2 answers
68 views

What program is being executed upon time command?

In my terminal in Ubuntu, I want to execute the time program with option -v, but it fails: $ time -v ls -v: command not found However if I specify the path /usr/bin/time of the program as such, it ...
Louis Coulet's user avatar
1 vote
1 answer
2k views

bash script – MySQL commands and variables

I have a bash script who automate a Nextcloud server installation. To run MySQL commands I use the mysql -e command user@hostname:~$ mysql -e "CREATE DATABASE ‘NextcloudDataBaseName’" I ...
Maxime's user avatar
  • 69
0 votes
1 answer
7k views

Not able to use for loop using bash in Jenkins pipeline

Following is my code stage ('Connect to cluster (update kubeconfig)') { steps { script { dir("${env.WORKSPACE}/gke-infra-creation") { ...
Zama Ques's user avatar
  • 523
0 votes
1 answer
157 views

"ping" fails when running from google- cloud on specific IP

I'm trying to access www.fastlane.co.il trough google cloud servers. I got the IP 81.218.67.65. When i ping it locally on my computer it works fine. Local results: Pinging www.fastlane.co.il [81.218....
Guy Barash's user avatar
0 votes
1 answer
610 views

Selecting cli menu options from my bash script

I'm running a bash script but the process freezes when it hit a menu where it have to make a selection I understand that for YES ican use -y in my commands, but in the case where: I need to select/...
Tlink's user avatar
  • 103
-1 votes
1 answer
52 views

a script that terminates all processes owned by the current user, [closed]

I don't know how to write a scrypt that terminates all processes owned by the current user whose machine time (TIME) is greater than 1 minute
Fluffy's user avatar
  • 1
0 votes
2 answers
546 views

how to extract a certain field from standard output with cut?

I have this output and want to extract the IMAGE ID from it $ podman image ls | grep youtube-dl localhost/youtube-dl latest 2d4e37c4d609 3 hours ago 205 MB All I know piping ...
vrms's user avatar
  • 287
1 vote
0 answers
219 views

Bash slash does't work in wildcards square brackets

I'm curious why command ls -pd *[!/] or ls -pd *[!\/] doesn't match all files which don't end with /. My use case is that I want to list only files inside the current working directory. I know that it'...
Alex Misiulia's user avatar
0 votes
0 answers
83 views

Script to reassign floating IP address to my other machine running Ubuntu

I have a floating IP(X.X.X.191) assigned to the machine (Y.Y.Y.106) currently running ubuntu. Now I want the same floating IP to be assigned to my other droplet(Z.Z.Z.252). On digital ocean I can do ...
Himanshuman's user avatar
0 votes
0 answers
1k views

How to pass multiple arguments through ssh and use those arguments in the ssh script?

I have written one script on lets say server1 and from that script I want to execute script Start_UI_AdminApp.sh on server2 through ssh. I also need to pass the arguments while executing this ssh ...
Satish Lamak's user avatar
0 votes
0 answers
180 views

In linux, is it possible to check stdin to see the line that bash is running?

When I want to know that process has been spawned by bash, I just check ps. But I was wondering, sometimes I launch things as for x in $(somecomplextask.sh); do foo $x; done I wonder, is it possible ...
arivero's user avatar
  • 200
0 votes
1 answer
1k views

docker run script at start, commit changes and remove script mounted

I have a script that I want to run on existing images. For this I mount the script while running the container, commit changes and replace the image. The problem with binding the script at start is ...
sak's user avatar
  • 1
-1 votes
1 answer
230 views

How common are single quotes (apostrophes) in Windows usernames? What about in Ireland? [closed]

today we discovered our developer-focused GUI app doesn't work on systems where the username contains an apostrophe. Because although it's multi-platform, part of it runs in a linux VM where shell ...
Eric's user avatar
  • 99
8 votes
2 answers
3k views

error when trying to mv a file with -r in the name of the file

Here is my problem : I have a file with -r in the name: -r.jpg When I tried to do a mv *.jpg old/ I get: mv: invalid option -- 'r' Even for for g in *.jpg;do echo $g &&mv "${g}" old/...
Bussiere's user avatar
  • 181
0 votes
2 answers
1k views

How to get the email I entered on Proxmox VE setup in the shell?

When I login to my Proxmox VE7 host, I'd like to get the email that I entered when I set up Proxmox on installation. Is it possible? The idea is to automate certbot initialization non-interactively ...
Martin Braun's user avatar
0 votes
1 answer
224 views

Why this java processes are not ending once cronjob has executed in the AIX server?

I have set a crontab for execute a java service in every 8 hours in AIX(7.1) operating system. Once the crontab has done the job, the JAVA service should be end. This cronjob is working properly. But ...
AnujaDx's user avatar
1 vote
0 answers
135 views

ssh pass host fingerprint and private key without creating them as files

I'm trying to invoke ssh with a custom private key and host fingerprint stored in local vars rather than in files. I would like to avoid creating temp files because if my script is killed I'll get no ...
capr's user avatar
  • 231
0 votes
0 answers
189 views

Testing Regular Expressions

I am trying to learn regular expressions, and came across some examples online. Trying to put things together, I inputted this into bash ^(([a-j][a-j]?)|(3[a-j][a-j])$ It returns the following error ...
Smokefox's user avatar
1 vote
2 answers
1k views

Hashicorp Vault How Do I Login Headless From STDIN Using Bash Shell?

Given a Bash Shell say in a Docker container running on Gitlab, for example, how would I get the password to get passed in? When I login with this: $ vault login -method=ldap username=myusername It ...
Frederick Ollinger's user avatar
0 votes
0 answers
168 views

Strange record in /etc/shadow after useradd -p and crypt function in bash script

Ubuntu 20.04 LTS. There is a simple bash script to add a new user via command line in interactive mode: #!/bin/bash # Script to add a user to Linux system if [ "$(id -u)" -eq 0 ]; then ...
Skuld's user avatar
  • 1
0 votes
1 answer
473 views

Continue statement doesn't work as it should - bash

For the context, i have an infrastructure of multiple machines using ssh. We connect via ssh as root on the machines without password thank's to the authorized_keys file on each mchine. We are adding ...
AmelieAudet's user avatar
0 votes
0 answers
155 views

How to separate commands issued in a terminal from their output?

I'm realising that for 90% of my day I'm staring at the same part of my screen -- the bottom-left corner -- while I type commands and wait for output. I'm starting to develop quite the neck strain, ...
Daniel Quinn's user avatar
0 votes
1 answer
193 views

Send signal to process and wait x seconds for it to disappear

I would think this is a common idiom in Linux world so my question is if there's some build-in functionality for it ? Something like: Args: $PID - the process to send signal to $SIGNAL_NAME - the ...
peterh's user avatar
  • 257
0 votes
2 answers
645 views

Is it possible to connect to a user session and see its output in Linux?

I am replacing a windows app with linux command line app. It is supposed to output simple statistics so user can check if the app is alive. In windows it is run 24/7 and you can connect to a desktop ...
Boppity Bop's user avatar
0 votes
1 answer
75 views

Possible attack on my vserver - outgoing tcp/ip connection

I have a suspicious situation on my vServer (Centos 7). An unknown bash script is consuming all the memory from the server. There is a noticeable connection to the "outside". Unfortunately ...
ChaosSpeeder's user avatar
0 votes
1 answer
272 views

export new env params without outputting to terminal

I'm trying to run a script and bash export is outputting text when I don't want it to because it's breaking up the output. I need to run a script which extracts some information and then inserts it ...
Christopher Thomas's user avatar
0 votes
0 answers
6k views

NodeJS can't find python: gyp ERR! find Python

I'm trying to run a script but nodejs can't find python for some reason. I have tried reinstalling python, reinstalling nodejs, reinstalling my OS, running (and rebooting afterwards): export PYTHON=&...
tired's user avatar
  • 1
0 votes
1 answer
469 views

Using awk with column number in a bash script

I'm using a command like this to get some connections from nf_conntrack: awk '($3 == "tcp") && ($6 != "TIME_WAIT") && ($10 == "dport=1234")' /proc/net/...
ihorc's user avatar
  • 43
1 vote
1 answer
1k views

How to restrict a user to rbash when logging in via SSH

I would like to restrict some users on my server to only being able to execute certain commands. To do this, the most common approach that I could find is to use rbash. While I can find many websites ...
cdauth's user avatar
  • 993
0 votes
1 answer
410 views

iptables list line numbers script iptables-save -bash: number-rules: command not found

I am trying to use a script for showing iptables line numbers from iptables-save command. The script was taken from this site: https://blog.oddbit.com/post/2018-02-08-listing-iptables-rules-with-li/ ...
Ergest Basha's user avatar
0 votes
0 answers
534 views

How to save network settings in debian?

For example i used next commands: ip address add IP dev interface IP route add default via IP dev interface and if I reboot Debian then the settings are just reset. I used command iptables-save, it ...
Shaka92's user avatar
1 vote
1 answer
784 views

SSH'ing into WIN 10

People of the Server-verse, a humble hello from fellow apprentice. Above line goes out to show i am a newbie and thus need help with trivial probs, so appreciate all help in advance. I am facing 2 ...
Ankit Rana's user avatar
-3 votes
1 answer
57 views

Nested directories file restore

I recently took backup of one of my server's drive on AWS using one of the software and now at the time of restoring it i found out it took too long to restore as its having billions of files to ...
root's user avatar
  • 39
0 votes
0 answers
2k views

how to run .war with java to execute inside dir from desktop shortcut

This is my case. I have a .war that I execute with java and it only works inside its folder: cd /opt/myappdir/ java -jar myapp.war Note: It does not work like that: java -jar /opt/myappdir/myapp.war ...
acgbox's user avatar
  • 398
-1 votes
1 answer
159 views

WP-CLI doesnt run from cronjob [duplicate]

I have a bash script which is retrieving the information from my database, based on the information it gets creates some folders containing the WP files on each one and then makes the setting. The ...
Iosef's user avatar
  • 1
0 votes
0 answers
227 views

Running ps command with 'Irix mode' off

I know that within the interactive 'top' screen, I can press 'Shift + i' to turn off 'Irix mode' Is there a way to do the same thing with 'ps' command? I am trying the below mini script to print out ...
Asem Abuelhija's user avatar
0 votes
1 answer
586 views

how to use BASH to convert the path to the home folder in the variable bash, in quotation marks into a working one

Use the script, I am trying to create a directory in my home folder. Due to the specifics of integration with terraforms, parameters are passed in this way: variable = "value" It would be ...
K S's user avatar
  • 1
0 votes
1 answer
570 views

How to convert BASH script to DASH or other solutions?

I am creating an AWS distributor package to modify the syslog configuration on different flavors of Linux servers. I wrote a few simple bash scripts to handle the install, uninstall, and update. I ...
Appleoddity's user avatar
  • 3,850
0 votes
0 answers
524 views

Why would userdel report that a user is currently used by a process that is running as another user?

When attempting to delete userA, userdel reported that userA is currently used by process 1296; however, ps reported that this process was running as userB. userC ran userdel. userdel: user **userA**...
stackhatter's user avatar
1 vote
0 answers
685 views

How to export the details of a digital certificate (.cer file) to a csv file using powershell?

I have a digital certificate that I'm using for a specific task. I need to export the details of the certificate such as the serial number and issuer to a csv file that is already on my computer using ...
Darius's user avatar
  • 11
1 vote
2 answers
9k views

How to use wget http status codes in an if else statement to take an action based on the status code

I'm writing a script that is downloading a bunch of files, I'm using wget to download the file and I want to echo back to the terminal custom status messages for each file based on 3 scenarios: ...
corefile's user avatar
1 vote
1 answer
2k views

Environment Variable Empty in Bash Script

I have an EC2 instance that I am deploying on AWS. I am using an Amazon Linux 2, and I am passing a user data to it as such: userdata_file.write( f''' #!/bin/bash\n export ...
Mervin Hemaraju's user avatar
0 votes
2 answers
642 views

Running mysqldump via SSH on separate mysql server

I've got an hosting environment consisting of two separate servers: web-server and db server. The web-server is accessible via SSH only (and of course port 80). The DB server is inaccessible from the ...
spekulatius's user avatar
0 votes
1 answer
3k views

After= option not working in systemd service file

I have two shell scripts name first.sh and second.sh. The contents of first.sh and second.sh are given below: >>first.sh #!/bin/bash while true do echo The current time ...
Ajay Banstola's user avatar
0 votes
1 answer
175 views

Remote deployment of a script on linux

We are creating a lab and wanted to setup like 10-15 hosts with ldap. We need to install on each computer some packages that are necessary to run ldap, so my question is - can I somehow run 1 bash ...
Pakuss's user avatar
  • 1
0 votes
1 answer
244 views

How to use a screen with bash script? [duplicate]

I tried to create an executable .sh file with command that create screen like this: screen -dmS ast [comand] And let my crontab execute it like this * * * * * bash /root/my_bash.sh But nothing ...
Шумер Ахмед's user avatar
0 votes
1 answer
99 views

Removing old files from home directories

I need to find and remove files older than 2 weeks from the home directories of my cluster. I do not want to let people just "touch" the file to change the modification date and keep it for ...
David's user avatar
  • 1
1 vote
2 answers
362 views

Zip all files returned from "grep-ril" command

I'm using grep -ril to be able to see all files that contain a certain string: [user@machine]$ grep -ril "test string" file1.log file2.log file3.log file4.log ... I then would like to zip ...
Ress's user avatar
  • 45
2 votes
2 answers
11k views

Curl Command Send Asynchronous Request

I using this curl request for sending data to API : curl --location --request POST 'MY_IP' \ --header 'Content-Type: text/plain' \ --data-raw ' [{ "event_id": "123", }] ' ...
Martin's user avatar
  • 21
1 vote
1 answer
843 views

rsync : write failed - No space left on device (28) despite using --inplace

I am using a script to make a backup of a running Debian Stretch based Linux Distro (NextCloudPi) The method in the script that does the backup uses rsync. backup() { mntimg sync rsync -aDH --...
FlexMcMurphy's user avatar

1 2 3
4
5
72