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

learn more… | top users | synonyms

2
votes
2answers
375 views

How can bash screen be setup in the background and brought to the front later?

This a deeper explanation for the question. My goal is: Start a bash shell configured with a set of environment variables, but running in the background. Launch about five screen commands in the ...
1
vote
1answer
178 views

how to remove “downloading” or 0% complete torrents in rtorrent using bash script?

I have 10K torrents and 7K of them are going too slow. I would like to remove them but the rutorrent and rtorrent interface is unusably slow. I noticed that the info about rtorrent is kept in .session ...
2
votes
1answer
497 views

Set Adobe Reader as Default for .PDF documents in Mac OSX 10.8 via the Terminal

I would like to know how to set the .PDF file extension to be associated with Adobe Reader as the default program by setting this via the terminal in Mac OSX 10.8. My reasons for needing to this this ...
1
vote
1answer
67 views

Dash acting up for unknown reason

I restarted my kubuntu machine - from the menu leave->restart if that matters. Normally my terminal windows are brought up automatically after a reboot but this time my prompt was wrong and a ...
3
votes
1answer
541 views

SSH port forwarding with automatic reconnect, script executing at startup

In short, every time my computer boots, I would like to start a ssh port-forwarding connection that will reconnect with the server if the connection drops. Computer is Debian Wheezy x64. An initial ...
0
votes
1answer
321 views

bash getopts, parsing ranges

What would the best approach be to parse argument value ranges using getopts? As an example: $ script.sh -r2-4,6,8-10 In my script I would then have an array with the values 2, 3, 4, 6, 8, 9 and ...
3
votes
2answers
812 views

CL VIM: How to get 256 color support in Fedora 17 terminal?

How do I enable 256 color support for VIM in the Fedora 17 terminal? My .bashrc: 1 # .bashrc 2 3 # Makes terminal default 256 Colors Include these lines in .bashrc 4 5 export TERM=xterm-256color 6 ...
1
vote
1answer
319 views

OS X terminal login takes lot of time

From earlier this week my MacBook Pro's terminal is taking a lot of time (about 20 seconds) to see the bash prompt. How do I reduce this time? EDIT: While the login is in progress I tailed the ...
3
votes
1answer
78 views

Freaky Bash command line completion results

I un-tar-ed a file and it had a directory called "~something". Without thinking I typed "cd ~" and hit tab to have bash complete the name. Instead of getting the "~something" result I expected I got ...
0
votes
1answer
574 views

Mac OS X terminal and PATH variable

I've added PATH variable definition to my ~/.profile file: Here it is: export ...
2
votes
1answer
406 views

Bash script errors

I am trying to get all my MP3 to have the BPM registered. I did find software for that via this Super User question. I installed bpmdj, vorbis-tools flac python-mutagen and copied the bash script ...
3
votes
1answer
443 views

Script-specific autocomplete in shell

I create a lot of little scripts to help me in my every day life. I would like to provide auto-complete for them, specially that I intend to share them with people. Now, I know I can create ...
2
votes
1answer
157 views

How to trigger a script when unmounting a hard drive or restarting?

I've recently installed NTFS-3G through Homebrew in order to access NTFS drives from OSX. There's a slight problem with it: after unmounting the drive, if you take a look at /Volumes/, you can still ...
4
votes
2answers
916 views

Trim trailing newline in one-liner bash alias

I'm trying to write a simple alias on my Mac OS X terminal to copy the current working directory. I have this: alias cpwd="echo \`pwd\` | pbcopy; echo \"Copied \`pwd\`\"" Then I can just run the ...
3
votes
1answer
82 views

In zsh how can I run a script which is written for bash

I have switched to zsh, how can I run a script which is written for bash? I don't want to modify the script to put #!/bin/bash in the beginning for the script since it is version controlled. Is ...
3
votes
1answer
218 views

Redirect stdout to multiple programs

I'm doing some stream processing of some quite substantial files-- I was wondering if there was a way to split stdout in order to pipe to multiple programs. What I'd like to do is something like this: ...
2
votes
1answer
79 views

Vim shortcut in Terminal

