Bash is a free shell for Unix-like operating systems from the GNU Project.

learn more… | top users | synonyms

1
vote
1answer
28 views

Bash -gt: unexpected operator

I have a checkSpace.sh which check the used space on a disk and if is greater than 80 stops a service #!/bin/bash percent=sudo df /media/usb | tail -n 1 | grep -E [[:digit:]]+% -o | grep -E [1-9]+ ...
0
votes
1answer
44 views

How do I run Asterisk as user other than root?

I compiled Asterisk 11 from source as user root on CentOS. Now I want Asterisk to run as user asterisk group asterisk. I have uncommented AST_USER="asterisk" AST_GROUP="asterisk" in ...
0
votes
1answer
30 views

How would I write this VIM command for `sed`?

I have a .csv with special characters that are wrecking an import I need to do. In VIM, I discovered away to remove the special characters with : :%s/\r//g This removes ^M from some of my broken ...
2
votes
2answers
1k views

Run a remote script/application in detached mode in Ansible

I am having trouble running a remote application startup script "detachedly" from an Ansible playbook. The script will run, but I can't get it to get/stay detached. I am probably doing something ...
11
votes
4answers
3k views

Bash history loss

I like to keep a lot of history, so I have histappend set in my .bashrc. Most of the time everything works fine, with history built up from many shells appending. However, every once and a while, I'll ...
5
votes
1answer
40 views

cd <nonexistent_directory> in bash causes cd to different directory?

Ok, so I've been using Linux for 18 years and have never seen or heard of anything like this: starting-forth$ ls ch01/ ch02/ ch04/ ch05/ ch06/ text/ starting-forth$ cd ch07 # A directory I ...
3
votes
3answers
263 views

Custom prompt doesn't work on Mac Terminal

I like to use a custom prompt (current path in blue) on my unix machine: export PS1='\[\e[0;34m\]\w \$\[\e[m\] ' But when I try to use it on Mac's terminal it doesn't work: it fails to detect the ...
59
votes
5answers
118k views

Where to find the .bashrc file on Mac OS X Snow Leopard and Lion?

