Questions tagged [shell]

A shell is terminology for a command-line interpreter most commonly used with Unix-like operating systems, but also used to interact with GUI-based operating systems in a more granular fashion. Not only does it allows the user to run programs from a text interface, but frequently offers basic programming features such as variables, substitution, output redirection, and wildcards.

Filter by
Sorted by
Tagged with
1
vote
0answers
7 views

Script command on alpine

I want to preserve colors of docker exec command. The only way I found is to use script command like so docker exec <container_name> script -q -c "./spiral migrate:status" /dev/null The ...
0
votes
0answers
13 views

script to attach screen and run command but do NOT detach

I want to do something like this: #!/bin/bash screen -r session -X run 'long-cleanup-and-quit' doing-something-else ... Which is fine, but I want 'doing-something-else' to wait for screen. screen -X ...
0
votes
0answers
21 views

Jenkins credentials.xml merging to another jenkins credentials.xml

I am trying to merge the one jenkins instance into another instance where the credentials.xml is not merging rather replacing. Is there any possible way to merge either script or any helpful ...
0
votes
0answers
10 views

Ruby program start from console but fail from service & shell script

I'm a developer. I have a ruby program and I have to launch it as daemon. This program has a shell script #!/bin/bash dir=$(pwd) while sleep 60 do if pgrep -fa bin/bot >/dev/null then ...
0
votes
1answer
16 views

How do I issue a command only if an app is found?

I need some help with a bit of shell script. The code below works, and if sed is found then it continues with the script but if it doesn't exist it will exit. if ! [ -x "$(command -v sed)" ]; then ...
0
votes
1answer
21 views

How to separate variables using awk and append it to Text file using ansible

What I got as extra variable to ansible playbook is "CHOW_app/timmy_app1/johnn_app3/harper_app4/mona_app5". This is passed as single variable to the playbook. I have to separate it and save it in a ...
0
votes
1answer
15 views

moreutils chronic - append full output to logfile?

chronic, which is part of moreutils, is a great tool for selective failure-only email notification of cron tasks: chronic runs a command, and arranges for its standard out and standard error to only ...
0
votes
1answer
16 views

Capture client browser console using Shell and save it to a file

I want to find a way to capture a client browser console that is using my server, and save it to a file inside the server, is this possible using a shell script ?
0
votes
0answers
7 views

How to auto init direnv on Google Cloud Shell?

my .bashrc has these lines at the bottom: if [ -f $HOME/tools/bashrc ]; then source $HOME/tools/bashrc fi and $HOME/tools/bashrc has this code at the bottom: eval "$(pyenv init -)" pyenv ...
0
votes
1answer
21 views

Wich Shebang should you use in a shell sript?

Sorry, this is maybe a stupid question, but I am new to shell scripts. I have a file called oem-device-name.sh. I need to execute an external check for Zabbix: https://www.zabbix.com/documentation/5....
0
votes
1answer
27 views

How to grep lines only with matched words in Linux [closed]

I have a little question. I have a list of processes. After this command ps aux | grep postgres I see postgres 1178 0.0 0.2 320064 27060 ? S Apr12 0:05 /usr/lib/postgresql/10/bin/...
0
votes
1answer
25 views

Using multiple users in crontab script, silently fails when changing users

I'm trying to run a bash script on a centos server. I've running the script as the root user (both for file permissions), but I also need to use the aws service permissions that belong to a service ...
0
votes
0answers
18 views

non interactive shell locale

I'm running commands on a remote host via ssh where i'd like to have locale vars set. I do not care about the full profile scripts from a true interactive shell, just the locale vars. The minimum ...
2
votes
1answer
16 views

Bash - Math: Returns integer instead of float

Bash returns value 4 instead of 4.2 when dividing 21/5. And returns 36 when doing 9 * (21/5) instead of 37.8. echo "$(( 21/5 ))" 4 echo "21/5" | bc 4 Similarly ( 9 * ( 21/5 ) ) returns 36 but it ...
0
votes
2answers
38 views

uptime | awk -F: '{print $NF}' - What happens here? [closed]

Can someone explain me what happens here? uptime | awk -F: '{print $NF}' -F: field separator $NF: number of fields in the current line I don't understand why this command result in the same result ...
1
vote
1answer
26 views

How to quickly check if specific keywords exist in a lot of log files in shell?