In vim I have jj bound to go to normal mode: inoremap jj <ESC> I changed Terminal to vi mode in ~/.bash_profile, but how can I set up the same binding? This doesn't work unfortunately: bind ...
2
votes
1answer
60 views

Why does sorting in Emacs produce a different output from sorting in bash?

Why does sorting in Emacs vs bash produce differing outputs? What can I do to get the same result in both? This is the output of diff two files, one sorted in Emacs with sort-lines, and the other in ...
1
vote
1answer
250 views

Issues with mv on windows xp bash shell

As I'm pretty used to the Linux terminal, I set up a bash shell on my Windows XP command prompt by following the instructions in this article: ...
0
votes
1answer
68 views

Convert with audacity from bash

I have multiple .wav files (numbered from 1) which I want to convert them to .mp3. audacity can do that with opening a file and exporting using it's GUI. Is there a way that I do this with a bash ...
3
votes
2answers
98 views

Deleting Certain Extension with Bash (quickly)

I have seen other threads about deleting a certain extension in a directory. However, when I try it, it seems to work but takes a long time to go through directories and say "Permission denied" on ...
3
votes
3answers
135 views

heredoc prompts not passed in

I'm trying to automate the creation of a PostgreSQL user with a bash script. I'm specifying the initial password as prompted by the "createuser" command, and I'd like to do it in bash, which I think ...
2
votes
2answers
1k views

Mass file renaming in Bash but keeping a section of the file name

I have a large number of .jpg file that have extraneous data ahead of a file id that i need to have removed to better set up my file structure for a later project. How can I do a batch rename in ...
1
vote
1answer
168 views

How would one pause a copy action when the internet or location disconnects. Shell

Okay. So I have a few executable .sh files that backup a directory. In this case, the Development directory. I have two computers. A Mac (Which is the main computer, and a Windows 7 desktop.) Since my ...
0
votes
2answers
372 views

creating CDF data using bash or awk or perl

we have some data like: 12 0 13 0 20 0 25 1 64 4 77 1 89 100 1201 204 I'd like to get this output: 3 0 5 1 6 4 7 100 8 204 explanation: we have 3 AS(autonomous systems) that have degree of ...
2
votes
2answers
91 views

Maintain text colors when wrapping command in bash script

So I've made a small script to search through my project for a word: #!/bin/bash grep -n $1 js/*/**.js grep -n $1 js/*.js When running these commands in the command line I will get some nice syntax ...
7
votes
4answers
306 views

How to empty the contents of continuosly streaming file in linux

i have the program running using this command command 2> sample.txt now that file is growing continuously and command will exit in 5-6 days and i beleive that file size won't go in GB I tried ...
2
votes
3answers
58 views

mirror full website1 and all links to specific website2

I want to mirror a website that will be taken down soon, the problem im facing at the moment is simple -> mirror whole website1 and all links (will be files/images/similiar) to website2 too, so i got ...
0
votes
4answers
1k views

Bash/csh: test for end of file (EOF) of stdin

I would like to do: if not eof(stdin): pass stdin to program else: do nothing I have a feeling that it can be written fairly close to: if test ! --is-eof - ; then exec program The ...
1
vote
2answers
103 views

How to ouput the continuous stream to a txt file in linux

I have the command which continuosly outputs something on the screen of putty like we have when we install something. Now that process is very long and its going to take many hours. I have few ...
3
votes
1answer
2k views

Counting occurrences in first column of a file

We have this file: 1 2 1 3 1 2 3 3 52 1 52 300 and 1000 more. I want to count the number of times each value occurs in the first column. 1 3 3 1 52 2 This means we saw 1 three times. How ...
3
votes
2answers
275 views

How to move files down a directory?

I have inherited a folder structure on a project and would like to simplify it a bit. I have a root full of folders (1st level) and each of those folders has a number of folders in it (2nd level) and ...
1
vote
0answers
48 views

Is this a bug in top?

This command line: top -l 3 -n 10 -o "vprvt" For some reason there are two processes that consistently creep up in the second sample's output regardless of their actual VPRVT size, and they do not ...
5
votes
3answers
5k views

How to run scripts within a telnet session?

