Skip to main content

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
0 votes
1 answer
72 views

Ansible: how to explain that sometimes $HOME environment variable is set and sometimes not?

With ansible it seems that sometimes the following code will work as expected: - name: "copy some script" become: yes become_user: "{{ tomcat_user }}" ansible.builtin.copy: ...
Nico's user avatar
  • 156
0 votes
0 answers
28 views

Issue connecting to remote server using SSH with Private Key

I am trying to connect to a remote server using SSH with a private key protected by a passphrase in a shell script. When I run the command below, it gets stuck: shell sshpass -p Todayis1 ssh -i id_rsa ...
Raghu's user avatar
  • 1
0 votes
1 answer
27 views

using sed to replace a string between quotes '12h' by '3h'

I am trying to use sed to replace a string like '12h' by '3h' sed -i 's/length_s = '12h'/length_s = '3h'/g' my_files but it didnt work
Rabah's user avatar
  • 1
1 vote
2 answers
430 views

Storing top output to a file continuously

I'm currently using top to gather the most resource intensive processes and sending them to influxdb. Currently, the command is like this: top -bn1 -c -w250 Which basically runs top a single time (-...
Leandro 86's user avatar
0 votes
1 answer
92 views

cd command not recognized by a systemd service script

Hi run Debian OS and I have a shell script that runs sphinx search. The script runs fine if I run it from terminal as below: sh /home/myuser/sphinx/run_sphinx.sh Here is the content of run_sphinx.sh #...
Dev Dev's user avatar
  • 31
0 votes
1 answer
356 views

How to convert text file from BASH to HTML?

I already extract some text from bash using command "systemctl status ddos.service" bellow : But, when I generate report in html for text that I extract above, it show all text in one line, ...
M. Fachrizal Utama's user avatar
2 votes
1 answer
461 views

HEREDOC in Dockerfile produces no output

I have this command that I am trying to run in a Dockerfile and it is producing no output to the file: FROM alpine:3.19 as base RUN <<-EOF > /root/.npmrc registry=https://\${...
Christian Bongiorno's user avatar
0 votes
0 answers
53 views

Dynamically Set GitHub Actions Secrets on Docker Container Build/Run Command with bash/shell

I'm in the early stages of building an automated pipeline. Still in the exploring phase. Right now, I'm struggling with setting the environment variables for the container I'm going to run my app and ...
Jorge Mauricio's user avatar
0 votes
1 answer
158 views

Set GitHub Actions Secrets on Docker Container Build/Run Command

Set GitHub Actions Secrets on Docker Container Build/Run Command I'm in the early stages of building an automated pipeline. Still in the exploring phase. Right now, I'm struggling with setting the ...
Jorge Mauricio's user avatar
0 votes
1 answer
62 views

argument to pgrep from cmdline returns 2 PID's and argument from global variable value returns 1 PID