I have run a program that writes a lot of log files in a lot of directories. For example, there are hundreds directories, and every one includes thousands of log files. I need to find out the files ...
0
votes
1answer
44 views

Occasional permission denied when getting logs using gcloud through Jenkins running as GKE

We are using a Jenkins project to run "gcloud logging read ..." from a shell to get logs from a gcloud container and we occasionally see a permission error in the script: ERROR: (gcloud.logging.read) ...
0
votes
2answers
65 views

cronjob every 4 weeks, will not executed

i using cron on my ubuntu headless server 18.04 and the following cron, will not executed: 30 13 * * 6 test $((10#$(date +%W)%4)) -eq 1 && /bin/bash /backup/test.sh i tested the command on ...
0
votes
0answers
45 views

Firejail not working over socks5 SSH tunnel

I have an Ubuntu 18.04 server in which I've created two virtual interface pairs (veth0a & veth0b) and assigned the end of one interface (veth0b) to a new network namespace (netns0): ip netns add ...
0
votes
1answer
21 views

LDAP Linux import user shell config files

I want to know if it's possible to import some user config files (shell config for zsh or bashrc for example) from our LDAP when a user login for the first time ? It's exactly what mak /etc/skel but ...
0
votes
2answers
40 views

Extract string from column with grep

I have a column based .txt file and I want to grep output the Common Name, having a little trouble. V 300223164711Z 01 unknown /C=UK/O=LMG/OU=server/CN=server/name=server/emailAddress=...
0
votes
2answers
33 views

Echo command, need substitution

i write a backup log script and have 2 variable in echo, but still doesn't work. My command : echo " DB-Size $(du -hs /backup/db/db_$(date +%F).sql " >> /backup/backup.log In my echo ...
0
votes
0answers
82 views

Using binary from docker container on a host

I am trying to seed a [DB2] database running inside a docker container, with a script sitting on the [MacOS] host. My problem is that when I run the seeder on the host, it wants to execute db2 command/...
1
vote
1answer
146 views

How can change shell for a user via ansible?

I have some ansible playbook: --- - hosts: servers gather_facts: false become: yes ignore_errors: yes tasks: - include_vars: users.yml - name: Check that user exists shell: "grep -q {...
0
votes
2answers
32 views

Copy binary file from other system with builtin shell commands only

I accidentally just have removed critical shared library and no one dynamically linked executable can't be run now. For example, even /bin/ls shows error while loading shared libraries: libunwind.so....
0
votes
1answer
20 views

Shell starts in edit only mode. No prompt shows up, no commands can be executed

My tcsh shows up in a weird manner. Be it as a login shell or in terminal, now it always starts with just a cursor. I can type a text in terminal but that's all about what I can do. No prompt does ...
0
votes
1answer
132 views

Execute command on LINUX via PUTTY from Windows [duplicate]

I want to open a putty session (SSH) from command line and immediately execute on the remote machine a specific command. Something like: putty.exe -ssh user@host -pw pass123 < "cd /some/...
0
votes
0answers
10 views

How do processes mask their arguments when listed by ps?

I've noticed that a certain command line utility masks a password passed to it with an argument, how does it do it?
1
vote
1answer
359 views

How do I mount the OS (system) disk from the UEFI shell?

I have to run a firmware update script that lives on the first hard drive of an Intel server board. I must use the UEFI shell to run this script, according to the Intel docs. (Our servers have no ...
1
vote
1answer
144 views

Echo something before SSH prompt with pam_exec

I want to echo some text from a pam_exec script after a successful SSH login (pubkey) but before the script itself exits (2FA purposes). Whatever the script prints during its execution is displayed ...
2
votes
4answers
604 views

How to copy a file from my Windows laptop to an Ubuntu server while using PuTTY? [closed]

I have a remote server and I connect it via PuTTY software. I've downloaded a file to my Downloads folder in my Windows OS laptop. Now, I have to transfer this file to that remote server, using SCP ...
0
votes
0answers
123 views

SSH Remote Port Forwarding not opening port

I am trying a remote port forwarding on a remote server (linux) with this (local is windows): putty.exe -ssh root@remote_host -R 55555:www.google.es:80 And the port is not open on the other side. ...
0
votes
1answer
92 views

Invoke remote program with socat and wait for it to complete

I need to invoke a program x on server foo from client bar. Program x takes some time to load, then reads input from stdin and transmits output to stdout before terminating. I've been trying to use ...
0
votes
0answers
17 views

Add more commands to Bash autocomplete

I've been playing around with the "complete" command and that works well if you want to add autocomplete functionality to an already existing command. Is there a way to "trick" the shell into thinking ...
0
votes
1answer
466 views

SSH hangs on “exec request accepted on channel 0”

I have a question that appears very similar to others that have been asked but none of them have answered my problem. I'm running into an ssh error on sending a command (not loading an interactive ...
1
vote
0answers
52 views

What is shell's maximum background jobs PID stored exit-codes?

When running a shell job in the background, the shell keeps track of the exit-code that can be retrieved with wait <PID>. When a new background job is run, it gets its own new PID, even if ...
3
votes
2answers
49 views

Looking for the Docker way to get just the 1st Repository Tag in “docker inspect”

I'm trying to find the proper way to get just the 1st Repository Tag of a Docker Image in a Linux shell. This can be achieved the ugly way by: docker inspect e77e5ce5d4e3 --format='{{.RepoTags}}' | ...
0
votes
0answers
71 views

Stopping a service stuck via ssh heredoc in a bash script after Centos 7.7 upgrade

I had this logic in Jenkins jobs to deploy code on remote host which was stopping a service and starting again. It was all working fine till recent Centos upgrade to 7.7 (CentOS Linux release 7.7.1908 ...
0
votes
1answer
40 views

How to extract the text inside a block in an HCL (HashiCorp Configuration Language) file using Bash? [closed]

I have a HashiCorp Configuration Language (HCL) file with this block. database = { gdb_name = "XXXXX" sid_name = "XXXXX" createContainerDB = "True" ...
0
votes
1answer
75 views

Log shell stdin & stdout

I'm trying to setup a bastion that I would like to log all commands executed and output to (ideally per-user) log files. I looked at auditd, and can see how to log commands executed to system I don't ...
1
vote
3answers
58 views

Server A tells server B to execute shell script - simplest way?

The question I have is vague, but it's vague on purpose because I don't want to bias the answers toward a needlessly specific solution. Let's say I have Linux servers A and B, where server A has a ...
0
votes
2answers
319 views

Limiting shell access for git users, but still allowing push / pull access

I'm host a git repository on my server. Anyone can push / pull from the following remote url: ssh://git@example.com/opt/git/my-project.git Specifically, anyone with ssh access to the git@example.com ...
5
votes
1answer
273 views

Is it possible to listen to a TCP port only with a shell, with no additional tools? [closed]

I need a very simple web server on a very small embedded system with a MISP processor. I thought that the simplest server could be a shell script listening to a TCP port. The problem is that the ...
0
votes
1answer
68 views

Cannot find my database when trying to import with mysql

When I connect to the mysql shell and do a SHOW DATABASES, i get this | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | rd7 ...
0
votes
1answer
39 views

Glob match recursive delete directories except a certain directory

How can I delete all directories recursively where the name starts with app-deployment-* except a particular directory with name app-deployment-245a578. I.E. delete all directories using a glob match ...
2
votes
3answers
314 views

CentOS 7 how to get interface name by macaddress?

I'm trying to figure out how I can get the network interface name and then change the name. Right now it's easy to change the name with this example: ip link set eth1 name <newName>; However I ...
0
votes
2answers
121 views

Parse Date from Text String in a 3 column format

I am given an array of lines from a text file. They look similar to this, and will always be structured like this: Full Tue Aug 27 10:59:43 2019 1 ...
0
votes
1answer
39 views

Error running commands using shell although successfully run line by line manually

I'm using centos7 RHEL on vagrant virtualbox, I'm making a shell file that when I activate vagrant it runs the commands in the shell file on the virtual OS. When I use SSH and run each line on ...
1
vote
3answers
131 views

How to run a shell script on a server farm periodically

I have a requirement to collect custom metrics (a shell script) from a logical server cluster every five minutes. This server cluster consists of 10 virtual machines. Once option i am familiar with is ...
1
vote
1answer
211 views

Shell script prevent switching to other shell or escape from it

If in my automation script, I need to do something like install oh-my-zsh, I will have a .sh script like this: #!/bin/sh runuser -l user -c 'sh -c "$(curl -fsSL https://raw.githubusercontent.com/...

1
2 3 4 5
25