I want to connect to a remote host using telnet there is no username/password verification just telnet remotehost then I need to input some commands for initialization and then I need to repeat ...
4
votes
3answers
89 views

Output numbers from a file in a different order

I have a file that contains: 1 2 3 4 1 3 5 4 8 3 2 1 Each line has a different number of digits. And there are 1000 more like this. I want the output like this: 1 2 2 3 3 4 4 0 1 3 3 5 5 4 4 8 8 ...
2
votes
1answer
980 views

Where can I change the text displayed by Ubuntu on login?

When i login into shell in ubuntu 12.04 i can see always this message Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-generic x86_64) * Documentation: https://help.ubuntu.com/ System ...
6
votes
3answers
282 views

Remove duplicates in each line of a file

How can I remove duplicates in each line, for example here? 1 1 1 2 1 2 3 5 5 4 1 2 3 3 I'd like to get this output: 1 2 3 5 4 1 2 3 There are lots of lines (100,000) and in each line I want ...
3
votes
3answers
332 views

Why doesn't this for loop work?

This is on Ubuntu 12.04 I'm trying to figure out how to get ffmpeg to do a batch conversion of FLACs to MP3, recursively. If I cd into a directory and use for f in *.flac; do ffmpeg -i "$f" -c:a ...
1
vote
2answers
191 views

Move left by a word instead of by a character in terminal

I want to move left and right by words using ctrl + left/right arrow in terminal (I'm on ubuntu 12.10). Currently when I use these keystrokes I get ;5D or ;5C appended onto the line, which is useless ...
5
votes
1answer
524 views

Can't execute any commands in bash except as sudo

I don't know what I did but suddenly i can't use any commands except and only preceded with sudo. No matter the command I get bash: /home/otis/bin/ls: cannot execute binary file. Even cp I get bash: ...
2
votes
1answer
176 views

How to disable jobs killing when leaving the terminal

When I leave a terminal via Ctrl+D and there are jobs in the background I get There are stopped jobs for the first time, but when I press Ctrl+D again, the jobs get killed. Can I disable the latter ...
0
votes
1answer
65 views

cd into an application [closed]

Mystery solved... [nemo@Saturn.local /Applications/AppsUser/System]$ ls -l | grep ExpanDrive -rw-r--r--@ 1 nemo admin 0 Nov 16 2010 ExpanDrive.app [nemo@Saturn.local ...
0
votes
3answers
301 views

How to prevent a user from hiding their bash history?

I believe that there are a large number of ways to prevent your bash history being recorded e.g. export HISTSIZE=0, how can I prevent users from hiding their bash history?
0
votes
1answer
148 views

VIM buffer for MySQL CLI interpreter?

I just learned that CtrlxCtrle in the Bash CLI will open the current command in a VIM buffer for editing. That is nice, but where I really need this feature is the MySQL CLI interpreter, and that ...
0
votes
2answers
103 views

Scripting a sequential workflow in OSX

I currently have a workflow which relies on several bash commands sequentially in the OSX terminal. It is basically a process which starts with a file x.csv, it does an operation on it and generates ...
2
votes
0answers
203 views

Problems with bash script, mysql inserts and launchd

I am developing a automated system, which consists of 3 parts: mysql, bash and launchd. Bash script takes folders of work related stuff, zips, archives and puts info about them into database that is ...
2
votes
2answers
217 views

Record bash_history to private database for all users?

I want to be able to setup a MySQL database and record all commands issued on my server by username and command. Is this possible, and if so, how would I set it up?
0
votes
3answers
54 views

Perform shell operation through secure shell

Is it possible to perform a shell operation from a bash script through a secure shell. Here is an example of why you may want to do this. Lets say you have a simple unix operating system that you ...
7
votes
1answer
2k views

Does rm -r follow symbolic links?

If I have symbolic links in some subtree of my directories and decide to recursively removed a driectory and its contents, will that remove items symbolically linked in the tree?
2
votes
1answer
82 views

cat contents of one file into another file

I have a large (binary) file that has some corruption near the beginning. Then, I have a second, smaller file that I obtain by starting to download the same file again, but interrupt after I have ...