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
238 views

Count down date time shell script [closed]

i have 3 parameters of date "Sep 30 Mon" (Month,DayNumber,Day), and i want to make a shell script that shows the quantity of days left to reach to Sep 30 Mon. How can i do it?
pepeargento's user avatar
2 votes
0 answers
61 views

wrapper command to record network use of a command

Is there any command like time that can record a process's network I/O stats and print them on exit? Linux (and other *nix) has the time command that lets you record execution times - not just wall-...
Craig Ringer's user avatar
  • 11.2k
1 vote
2 answers
884 views

Shell Scripting and Types of Text File Output RE: msinfo32

I ran the following script in my Windows 10 command prompt msinfo32 /report mysystem.txt, which saves all the system data of the machine in a single text file. However, when I ran strings on the ...
efw's user avatar
  • 111
1 vote
0 answers
2k views

why soft limit in /proc/{pid}/limits is different with ulimit -Sn

I found hard limit value in /proc/{pid}/limits match the output of ulimit -Hn while soft limit value doesn't my example output: tomcat@myLinux:/home/azhang$ ulimit -Sn 1024 tomcat@myLinux:/home/...
actan's user avatar
  • 111
0 votes
1 answer
1k views

PFSense enable private access via shell

I was setting up a new PFSense and I managed to tick "Block private networks and loopback addresses" on the LAN interface. Is there a shell command through which I can disable that? I know I'm ...
user757392's user avatar
1 vote
1 answer
81 views

Enter at the end of a specific line

I have the following file.txt that follows the same pattern and I want to modify it where this file is by adding an ip: # gfhfhgfh gfhfghgfhgfhgfh MACs # access USER CONSOLA *,!10.249.247.3,!10.249....
user avatar
2 votes
1 answer
193 views

How to create a new user that can login to SSH and execute a set of commands

I'm trying to setup new users for a particular directory but I want them to be able to see just one directory (and subfolders). For example: I have a server that has the following directories: ...
JohnnyAce's user avatar
2 votes
3 answers
5k views

Achieving very fast (300+MB/sec) file transfer on Linux

I'm working with high end hardware, however I'm hitting cpu bottlenecks in all situations when attempting to move large amounts of data. Specifically, I'm moving large virtual machine image (VHD) ...
epea's user avatar
  • 406
2 votes
1 answer
10k views

How to start a jar file using systemd

I want to start java application on system boot using systemd. I tried to do by adding above scripts. But service is not starting. my-startup.service [Unit] Description=Startup [Service] ExecStart=...
Janith's user avatar
  • 223
7 votes
4 answers
14k views

How to fix a tmux session messed up by control characters

Every once in awhile, I'll accidentally blast some control codes into my terminal session (either errant coding or accidentally gpg --export). This sometimes causes my tmux session to loose it's ...
Server Fault's user avatar
  • 3,774
1 vote
0 answers
286 views

Create a screen. Run said screen as a user. Detach

I'm essentially trying to combo Create screen and run command without attaching and another answer that allowed me to run a script as another user. I want to SSH from Server 1 -> Server 2 and run a ...
sfxworks's user avatar
  • 157
-3 votes
1 answer
1k views

bash ftp change directory on remote server

I have a shell script that FTPs some non-sensitive data to a remote server. However, I would like to set the remote path rather than just use the remote FTP user's default path. I have searched for ...
Ally's user avatar
  • 97
0 votes
1 answer
2k views

Command that returns exit code still returning 0 when using "command 2>&1 | tee -a /var/log/file.log"

I'm running a script that executes a command and save the output to a file in /var/log. After that, it gets the exit code and execute another command based on an if/else condition. The problem is: 2>&...
Asdra's user avatar
  • 105
0 votes
2 answers
3k views

How to find file and combine `find ... -exec` and echo empty string to it?

I want to echo empty to such file types, for example: bash-3.2$ cat t1.txt aa bash-3.2$ cat t2.txt aa bash-3.2$ cat t3.txt aa I've tried to make them empty by: $ find /Users/liweijian/Downloads/...
alwaysday1's user avatar
0 votes
2 answers
2k views

Bash function doesn't work for remote ssh command execution although interactive shell function fine