I want to install rvm on my Snow Leopard machine. It says I need to add a line to my .bashrc file (I'm using bash) but where is my .bashrc file?
1
vote
1answer
912 views

Add milliseconds to existing Unix time

I have a script that returns Unix time in seconds, for example, 1374521719. I'd like to take in this time and place milliseconds to that. Other posts show a simple example of this with the current ...
0
votes
2answers
31 views

Copy files using a pattern or wildcard

I'm trying to copy all files like this: ... dialogue022-en.txt dialogue023-en.txt dialogue024-en.txt ... into files like this: ... dialogue022-pivot.txt dialogue023-pivot.txt dialogue024-pivot.txt ...
1
vote
4answers
4k views

How to disable trackpad/mouse via the Mac OS X command line?

Is there a terminal command in Mac OS X to disable/enable the trackpad/mouse? I know that I can disable the trackpad of my MacBook Pro when an external mouse is connected. But is this also possible ...
0
votes
1answer
20 views

Can bash reverse history search (Crtl+R) be configured to NOT delete history?

I find Ctrl+R very useful, however I am really anoyed that when I press the backspace key, it deletes the currently matched entry in the history. Is there a way to disable this ?
42
votes
5answers
12k views

Is there a shortcut to mkdir foo and immediately cd into it?

This is something I do frequently $ mkdir foo $ cd foo This works as a single command, but it's more keystrokes and saves no time. $ mkdir foo && cd foo Is there a shortcut for this? ...
1
vote
1answer
113 views

Terminal new window always shows -bash: Searching: command not found

When open terminal, it always shows -bash: Searching: command not found. It does not affect other functions, just each time, even though open a new terminal window, it still pops up at the top of the ...
32
votes
3answers
3k views

Have a file named ~ (tilde) in my home-directory

I just noticed that I have a file called ~ in my ~-directory. $ ls -la ~ ... -rw-r----- 1 x1 x1 733962240 Mar 1 17:55 ~ ... Any idea how I can mv or rm it?
5
votes
3answers
6k views

BASH - merge directories when using mv

I just started using BASH, so I can move all contents of a directory to another. But the issue is, I was expecting it to merge the directories. I am using cron job to run this script. #!/bin/bash ...
13
votes
6answers
6k views

Equivalent to ^D (in bash) for cmd.exe?

Is there an equivalent key-stroke for exiting a command prompt on Windows (launched via Start->Run : cmd) to the bash standby of Ctrl-d to prevent needing to type exit to leave the shell?
2
votes
3answers
319 views

Disable numlock, preserving mouse button key bindings

I'm having trouble to disable the Numlock key (make the key do nothing, so that the numpad numbers always work) while at the same time mapping extra mouse buttons (at the side of my mouse) to ...
2
votes
2answers
47 views

When typing in a command, my terminal will often times wrap around

So I'm having a really weird terminal problem that affects both physical login sessions as well as sessions over SSH. Basically, the terminal size is some number of columns. When printing stuff out, ...
2
votes
2answers
196 views

How to check if a file exists after a specific interval of time

I want to check if a directory contains a file (for example sample.txt). If it doesn't contain that file in 5 hrs then I would need to perform some action. How can I do this in a script? I tried ...
2
votes
3answers
2k views

Bash: number of seconds till midnight of current day

How do I find the number of seconds till midnight of current day?
0
votes
1answer
37 views

Matching () with a Unix/Linux regex

I have a couple files with the name (a).1 (a).2 ... (a).100 Since a lot of processing tools don't really like ( and ) in the filename I thought it best to rename them to a different name. I googled ...
0
votes
1answer
24 views

what the “!” means in the iptable rule

what the "!" means in the following iptable rule iptables -I inacc ! -i br0 -p UDP --dport 69 -j ACCEPT I think is related to the interface br0. I think it mean any interface except the br0 Am I ...
1
vote
0answers
17 views

How does OS X's Terminal pass the new tab's dir to login or bash?

In OS X, you can add a shell to /etc/shells and set it as a user's default shell, such that when they open the terminal they are presented with that shell. In addition, When you have the option to ...
0
votes
0answers
98 views

How to make an application accessible for ISPConfig's shell user?

We are using ISPConfig to manage our VPS. We have created a domain with a shell user assigned to that domain. There is an application installed on the VPS that is called Drush (shell application for ...
1
vote
1answer
81 views

Starting script in screen with cron

I apologise if this has been asked before but I am not sure how to question a search query for this. I am extremely new to linux and I have been learning as I go to solve issues. I am trying to set ...
11
votes
6answers
12k views

Force bash script to use tee without piping from the command line

I have a bash script with lots of output and I would like to change that script (not create a new one) to copy all the output to a file, just like it would happen if I were piping it through tee. I ...
0
votes
2answers
41 views

Unix/linux shell scripting floating point division

I have to divide two floating point values and store it in variable. My code below v_missedvol=4003.03 v_allvolume=3003.03 v_vol_temp= $(echo "$v_missedvol / $v_allvolume" | bc -l ) the result ...
1
vote
1answer
34 views

Mouse tracking control codes for terminal using bash

I'm making a bash implementation of curses as an expermient for fun. I use infocmp to get the ANSI terminal codes. I'm a bit stuck now at how to enable mouse tracking in a cross-console way. I could ...
1
vote
1answer
48 views

bash completion in msysgit by single or double tab

Single tab used to make bash complete current line, and double tab shown all possible variants. For example, if I have files (or git branches, or whatever is suitable in current context) "abc", "abd" ...
7
votes
2answers
10k views

How can I “grep” recursively filtering the name of the files I want with wildcards?

When I want to perform a recursive grep search in the current directory, I usually do: grep -ir "string" . But that command searches inside all kinds of files, including binary files (pictures, ...
3
votes
2answers
727 views

save bash history, regularly

I have bash set up to save history, to a file. It does this whenever bash exits [properly]. As sometimes bash does not exit properly the history is lost. So the question is can I set up bash to save ...
1
vote
2answers
545 views

Redirect output of remote python app started through ssh to file

I have a python app in a remote server that i need to debug, when I run the app locally it prints some debug information (including python tracebacks) that i need to monitor. Im trying to redirect ...
2
votes
1answer
44 views

Replacing a running Linux root filesystem

I'm trying to come up with a bash-scriptable method of replacing the root filesystem on a running PC. The system uses a MBR partitioned disk with an ext4 rootfs and a swap partition, unfortunately it ...
5
votes
2answers
5k views

Getting “-bash: fork: Resource temporarily unavailable” in OSX

I seem to run into problems with the max. number of processes every so often. Anyone know what is best practice for fixing this? Running OSX 10.6 on a MacBook Pro i7. ulimit -a returns these values: ...
7
votes
8answers
691 views

Remove linux file named with set of shell responsive characters

I've created a file named \;:$"\' to test a software of mine. I ended up with an error, because I cannot delete the file property. I'm trying to find a precise character combination to remove it via ...
0
votes
2answers
38 views

Open a Command in a New Instance of Various Terminal Emulators

I am trying to open a terminal emulator while simultaneously passing a compound command to it. What are commands for doing this (two versions: where the terminal stays open after completing or where ...
0
votes
4answers
66 views

Copy paste a multiline command into command line

I'm writing a doc about installation of my soft and I have to write things like Please do the following: sudo apt-get update sudo apt-get install python-dev cython portaudio19-dev The ...
16
votes
3answers
2k views

Command vs program?

I was looking up the difference between adduser and useradd, and an explanation is that useradd is a command while adduser is a perl script. I understand what a perl script is, but what I do not ...
0
votes
2answers
59 views

How to disable bash drivers in windows 8.1?

I'm trying to follow these instructions to stop Bash Driver BHDrvx86 or BHDdrvx64, but device manager in Windows 8.1 no longer displays non plug and play drivers (such as the Bash drivers), even as a ...
16
votes
5answers
7k views

Cygwin bash prompt is wrapping lines on the same line

I'm using Cygwin bash prompt, and for long commands the text will wrap around on the same line as opposed to going to the next line despite setting my PS1 to simply ' $'. Here's a screenshot,
0
votes
3answers
52 views

How can I use the output of ls/grep as input for pdfunite

I want to use pdfunite to merge several pdf-files into one output file. Since the directory contains lots of different stuff, I thought i could use ls/grep to get the apropriate file-names and then ...
0
votes
2answers
34 views

Is there an equivalent to source which allows me to have a batch script alter environment variables of the parent bash process?

My situation is this: I use python with conda on a windows machine, and work mostly in cygwin when on the command line. Now conda allows for different python environments, similar to virtualenv, but ...
0
votes
0answers
57 views

Enable tab autocomplete in PhpStorm terminal on mac?

I am using PhpStorm for a pretty big project. We use Git for our versioning control. Needless to say, this leads to me switching back and forth all day between branches. I'm using the terminal window ...
0
votes
1answer
19 views

Bash not starting in shell properly

When I open my terminal (OS X 10.10.3) I can't run some commands including the commands that are in my ~/.bashrc, but then if I launch bash from that terminal, all those commands work, as below:
11
votes
14answers
21k views

Monitoring a file until a string is found

I am using tail -f to monitor a log file that is being actively written to. When a certain string is written to the log file, I want to quit the monitoring, and continue with the rest of my script. ...
1
vote
2answers
276 views

Unix Script: Wait until a file exists

I need a script that will wait for a (examplefile.txt) to appear in the /tmp directory and once it's found to stop the program, otherwise to sleep the file until it's located So far I have: if [ ! ...
1
vote
2answers
68 views

Is there a folder-specific .bashrc or .bash_profile?

Is it possible to have a bash script (like a .bashrc or .bash_profile, basically) that is executed only upon cd’ing into a specific folder?
16
votes
5answers
20k views

How do I convert a bash array variable to a string delimited with newlines?

I want to write out a bash array variable to a file, with each element on a new line. I could do this with a for loop, but is there another (cleaner) way to join the elements with \n?
2
votes
1answer
28 views

Linux command/script to find all files in a directory with a 4 digit number <= a specific number

I have a folder containing several other folders, each named in this format: Company XYZ (1999 OneWordDescription) I'm trying to filter out the ones that are marked 1995 or older, so I can move ...