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.
1,364
questions
0
votes
1
answer
52
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, ...
1
vote
1
answer
143
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://\${...
0
votes
0
answers
28
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 ...
0
votes
1
answer
50
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 ...
0
votes
1
answer
27
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 ...
0
votes
0
answers
14
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.
0
votes
1
answer
124
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
...
0
votes
2
answers
95
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# ...
0
votes
0
answers
90
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 ...
0
votes
3
answers
261
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 ...
1
vote
0
answers
119
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 ...
0
votes
0
answers
53
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 ...
0
votes
0
answers
155
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 (...
-3
votes
1
answer
69
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
...
0
votes
1
answer
61
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 ...
0
votes
0
answers
95
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/...
0
votes
1
answer
51
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 ...
0
votes
0
answers
107
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 ...
0
votes
0
answers
101
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.
...
1
vote
2
answers
332
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 ...
0
votes
0
answers
52
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....
0
votes
0
answers
57
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 ...
0
votes
1
answer
238
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 ...
1
vote
2
answers
292
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=...
0
votes
0
answers
23
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 ...
-1
votes
1
answer
38
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 ...
0
votes
0
answers
67
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 ...
0
votes
1
answer
165
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
(...
0
votes
1
answer
180
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....
2
votes
1
answer
312
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"
...
0
votes
2
answers
100
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 ...
0
votes
1
answer
1k
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 ...
0
votes
2
answers
183
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 ...
0
votes
1
answer
139
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(...
0
votes
0
answers
58
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
...
0
votes
1
answer
130
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, ...
1
vote
1
answer
93
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 ...
5
votes
2
answers
876
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 -...
1
vote
1
answer
790
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 "...
0
votes
1
answer
397
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 ...
0
votes
1
answer
2k
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:
...
-1
votes
1
answer
35
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 ...
5
votes
1
answer
3k
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 ...
0
votes
1
answer
135
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 ...
1
vote
1
answer
623
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 ...
1
vote
1
answer
123
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 ...
0
votes
2
answers
2k
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 ...
1
vote
2
answers
1k
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/...
0
votes
0
answers
138
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 ...
0
votes
1
answer
85
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. )