I define a function in .bash_aliases file and include it in my .bashrc file. My .bash_aliases file: function dmidecode() { if [[ $1 == -t && $2 == 1 ]]; then cat ~/...
dibugger's user avatar
  • 101
1 vote
1 answer
122 views

Can GNU screen leave you at shell prompt after command instead of exiting the TTY?

I commonly need to run a specific screen session with 9-10 windows, most of which need to run either an interactive command, or simply a setup-type of command. I do this via screen -c <config-that-...
Larold's user avatar
  • 812
2 votes
1 answer
12k views

FTP PAM Setup for VSFTPD

OK. I know this is one of the most asked questions here. But most answers are either telling me to add nologin to allowed shells (nope... not doing that) or disabling SELinux (which i don't have - ...
echo_salik's user avatar
0 votes
3 answers
4k views

Allowing SSH To use ssh-agent in bash script

I am working on recon for a set of systems my company is taking over and they use a different authentication method than we do. Specifically we use AD auth and a jump server to access systems where ...
Ryan Smith's user avatar
1 vote
3 answers
791 views

If run as a cronjob my shell script doesn't launch a screen

Please have a look at the following simple shell script startCleanup.sh: #!/bin/sh screen -d -m -S cleaner /usr/bin/python3 /opt/cleanup.py My crontab looks like this: * * * * * /opt/startCleanup....
toom's user avatar
  • 227
1 vote
1 answer
12k views

Jenkins - environment variable not setting up from pipeline

Here is my script. Im trying to set up variables in pipline shell script: node { anyconnect = docker.image('anyconnect:1').run("--cap-add NET_ADMIN --cap-add SYS_ADMIN --device /dev/net/tun:/dev/...
user3069488's user avatar
4 votes
1 answer
2k views

Ctrl+C no longer working to get a new blank line in bash

I have been using Ctrl+C on most terminals to easily cancel the line I was writing and open the way for a new line. (I'm not talking about killing a running bash script, but just opening a new blank ...
Cyril Duchon-Doris's user avatar
1 vote
2 answers
690 views

Bash script as use shell not working with SSH

I'm trying to use a specific bash script as a user shell. So that if the user logs in, the script will be executed. I've created the script and placed it into the home directory for the specific user....
user485485's user avatar
1 vote
1 answer
564 views

Execute actions after specific commands in Apache Guacamole SSH

I setup Apache Guacamole 0.9.14 on my CentOS 7 with nginx as reverse proxy to it. I want to give limited access to some of my employees for some of my servers via ssh. Some of them are SFTP enabled ...
Amin Vakil's user avatar
0 votes
1 answer
406 views

Bash SFTP Script - Too many login attempts looks like a DOS attack

I've managed to write a bash script, based on someone's previous work, to send out files via SFTP to a Limoma GoAnywhere application. I'm not fluent in bash or shell. Unfortunately, the GoAnywhere ...
jjwdesign's user avatar
1 vote
1 answer
3k views

Issue to get Cookie: JSESSIONID and auth_cookie

I wanted to execute one API using the command line but need to pass Cookie: JSESSIONID=<>; auth_cookie=<> value while executing it. We have CAS authentication for the target API. Please let me ...
Sunil Bhoi's user avatar
0 votes
1 answer
133 views

Reroute IP to different IP, but there is a catch

This is not the normal reroute IP through iptables but it is a bit more complicated. I am using a very stripped down version of Busybox. The version has dropbear installed only a few limitations. It ...
Sir Siles's user avatar
0 votes
1 answer
238 views

Defining array in shell script

I am trying to define array in my shell script which would have content like below cassandra_hosts=(cassandra1.test-dev.local cassandra2.test-dev.local cassandra3.test-dev.local) But it doesn't let ...
Shailesh Sutar's user avatar
0 votes
1 answer
852 views

Grep returns nothing

This is the grep command I used grep -ic address log* The output is 0. I know for a fact that there are more than 60 occurrences of the word address in the log file. But I still get 0. Now, I ...
searcot jabali's user avatar
1 vote
3 answers
168 views

Sed or other script, and regexp solution for cutting a filename

What I need is to get 2-3 variable from filenames. I use: FILES=$(ls -tr .../Files/) for f in $FILES; do ...... The files look like this: [letters and/or numbers and (underscore or nothing)][6 ...
Zalan's user avatar
  • 23
1 vote
1 answer
843 views

rsync - on uncleaned shell and connection unexpectedly closed

I want to run rync to a remote server which has an uncleaned shell. If someone tries to connect it via ssh shell, it'll show some warnings. Due to this issue I couldn't able to copy files. protocol ...
TheDataGuy's user avatar
1 vote
1 answer
266 views

Pipe filenames onto Rubocop

I'm trying to pipe filnames into Rubocop as such: $ git diff --name-only | tr '\n' ' ' | rubocop However Rubocop still checks all project files. Is there something wrong on my piping? On Rubocop? ...
bjacquet's user avatar
-2 votes
1 answer
41 views

sed search and add some sting

======KVM 虚拟化手册====== =====简介===== =====安装和配置kvm虚拟化===== ====检查是否支持KVM==== ====安装kvm虚拟化平台==== ====配置nested virtualization==== ==== 配置网络==== ====重启系统并检查相关配置==== =====virsh创建 & 安装虚拟机===== ====...
mrco's user avatar
  • 189
0 votes
1 answer
3k views

ansible-playbook doesn't work inside a bash script

I am not sure what is going on and hence I enquiring here as well in hopes that some of you might. I am trying to figure out why the same one-liner will successfully connect on my remote server ...
Central's user avatar
0 votes
2 answers
6k views

Bash script: save last line output from terminal

I am writing a bash script in which I would like to save the output of the last command in to a variable before running my next one so I can display it later. I have tried a few different methods ...
0siris's user avatar
  • 13
0 votes
0 answers
670 views

linux sh -c replace echo not working

This seems like it should have a super simple answer, but I have search for a while and tried different suggestions to no avail. As an example, I am trying to create a function that will be available ...
syntencoist's user avatar
3 votes
3 answers
12k views

Execute local bash scripts on remote server but needs user input

I am using SSH command to execute the bash scripts remotely: ssh user@server 'bash -s' < $script_dir/script.sh And inside the script.sh, I will have the command like below to add ssh keys: ssh-...
Eva Cheung's user avatar
1 vote
1 answer
152 views

Can auditd logs be modified? (Security, shell monitoring)

I recently set up auditd and enabled TTY logging so I could give someone non-root shell access and monitor what they're doing. (For what it's worth I gave them jailshell access, a cPanel feature that ...
Dan's user avatar
  • 113
0 votes
1 answer
476 views

Why is this shell command always returning 1?

Here is a shell puzzle I can't answer (bash). This returns exit code 1: ping $HOSTNAME -c2 -W2 2&>1 > /dev/null This returns the correct exit code every time (2, 1 or 0). ping $HOSTNAME -...
user9693907's user avatar
-2 votes
2 answers
1k views

Shell script to enumerate the (already existing) LDAP group called "VPN Users"

I am new to LDAP and learning about the ldapsearch and ldap in general. Would like to write a shell script that enumerate the (already existing) LDAP group "VPN Users", then get all user "...
Irina I's user avatar
-1 votes
1 answer
674 views

How to pass variable into bash script and use seperate variables with awk?

I have a script that I am using to clear out all lines of a log files older than X days. X can be passed in via command line as well as the log file name, ex usage: ./purge-catalina.sh 3 /opt/...
ninjasense's user avatar
0 votes
3 answers
648 views

Use variables in paths in crontab

The crontab I use is more complex but I broke the problem down to a minimal problem set. My crontab is working like this: mypath='/home/user/opt/script_home' myscript='/home/user/opt/script_home/...
watnuss's user avatar
0 votes
2 answers
504 views

How to make a shell script return 0 even after getting killed

I have a scheduled shell script running in a distributed environment. There are some scenarios where the process might get killed by some other processes. But I need the process to return 0 even after ...
pkgajulapalli's user avatar
0 votes
1 answer
3k views

Running tcsh scripts on startup in bash env

I have a user called foo which is using tcsh by default in /etc/passwd. I cannot change that default shell. Foo has a service called xyz running, for which all the startup scripts and .(dot) file ...
shivams's user avatar
  • 499
0 votes
2 answers
140 views

Exclude certain disk in dd command script for disk erasure

for disk in $(lspv | awk '{print $1}') ; do dd if=/dev/zero of=/dev/${disk} bs=1024 count=$(bootinfo -s ${disk}) echo $disk wiped done How do i exclude certain disks like hdisk0,hdisk1 and ...
Adel Farhad's user avatar
1 vote
0 answers
226 views

AIX server DOD method for secure erase disk [duplicate]

I would like to know how can i securely erase disk on AIX as per DOD standards? any utility i can download and use on aix server rather using regular dd or diag command? Appreciate your help! ...
Adel Farhad's user avatar
2 votes
2 answers
1k views

Files uploaded using SFTP does not have the correct rights

I have a weird issue when trying to upload files to a server using SFTP. When for maximum security I use a user with a disabled shell ("/bin/false") to upload files, I get mode 640 for the uploaded ...
ob_dev's user avatar
  • 93
-1 votes
1 answer
3k views

No such file or directory linux shell script

#!/bin/bash mysql -uroot -pwelcome1 < /home/sai/first.sql echo "The program has completed" I am trying to call a sql file from shell script ,I am running the script as bash run.sh, but it telling ...
Saiteja Srirambhatla's user avatar
0 votes
4 answers
3k views

How can I run select commands on multiple servers from a shell script?

How can I execute scripts from arguments on multiple servers? I'm trying to build a command list, and then execute commands on each server. I'm unable to generate the command list in a way that can ...
Ryan's user avatar
  • 420
-1 votes
1 answer
169 views

Checking if a programm is running on linux

i'm trying to check if a program on a linux server is running and start it if not. But i get strange errors: #!/bin/sh SERVICE=nrpe ps -ef | grep -v grep | grep $SERVICE | wc -l if [ $? -gt 1 ] ...
Kjellson's user avatar
4 votes
1 answer
1k views

Linux - Limit user to one application in ssh

This is something that I looked into a while back and found some useful info for... but now that I actually need to do it, of course I can't find that guide I saw anymore. Anyways, here's the ...
mywarthog's user avatar

1
3 4
5
6 7
28