1.first case(processName as argument from cmd i.e java) command from cmd with arguments : ./a.sh getProcessId contains java code: getProcessId(){ matchType=$1 #defaulting matchArg to x i.e exact ...
Nitin Alety's user avatar
0 votes
0 answers
19 views

How can I initiate a file transfer between two remote VMs on Google Cloud using nodejs?

I need to automate a process such that when a nodejs function is fired a remote source sends certain files to a remote destination VM. I’ve been looking everywhere but can’t find any easy solution.
averroes's user avatar
0 votes
1 answer
288 views

pgrep -f from shell script is returning 2 pid instead of 1

code : function main { [ -z "$@" ] && { getProcessId "$@" } || "$@" } getProcessId(){ matchType=$1 #defaulting matchArg to x i.e exact match matchArg=x ...
Nitin Alety's user avatar
0 votes
2 answers
301 views

change shell to /usr/bin/false in IBM aix os

I would define the program run for the user at session initiation into /usr/bin/false in /etc/passwd. The default value parameter is /usr/bin/ksh. When I try to modify it with commands: bash-5.1# ...
medisamm's user avatar
  • 111
0 votes
0 answers
157 views

My terminal shows other's login information

I acturally asked the same topic on stack overflow and community said that is not suitable there. So I'll try to post it here. I logged in my debian 12 server with Windows Terminal, and hang up there ...
Akron Blim's user avatar
0 votes
3 answers
847 views

Shell script capturing values from output of command

From a shell script, I run a ping command: ping -c4 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=58 time=34.2 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=58 ...
Simon Kepp Nielsen 's user avatar
1 vote
0 answers
191 views

unable to send response in expect command

I'm running below command and I'm also sending response using send but its not taking any input. kindly tell me where I'm missing? #!/usr/bin/expect -f set server_ip "<server?" spawn ...
Sreekanth Chityala's user avatar
0 votes
0 answers
64 views

File is immediately deleted after using cat

I'm currently facing an extremely strange issue I'm not sure where to begin to diagnose. I have a directory of log files written using winston (and its daily rotate transport). When I go in that ...
Maximilian Krause's user avatar
0 votes
0 answers
298 views

Certbot cannot obtain certificate when firewall is on

I have a script that creates a new nginx configuration for some domain and within this script, I am requesting new certificate via certbot. I am running newest debian server with ufw enabled (...
Johnczek's user avatar
  • 111
-3 votes
1 answer
78 views

I want to make a sell script to input text into a command in debian

I am sorry if I am having trouble explaining, here is my issue, I want to make a basic shell bash script say x.sh and I want to run command change htpasswd -b -c /etc/squid/squid_passwd root pass ...
Nova's user avatar
  • 5
0 votes
1 answer
62 views

Why executable files (mode x flagged) under a folder cannot run?

I thought that a script file under my /data folder cannot be executed is because it is not set 'x' permission , but after chmod +x, it still cannot run, even my handmade simple test script cannot if I ...
Michaelzh's user avatar
  • 113
0 votes
0 answers
131 views

I am an LDAP user. Why can't I change my shell despite being listed in /etc/shells?

I can't change my shell. The following shell output shows what I have tried. How can I change my shell to /usr/bin/fish? [michael@vps ~]$ chsh.ldap -s /usr/bin/fish michael /usr/bin/chsh.ldap: /usr/...
Michael Tsang's user avatar
0 votes
1 answer
72 views

How to do fuzzy match with linux alias

I usually use "root" to login in my linux, but I want to make shell forbid my dangerous command like fio --name=test --filename=/dev/nvme0n1, as /dev/nvme0n1 is my OS-drive. So, how to ...
user42792's user avatar
0 votes
0 answers
139 views

Trigger OS shell script post kubernetes container boot

I am running truenas scale 23.01 with kubernetes. On the system I have a container X and a small app Y running natively that interacts with this container through its local IP and port. Whenever ...
cmplieger's user avatar
  • 101
0 votes
0 answers
205 views

Possibility to handle HTTPS connections by retrying failed ones via proxy, solve occational "connect: connection refused"

Sometimes I receive this error: Error: Get "https://example.com/etc/etc": dial tcp 10.0.0.1:443: connect: connection refused The connection fails occasionally. When I try again, it works. ...
laimison's user avatar
  • 639
2 votes
2 answers
774 views

Why doesn't systemd capture output from subprocesses of a user service written in shell script?

Here is my amazing service, written in shell script: $ cat ~/junk/demoapp #! /bin/bash -eu while true do echo "in shell" ( echo "in subshell" ) /usr/bin/echo "in ...
Tom Anderson's user avatar
0 votes
0 answers
96 views

extend snmp with static oid

I encountered the same problem as you, did you finally solve it? I want to set a specific oid to specify the execution of a shell script, but the final oid changed. the snmpd.conf is https://image....
Mag Yoki's user avatar
0 votes
1 answer
381 views

Passing a user input to an ssh command

I'm currently trying to create a shell script that will execute a mysqldump on a remote mysql database and then copy the output file back to my local machine. The problem I'm running into is that I ...
pbuchheit's user avatar
  • 171
1 vote
2 answers
552 views

Linux: Run a specific command as another user?

I want to be able to allow users to run a specific command as another user, is this possible? I have a script that reads a remote file through ssh to get a status, something like: #!/usr/bin/sh state=...
Andrew's user avatar
  • 11
0 votes
0 answers
25 views

Re-connect to shell and e2fsck [duplicate]

My server disconnected my SSH session which had a e2fsck running and I would like to re-connect to the shell and see the e2fsck output. I logged into my server via SSH and started a e2fsck on a 3TB ...
Marc's user avatar
  • 101
-1 votes
1 answer
50 views

Extract Pages from Various PDF Files into New PDF File [closed]

From a.pdf, I would like pages 2 and 5 b.pdf, pages 3 and 4 c.pdf, pages 7, 8, and 9 copied into a new PDF file. All input pdf files are ten pages long. I'm using bash, and plan to make many ...
lmat - Reinstate Monica's user avatar
1 vote
1 answer
294 views

How to save input colors in awk?

I've seen many more or less related topics, but all I found discuss how to color awk output. I need to preserve the color that was provided as awk input. For example, now I have: ./some_command (...
Putnik's user avatar
  • 2,387
1 vote
1 answer
242 views

Any way to see output of pv when run in subshell?

I'm creating a squashfs file using dd to create a pseudo file - like described here ("under Streaming Compression" heading): mkdir empty-dir mksquashfs empty-dir squash.img -p 'sda_backup....
localhost's user avatar
  • 111
2 votes
1 answer
422 views

detect if zone transfer with dig succeed or not via return code

I have script like this CHARSET=ASCII dig domain.com AXFR > domain.com.zone if [ "$?" = "0" ]; then echo "OK" else echo "Something went wrong" ...
Nick's user avatar
  • 882
0 votes
2 answers
119 views

crontab shell script execution not as expected

I have a script named run_logs.sh with the contents: #!/bin/bash source /root/.profile zcat /var/log/apache2/access.log.*.gz | /usr/bin/goaccess - access.log when I run that script as root (both with ...
kevincw01's user avatar
0 votes
1 answer
2k views

"PTY allocation request failed on channel 0" with CertificateFile

I have a problem with TTY allocation when I try to connect via ssh with trusted certificate containing public key. If I perform classic ssh access with the user, e.g. ssh -i test-key-for-vault -o ...
Sim Sca's user avatar
0 votes
2 answers
274 views

Command that run fine... but give me an error when "piped" to grep, inside a docker RUN?

Sorry for the title, I really can't explain better. I'm learning shell programming. I'm trying to detect if Composer has a script named "post-install-cmd". To do that, one can call composer ...
gremo's user avatar
  • 359
0 votes
1 answer
223 views

Limited shell for debian

I'm looking into a limited shell option for Debian. The idea is to have a shell with limited access and commands for specific users. The user would log in to this shell and have limited access(...
zerocool's user avatar
0 votes
0 answers
85 views

How can I split a set of bytes into separate parts

$ du -b 1GB.bin 1048576000 1GB.bin $ split --verbose -b 120M 1GB.bin && du -b *xa* 125829120 xaa 125829120 xab 125829120 xac 125829120 xad 125829120 xae ...
GERATISAN's user avatar
0 votes
1 answer
162 views

Cleaning up WordPress thumbnails; trying to find all thumbnails and delete them on Ubuntu 22

So, I'm trying to clean up some backups I have, and they're getting bigger and bigger because of, mainly, the number of thumbnails generated by WordPress per image. I came close to finding a solution, ...
AJ Tatum's user avatar
  • 103
1 vote
1 answer
107 views

zsh completion ( compctl ) does not trig for command names containing dashes

I've used zsh compctl since forever (late 90s or early 00s) but strangly never run into this before. I realized today when I intended to make some compctl config for update-alternatives that my ...
fraxflax's user avatar
5 votes
2 answers
1k views

pgrep returns extra processes when piped by other commands

Here is a very strange question about using pgrep to search which shell processes are running the same script as the current one. Here is the test script named test.sh #!/bin/bash full_res=`pgrep -a -...
machinarium's user avatar
1 vote
1 answer
1k views

Windows Feature Update Silent Install

We are trying to push out the latest Windows Feature update via our RMM but when running it doesn't appear to do anything. We've tried running the following: PowerShell Start-Process -FilePath "...
Ronald Simmons Jr's user avatar
0 votes
1 answer
697 views

How to compress a directory, using tar, and then delete the directory it compressed?

On my server there is an application directory that I need to make a full copy of it but the copy takes up a lot of space, I need to compress it and then remove it. I already use the command tar -czf ...
José Ferreira Neto's user avatar
0 votes
1 answer
4k views

MySql: ERROR 1045 (28000): Access denied for user 'root'@'localhost' although password is okay

I run Debian 11 with mariadb and everything worked fine. Just yesterday I saw that different commands, such as "/etc/init.d/mariadb reload" or "mysql -u root" bring the error: ...
afriend's user avatar
  • 111
-1 votes
1 answer
39 views

why shell discard my string of variable

[root@es01 ~]# redis-cli -h IP_ADDRESS -p 6380 -a admin info 2>/dev/null|grep config_file|cut -d: -f2 /opt/redis/7.0.5/cluster/redis-6380.conf [root@es01 ~]# cat $(redis-cli -h IP_ADDRESS -p ...
redliquid's user avatar
5 votes
1 answer
5k views

Change Alpine Linux default shell

Alpine defaults to ash as the login shell, I want to change it to bash. What I did so far: installed bash by sudo apk add bash installed shadow by sudo apk add shadow I changed my user's login shell ...
elsni's user avatar
  • 465
0 votes
1 answer
164 views

Webmin backup via ssh not working with remote rush shell

I want to make backups from Webmin, initially the configuration backups, to a remote server securely. I'm new to Webmin and to rush. This seems to be a config issue with Webmin, rush, or sshd. My ...
Norman Henderson's user avatar
1 vote
1 answer
810 views

'mail' not working in Script same way it is working from command line

The below line of code/command is working as expected if I run it from Unix terminal, but not if I include it in a script and run the script - exact same. I am expecting the X-Priority to show the ...
akpuvvada's user avatar
1 vote
1 answer
168 views

lighttpd 1.4.46+ serve specific file based on $HTTP["useragent"]

I have a lighttpd server version 1.4.46+ on Linux which serves file1.xml and file2.xml from htdocs directory as is. There are clients that request these files, each of those send a User-Agent header ...
FearDC's user avatar
  • 13
0 votes
2 answers
3k views

Reloading /etc/ld.so.preload without starting a new shell

I'm adding a preload library using /etc/ld.so.preload. My problem is, it doesn't take effect until a new shell is created. This also happens if I remove the preload library. I get error messages for ...
Laplie Anderson's user avatar

1
2 3 4 5
28