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

Anybody knows if there is a counterpart for CTR+w , that deletes immediate words after cursor

I mean when the cursor is on the left side of the words ,I would like to remove the words on the immediate right side of it . CTR+k remove everything on the right side, i only want one word to be removed.
Eric
  • 21
  • 1
2
votes
2 answers

Bash Parallelization of CPU-intensive processes

tee forwards its stdin to every single file specified, while pee does the same, but for pipes. These programs send every single line of their stdin to each and every file/pipe specified. However, I was looking for a way to "load balance" the stdin…
ehsanul
  • 427
  • 1
  • 8
  • 19
2
votes
5 answers

Total disk space used for one directory including it's sub-directories

On a Linux environment. How can I find out the total space a folder is taking. It would like this total to include ALL sub-directories in the total. I don't want a dump of the size of each subdirectory. Just the total size a directory is taking…
Marlon
  • 535
  • 2
  • 10
  • 14
2
votes
3 answers

tail -f and then exit on matching string

I am trying to configure a startup script which will startup tomcat, monitor the catalina.out for the string "Server startup", and then run another process. I have been trying various combinations of tail -f with grep and awk, but haven't got…
Patrick
  • 192
  • 1
  • 3
  • 10
2
votes
2 answers

Please explain this BASH code (one line)

Never seen this used before in BASH: pidfile=${PIDFILE-/var/run/service.pid} The part I've never seen/used before is the ${PIDFILE- part.
drewrockshard
  • 1,763
  • 4
  • 20
  • 27
2
votes
5 answers

In bash how do you delete a partial word similar to ctrl-w

Say I have a directory with one file in it mylongfilename.blahdeblah.txt now the keystrokes mv [tab] [tab] will result in mv mylongfilename.blahdeblah.txt mylongfilename.blahdeblah.txt on my command line What I'd now like to do is type something in…
nevster
  • 123
  • 5
2
votes
1 answer

Bash build environment settings

I'm newbie in Bash and I'm using MinGW as a GCC compiler. I have .profile in my home directory which sets building environment. Here is .profile content. What's a difference in commented/uncommented lines? Why GCC doesn't work with uncommented…
Toktik
  • 147
  • 9
2
votes
5 answers

Bash script to replace a file if it has a particular string

I have a list of files that I want to check for a particular string. If the string exists in the file, I want to replace it with a new version that I have. What is the easiest way of going about this?
Alexander
  • 21
  • 2
2
votes
3 answers

how to do dos2unix to *.tpl recursively in linux?

Is there such an option so that dos2unix can be applied recursively to matching files ?
yoyo
  • 57
  • 1
  • 4
2
votes
5 answers

ssh to multiple hosts and sudo multiple commands

I need to loop through and ssh to multiple hosts and run a series of commands on each. something like: for i in $(jot -w '%02.0f' 14 1) >do ssh user@host$i sudo -i "command1; command2; command3" >done but I can't get it to work correctly. I've seen…
carillonator
  • 815
  • 3
  • 12
  • 22
2
votes
4 answers

List all empty folders

I have a bunch of nested folders. Most folders contain files. Some contain hundreds of thousands of files. Some are empty. I want to get a list of all empty folders. However, when I run: find -type d -empty it takes a very long time to run, a…
David Oneill
  • 123
  • 6
2
votes
2 answers

MySQLadmin drop database - bash script

I have a bash script which downloads a sql.gz file, extracts it and then import it, however before importing, I drop the existing DB, then import the new DB onto the server. All is well and the script does what it is supposed to, only one thing : I…
Mutahir
  • 2,357
  • 2
  • 32
  • 42
2
votes
2 answers

Bash scripting: detect first day of month

I wrote three bash files: incremental_backup full_backup execution Now I want another bash script do the following : if (date is the start of month 1/-/----) then invoke `full_back_up` else invoke `incremental_backup` How can I…
Mohammad AL-Rawabdeh
  • 1,612
  • 12
  • 33
  • 54
2
votes
1 answer

Mount EncFS volume on Mac OS X works from user account but fails with root using su

I'm trying to automatically mount an EncFS volume by using login/logout hook scripts on Mac OS X. The scripts are run as root and automatically run user defined hooks as the user logging in or out. The main scripts are in /usr/local/sbin and are…
2
votes
1 answer

Handling file names with spaces in shell script

How to handle files with their names containing spaces in a shell script. Here is what I am trying find /abc/xyz -name 'BY567*.csv' | while read fname do mv "$fname" ./archive/$(basename $fname)-$(date +%Y%m%d-%T) done But…
yogsma
  • 245
  • 1
  • 3
  • 12