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
2
votes
3 answers

Use SSH to execute remote export command and stay logged in

I have a simple problem of needing to execute an export command over ssh, and then stay logged in, but I'm having some trouble. Though I am interested in a solution to this problem for many reasons, the main one is so I can custom set my terminal…
wrangler
  • 3,080
  • 5
  • 24
  • 20
2
votes
2 answers

what does the command bash do when typed in a linux terminal?

When I type bash in to linux cli, it gives me bash-3.2$ so what does it do?
David
  • 1,067
  • 1
  • 10
  • 15
2
votes
3 answers

telnet: connect to address ::1: Connection refused

when I run '(sleep 1; echo flush_all; sleep 1; echo quit; ) | telnet localhost 11211' I get Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. OK Connection closed…
Radek
  • 1,153
  • 4
  • 26
  • 39
2
votes
5 answers

How can I track growing directories?

I have a system that continually runs out of disk space. Im going to write a script that cleans up directories that grow larger. Usually these are log directories. Given the nature of the machine, i dont need to keep logs. I want to write a script…
asdsadasds
2
votes
2 answers

Monitor a custom Java HTTP server from a bash shell?

How could I monitor a service port from a bash shell? I want to monitor a Java service (once per minute on port 9090) and then call "/etc/init.d/myservice -restart" if the service isn't responding with a simple HTML message. How would you do…
djangofan
  • 4,182
  • 10
  • 46
  • 59
2
votes
4 answers

Grouping records using shell

Is it possible to transform this: 1 Alice 1 Bob 1 Cary 2 Dan 3 Eve 3 Fred into this: 1 Alice,Bob,Cary 2 Dan 3 Eve,Fred using shell? (without Perl, Ruby, Python etc)
synapse
  • 499
  • 2
  • 6
  • 14
2
votes
1 answer

Tar not preserving Owner/Permissions

I have a file system backup in a tar archive, created with: cd / && tar -cpz -f mybackup.tgz usr/local Doing a tar tvzf mybackup.tgz yields: -rw-rw-r-- otto/otto 450 2010-04-15 22:08 usr/local/alpha-4.5/pkg/conf/PLATFORM/sparc drwxr-xr-x…
Frank Brenner
  • 175
  • 5
  • 11
2
votes
3 answers

How to read data from file containing variables

I have a bash script for initializing iptables. #!/bin/sh EXTIF="eth0" INTIF="eth1" INTIP="192.168.0.1/32" EXTIP=$(/sbin/ip addr show dev "$EXTIF" | perl -lne 'if(/inet…
Michael
  • 397
  • 1
  • 7
  • 15
2
votes
4 answers

how to change permissions of specific file type

file * | grep 'ASCII text' | chmod -x chmod: missing operand Try `chmod --help' for more information. The above command gives me error.Basically I am trying to find all the files whose type is ASCII and change their permissions to -x.What…
Registered User
  • 1,463
  • 5
  • 18
  • 37
2
votes
3 answers

Passing variables problem - Bash

I have a following problem: #!/bin/bash NUM=`cat accounts | wc -l`; for i in {1..$NUM} do account=`awk "NR==$i" accounts`; echo -e "\nAccount: $account\n"; sudo ./backup_maildir $account; done "accounts" is a file with regular e-mail…
Boban P.
  • 705
  • 1
  • 6
  • 20
2
votes
3 answers

How do I prevent PHP from executing shell commands?

how to prevent apache from executing bash scripts?? That any php script can't execute command in bash (for example command that will add links to my php and html files). Is there a way to do that?? EDIT: I had on my mind any bash command not only…
B14D3
  • 5,188
  • 15
  • 64
  • 83
2
votes
2 answers

The difference between su and bash

When I access the network server, I use the command sudo su to get admin privileges. Recently I found that sudo bash is the correct command and will allow me privileges those su does not. What is the difference between sudo su and sudo bash? I…
shantanuo
  • 3,579
  • 8
  • 49
  • 66
2
votes
1 answer

Why does the time it takes to run this script differ so much between user and system and how I might correct the discrepancy?

My application sits behind a load balancer, and every once in a while I like to do a status check on each machine to get an idea of the time it takes to return an index.html document on each machine. The script looks like this: for host in…
editor
  • 383
  • 2
  • 5
  • 21
2
votes
3 answers

filename start with *

I've got script, it must go through files to get specific lines from them. Filename get from variable, for example $FILENAME and we've got such situation: cat /path/$FILENAME but when FILENAME==*.some.file there is a problem. File *.some.file…
2
votes
3 answers

How to Use Crontab to display something to users on DISPLAY=:0.0 or run a GUI program

I really would like to be able to use crontab to update something every 3hrs, BUT crontab won't run my script with enough priveleges to run a GUI. Clarification: I have a complicated script that generates a picture (based on the current available…
palbakulich
  • 119
  • 1
  • 4