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
3 answers
58 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
21 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 "your_server_ip" spawn ...
Sreekanth Chityala's user avatar
0 votes
0 answers
45 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
58 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
56 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
60 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
70 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
46 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
33 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
50 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
  • 589
1 vote
2 answers
103 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
33 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
0 answers
53 views

Google Shell doesn't see uploaded CSV file

I used the 'Upload' option to upload two files to Google Shell. The zip file went in without any issues and it seems like CSV file as well (there was a green checkmark next to it after the upload was ...
Agnieshka's user avatar
0 votes
1 answer
74 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
  • 161
1 vote
2 answers
151 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
19 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
  • 1
-1 votes
1 answer
35 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
0 votes
0 answers
49 views

psql shell over ssh via bash script doesn't get user input

I'm opening a ssh connection and then go into a psql shell. This works, I get the prompt. I can also input commands like "\dt". But I don't get any output. As I can get output in general, I ...
steros's user avatar
  • 121
0 votes
1 answer
95 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,277
0 votes
1 answer
108 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
  • 101
2 votes
1 answer
233 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
  • 826
0 votes
2 answers
78 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
716 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
118 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
  • 349
0 votes
1 answer
96 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
48 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
113 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
84 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
771 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
495 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
204 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
1k 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
34 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
2k 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
  • 445
0 votes
1 answer
111 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
0 votes
0 answers
339 views

Gitlab runner fails when running too many job same time

I've set some scheduled jobs on gitlab. It is running some parallel jobs every minute and reaches about 500 simultaneous process . After some point runner throws below error and fails. Running with ...
ibrahim's user avatar
  • 431
1 vote
1 answer
450 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
94 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
1k 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 vote
2 answers
718 views

how to make a shell execute with suid

I'm trying to suid a shell and it's not working. I need help understanding why, and how to fix it... I'm following these steps (as root) cp /usr/bin/bash /usr/bin/bash-emergency chmod 4755 /usr/bin/...
mikem's user avatar
  • 448
0 votes
0 answers
122 views

Bash Shell Script Executing 3 Times in /etc/profile.d within Nanoseconds apart

g'day all.. in a spot of bother and a starter of ten for someone. I have placed a simple bash shell script into the root of "/etc/profile.d" and without fail, the script executes 3 times ...
user999317's user avatar
0 votes
1 answer
66 views

Way to know the current shell in a given terminal

I have a shell on a Unix system. Is there a command that can tell me which shell I am working ? (bash, zsh, etc. )
Bob5421's user avatar
  • 339
0 votes
0 answers
315 views

How to start a tmux session as a non-root/separate user service while also running a shell script?

I'm currently running an automatic service with the following content: Description=Valheim Dedicated Server [Service] User=steam Group=steam ExecStart=/opt/steam/valheim/start_server_bepinex.sh ...
Adephx's user avatar
  • 3
0 votes
2 answers
228 views

How to make timeout(1) behave in cron like it behaves in interactive shell

Running this command in an interactive bash: $ timeout 1 sleep 2; echo $? 124 returns 124 after 1 second, as expected and as documented in timeout(1). However, if I run the same as a cron job, or if ...
Sebastian Stark's user avatar
0 votes
1 answer
2k views

Setup Apache Docker container to keep running after executing php shell CMD

I'm trying to run a Docker container based on: PHP 8.1 Apache 2.4 MariaDB (latest official docker image) Dockerfile: FROM php:8.1-apache WORKDIR /var/www/html/ RUN pecl install xdebug \ &&...
DevelJoe's user avatar
  • 187
1 vote
0 answers
31 views

How can I install application as root and start and stop it as non root?

I have a script which will install mysql server, java and then my java application. I want to create a test user and group testg, the application will start and stop by non-root user (here test user) ...
user15566016's user avatar
0 votes
1 answer
619 views

Using Crontab to run a shell script with SSH

I’m trying to use a cronjob to run a shell script on my EC2 instance, which SSH’s to a server to get a mongodump of a database and restore at a given specific time without me having to login. I’ve ...
vincecalpari's user avatar
0 votes
1 answer
447 views

Shell script - Syntax error: end of file unexpected on Debian 11

I have an identical file on two systems but one system is running Debian 8 and the other is 11 #!/bin/sh ### BEGIN INIT INFO # Provides: warner # Required-Start: $remote_fs $syslog # ...
Maciej Cygan's user avatar
0 votes
1 answer
2k views

Difference between -t and -tt ssh

man ssh says: -t Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. ...
secf00tprint's user avatar
2 votes
0 answers
6k views

How to create .env multiline variable

The title may be a bit confusing, so a little explanation. I need to configure an application by passing a PKCS1 PEM encoded key using environment variable. The App is configured using a .env file ...
Krystian's user avatar
  • 306

1
2 3 4 5
28