Questions tagged [bash]

Bash is the Bourne Again SHell, the successor to the classic Unix sh (shell).

bash is the Bourne Again SHell, the successor to the classic Unix Bourne shell (sh). It's the default shell on many Linux distributions, including RedHat, CentOS, Debian, and Ubuntu.

The premier online guide is the BashGuide.

3527 questions
1
vote
2 answers

Strange set locale behaviour when ssh from Windows PuTTY to Linux

Please, can someone shed some light on this strange locales related warning annoying me since I installed my server half year ago. It's a variant of "Cannot set LC_CTYPE to default locale", which seems to be a pretty common issue, but mine has a…
Espinosa
  • 171
  • 1
  • 7
1
vote
2 answers

bash does not show prompt (prompt missing)

I have a server that does not show standard bash prompt, after I log out from the machine. If I ssh to this server, I can do all operation there (e.g. ls, cwd, etc) Tried to reinstall bash (sudo apt-get install --reinstall bash) also did not help,…
sateayam
  • 137
  • 2
  • 8
1
vote
1 answer

Sendmail bash script invoked by cron can't read from stdin

I try to write a little script that overwrites from adress of nullmailer. Nullmailer has an option "allmailfrom" you can put a mail adress into /etc/nullmailer/allmailfrom and all mails sent have this address as "Return-Path", but From is still the…
Hannes
  • 307
  • 2
  • 12
1
vote
1 answer

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.245.65 /bin/false I want to add an ip in the end…
user482363
1
vote
0 answers

Banning IP addresses after repeated login attempts to specific URL

I have a few questions regarding banning IP addresses after x many login attempts to a certain url on my website. Mostly, what would be the recommended or most efficient way? Example URL: https://example.com/login.php?=username&password I'm…
Yoshi Miro
  • 11
  • 1
1
vote
1 answer

Record ssh REMOTE_USER in audit or history logs

In our company we usually have a single production user user and we ssh to our servers via pasword-less login with ssh keys. Now, quite a few people work on those servers and sometimes we need to understand why changes were made and who made them.…
Roman
  • 143
  • 7
1
vote
2 answers

Send email if script outputs string

I found this line: sh script.sh | grep 'NO' 2>&1 > grep.log && /usr/bin/mail -s "grep found something" m@mail.com < grep.log which will write the output of script.sh to grep.log and then email that to an email m@mail.com Is there anyway to remove…
Kohjah Breese
  • 171
  • 2
  • 13
1
vote
1 answer

shell script to list directories in decreasing order of disk usage

I am looking for a shell script for Ubuntu Server that lists the disk usage of directories in a decreasing order. It should not list subfolders (recursively). The behaviour should be similar to the Treesize program on Windows and should be in a…
1
vote
1 answer

save hdf5 data when admin kills script

I have a lot of Monte-Carlo data that I need to process at a particular cluster. What I do is, for a given data sample (which is on average of size 70 GB), I run some statistics script in python on that data and I save it onto an hdf5 file, which…
firest
  • 11
  • 1
1
vote
2 answers

How do I use Nagios to monitor a log file that generates a random ID

This the log file that I want to monitor: /test/James-2018-11-16_15215125111115-16.15.41.111-appserver0.log I want Nagios to read it this log file so I can monitor a specific string. The issue is with 15215125111115 this is the random id that gets…
1
vote
1 answer

Crontab influences bash script if condition?

I am a bit baffled here, and not really sure how to debug this. I have a self-written bash script, that checks if a samba share is active, and if not, sends me an email. Script is in /root/SKRIPTS/, permission looks like this: -rwxr-xr-x 1 root …
Sebastian
  • 145
  • 6
1
vote
0 answers

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 script Have the script do a number of things to…
sfxworks
  • 157
  • 1
  • 8
1
vote
3 answers

Parsing Command Output in Bash Script

I need a bash script that takes the output of a shell command and parses that output to pull out the id, and website url for each line in the table that can then be used to execute additional bash commands. Here's an example of the command output.…
Phill Coxon
  • 33
  • 1
  • 1
  • 4
1
vote
1 answer

.bash_profile not read over parallel ssh connection (hss)

I'm using hss (https://github.com/six-ddc/hss) to connect to 3 Ubuntu servers (the same edition). The problem is on 2 of them ~/.bash_profile is not read over hss, even though it is being read when I ssh in individually to each. $ env | grep -w…
LetMeSOThat4U
  • 1,371
  • 2
  • 17
  • 35
1
vote
3 answers

How to compress spaces in bash command output?

I work on a small screen and I'm trying to make the output of this command shorter, but I cannot get it to work. Command: docker container ls --all Output (too wide!): CONTAINER ID IMAGE …
noctonura
  • 453
  • 1
  • 4
  • 10