2022 Developer Survey is open! Take survey.

Questions tagged [bash]

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

Filter by
Sorted by
Tagged with
-2 votes
0 answers
17 views

I faced a probelm in bash plz help me [closed]

how to use "sudo su" -> pwd and then execute some commands under sudo privileges? the screen get stucked in root it doesnt execute the other commands PLZ HELP ME
user avatar
1 vote
0 answers
6 views

How do I set environment variables so that they execute when calling WSL from PowerShell?

First let me clarify the question. I'm not asking how to sync environment variables. What I am asking is how to set JAVA_HOME so that when I call wsl echo `$JAVA_HOME from powershell it writes out the ...
user avatar
1 vote
2 answers
39 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 ...
user avatar
1 vote
1 answer
25 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 ...
user avatar
  • 69
-2 votes
0 answers
16 views

Search a pattern word from multiple files and concatenate whole lines in a new file [migrated]

I have several data files. For example sales.txt (the original file has 13 columns) Date Unit $$ employee# abc def jkl mno pqr Dec1 10 500 2 1 2 3 4 5 Dec2 12 450 3 6 7 8 9 10 Dec3 13 550 3 11 12 13 ...
user avatar
0 votes
1 answer
29 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") { ...
user avatar
  • 421
0 votes
1 answer
20 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....
user avatar
0 votes
1 answer
11 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/...
user avatar
  • 103
-1 votes
1 answer
26 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
user avatar
  • 1
0 votes
2 answers
37 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 ...
user avatar
  • 217
0 votes
0 answers
9 views

Bash vi-bindings position of last CLI character

I'll use ls -la as an example. On Iterm2 (xterm-color256 vi-bindings), when I use the up arrow to go to the last command, the cursor is placed to the right of the 'a'. When I hit the left hand cursor ...
user avatar
  • 202
1 vote
0 answers
17 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'...
user avatar
0 votes
0 answers
15 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 ...
user avatar
0 votes
0 answers
23 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 ...
user avatar
0 votes
0 answers
18 views

Linux (Ubuntu 18.04) ssh connection closed after login with -bash Input/Output errors

Currently running into an issue when SSH'ing into a remotely deployed edge computer. When logging in via SSH after entering the password the connection is closed, output of the terminal below: Welcome ...
user avatar
  • 1
0 votes
0 answers
30 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 ...
user avatar
  • 190
0 votes
0 answers
15 views

Group Creation Function

I have Created a Linux function that will create developers, my requirement is to take the developer's first name and create a linux user and development environment. It should run something like the ...
user avatar
0 votes
1 answer
22 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 ...
user avatar
  • 1
-1 votes
1 answer
33 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 ...
user avatar
  • 99
8 votes
2 answers
930 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/...
user avatar
  • 181
0 votes
2 answers
35 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 ...
user avatar
0 votes
1 answer
43 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 ...
user avatar
0 votes
0 answers
17 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 ...
user avatar
  • 211
0 votes
0 answers
22 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 ...
user avatar
0 votes
1 answer
50 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 ...
user avatar
0 votes
0 answers
31 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 ...
user avatar
  • 1
0 votes
1 answer
46 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 ...
user avatar
0 votes
0 answers
60 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, ...
user avatar
0 votes
1 answer
21 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 ...
user avatar
  • 257
0 votes
2 answers
31 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 ...
user avatar
0 votes
1 answer
36 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 ...
user avatar
0 votes
1 answer
30 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 ...
user avatar
0 votes
0 answers
43 views

Login to softether VPN with GitHub Actions

I need my CI/CD on github actions to log into VPN in order to access ssh on server and deploy stuff. VPN server itself works fine, as I tried to do the same sequence on my linux machine and it worked ...
user avatar
  • 1
0 votes
0 answers
168 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=&...
user avatar
  • 1
0 votes
1 answer
67 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/...
user avatar
  • 33
0 votes
0 answers
77 views

Open the Windows c drive from Kali Linux

recently i am passing by a problem and i need help from you. I have a dell computer with two operating system (Kali Linux and windows 10),i made my windows in a hibernate mode and it shoot down due to ...
user avatar
1 vote
1 answer
106 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 ...
user avatar
  • 841
0 votes
1 answer
59 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/ ...
user avatar
0 votes
0 answers
34 views

CentOS - listing size of top-level directories in a 50TB NTFS volume is way too slow

What I want to achieve is get the information about how big are the top-level folders in a directory (which is a NTFS volume) on a CentOS7 server. This information is placed in a Prometheus file, ...
user avatar
0 votes
0 answers
37 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 ...
user avatar
1 vote
1 answer
114 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 ...
user avatar
-3 votes
1 answer
35 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 ...
user avatar
  • 39
0 votes
0 answers
46 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 ...
user avatar
  • 223
-1 votes
1 answer
45 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 ...
user avatar
  • 1
0 votes
0 answers
21 views

Docker station Iptables task

I have a virtual machine running on VBox. This VM contains the host and three dockers, let`s name the dockers as the_first, the_second, the_third. I want to apply a filter on network firewall with ...
user avatar
0 votes
0 answers
55 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 ...
user avatar
0 votes
1 answer
45 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 ...
user avatar
  • 1
0 votes
1 answer
47 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 ...
user avatar
  • 3,120
0 votes
0 answers
157 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**...
user avatar
0 votes
0 answers
28 views

Change assigned vpn IP on L2TP,PPTP

I have PPTP and L2TP configured on my Centos 7. I want to give users a custom IP when they connected. Linux itself does this in order of defined IP range, which I do not want, and I want the IPs ...
user avatar

1
2 3 4 5
69