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

learn more… | top users | synonyms

0
votes
1answer
8 views

bash extract first number from filename

I'm trying to move files like this: ... DLG023-00-01-sprite.TextGrid.json DLG023-00-01.prosody.json DLG023-01-01-sprite.ogg DLG023-00-02-sprite.TextGrid.json DLG023-00-02.prosody.json ...
2
votes
4answers
65 views

How to limit CPU consumtion of a process group with standard GNU/Linux tools?

I have a bunch of processes of the same name - they take up 100% of my CPU time, I want this to be no more than 50%. How can I do this without installing any extra software?
0
votes
1answer
17 views

How would one pipe from socat to sed to bc to xargs?

I have a server outputting some numbers, I'm reading them with socat, then using sed, I turn those numbers into some math equations, I run them with bc, then I need to pipe them into xargs. socat -u ...
2
votes
1answer
44 views

convert timezone of timestamp string in bash

I have a date/time string which is extracted from a filename. I know that the timestamp was written using time zone A and I need to convert it to time zone B for further processing. Is this possible ...
0
votes
2answers
12 views

rsync variables script syntax error

Really struggling with getting a command argument variable to work with rsync. The behavior i'm seeing is this error from the script: rsync: connection unexpectedly closed (0 bytes received so far) ...
1
vote
1answer
13 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
19 views

Parse csv file and for each object set as a variable

What I'm trying to do is parse a csv file that has server names and ipaddresses and assign these to variables I then run commands using each set of variables. So if the cvs file, test.csv, looks like ...
0
votes
1answer
53 views

Script that scans my network

I have a question I want to run a script that scans my network and that I can see with devices are up in my network. I want to paste some arguments also in the script When I run the script: ...
4
votes
1answer
32 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 ...
0
votes
1answer
19 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 ...
1
vote
1answer
13 views

bash requesting password on every invocation of sudo

Within a single bash session I am repeatedly re-running a command prefixed by sudo. Typically the password should be requested once and then cached. However, the present behavior is that the password ...
0
votes
0answers
9 views

How do I break out of an inner loop? [migrated]

#!/bin/perl for (( i=0;i<=10;i++ )) do for (( j=1j<=3;j++ )) do if(( $j==0)) then break fi done done Other than break is there is any keyword like in perl ...
0
votes
1answer
17 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 ...
0
votes
2answers
25 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 ...
-3
votes
0answers
11 views

Multi-threaded export process [on hold]

I need to export/generate a gigantic amount of data/media (courses) from a CMS database running on an Ubuntu server. I know my way around Linux but I'm not an expert in the inner workings of ...
0
votes
1answer
15 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 ?
2
votes
2answers
41 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
151 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 ...
0
votes
1answer
31 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 ...
1
vote
0answers
13 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 ...
1
vote
1answer
49 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 ...
-1
votes
0answers
21 views

How to make a symlink to make it Compass on my Mac?

I have everything installed on my Mac that should do the job to run Sass and Compass, but it seems that the paths are not optimal. When I installed Compass and Sass I did it by following these ...
-1
votes
0answers
12 views

Concert price finder? [closed]

I just finished writing a simple bash script that grabs concert dates from the web and gives me date and location next I would like to a script that takes a venu and fuzzes(I think that's the term) ...
1
vote
1answer
27 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 ...
2
votes
1answer
33 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 ...
0
votes
0answers
12 views

create and run bash script on start of runlevel5

I have created a following hello bash script: #!/bin/sh echo "Hello Run Level 5" I put this script in the /etc/rc.d/rc5.d directory with a name S100RunLevel5. How can I make this script to run ...
0
votes
4answers
38 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 ...
0
votes
1answer
13 views

How do I fix a cipher mismatch issue with sftp?

I'm running into an issue where a server was upgraded to RHEL 6.5, and we have automated bash scripts on an RHEL 5.9 install that connects through sftp and ssh commands. Now, the new server only ...
0
votes
2answers
23 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
3answers
27 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
0answers
25 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 ...
15
votes
3answers
1k 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
1answer
16 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:
0
votes
2answers
25 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 ...
2
votes
1answer
22 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 ...
0
votes
1answer
27 views

What does qsub --cwd `pwd` mean?

I am newbie to Linux command lines. I just got a queue submission command from others. The command line is as follows: qsub --cwd `pwd` -t 60 -n 1 --proccount 1 --mode c1 --env ...
0
votes
0answers
17 views

Git Bash on Windows 8 open to specific directory except when using Git Bash Here context menu

When I right click and choose Git Bash here it works as expected and the shell launches in the correct window. When clicking just the icon, despite changing the Start In settings, the directory is ...
0
votes
0answers
13 views

Issue with backing up and restoring XAMPP due to unknown software version

I had a ton of permission errors with my XAMPP installation, so I decided to uninstall and start over to avoid hassles with figuring out the correct permissions. I used the XAMPP backup and restore ...
1
vote
2answers
75 views

Edit xml file using shell script / command

I need to do this using unix script or command There is a xml file in /home/user/app/xmlfiles like <book> <fiction type='a'> <author type=''></author> ...
0
votes
0answers
14 views

Process stuck after being put into BG

I'm trying to put a process into background with (Ctrl+Z + bg): [andrey@localhost dir]$ git clone https://github.com/rust-lang/rust Cloning into 'rust'... remote: Counting objects: 465324, done. ...
0
votes
1answer
18 views

LSB init service dependency

I have added the two services A and B. B is dependent on A, meaning that if I will start B then A should be start automatically if it is not running already. But A is not coming up automatically when ...
1
vote
1answer
16 views

Bash script that should do stuff when the first command is CTRL+C-interrupted

I want to make a bash script to automatize a simple task. This task involves running a program (not made by me) which do something until user presses CTRL+C. After that, I have to process the output. ...
0
votes
1answer
25 views

How to recursively compress subdirectory's files with password

I need to recursively compress subdirectory's files with password and then delete the uncompressed file in bash file. There are zip files and other files. I don't want to compress zip files again. I ...
1
vote
1answer
16 views

Make shell script rerun command on certain user input

I'm writing a shell script that randomizes my hostname but prints the random hostname and prompts me if I want to use this hostname for example NEXTHOST=$(sed `perl -e "print int rand(99999)"`"q;d" ...
2
votes
2answers
55 views

pip not working on hombrew python 2.7 install

I've installed python using homebrew and I can't invoke pip from the bash. I've tried amending my .bash_profile to include /usr/local/bin/python and /usr local/share/python to no avail. When I use ...
1
vote
2answers
41 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?
0
votes
1answer
7 views

Distribute session-only git configuration on ssh login

I have a bunch of development servers (linux) that I connect to via SSH from linux workstation. On most of these servers I want to use the Git command line interface. I use a set of Git aliases that I ...
0
votes
2answers
29 views

Creating a bash routine

Everytime I log in into my work machine, I have to open a terminal and type the same routine: $ cd /Documents/some_folder/some_another_folder $ vagrant up $ vagrant ssh I'd like these commands to ...
0
votes
1answer
10 views

Linux remote run a scripts, screen hangs and never back to controls

I have a script in server. If I run it in server locally it is no problem. <user@server> ~ % restart_forms A forms [A] is Restarting <user@server> ~ % However, if I run it remotely ...
2
votes
2answers
27 views

gnu parallel: forward all of stdin to all processes

I'm trying to process input in different ways in parallel, writing out the resulting lines as they come in. My current approach is this: # process_parallel.sh read input parallel --colsep ' ' ...