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

learn more… | top users | synonyms

3
votes
1answer
225 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
80 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
258 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
70 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
144 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
179 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
388 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
93 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
332 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
105 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
301 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
49 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
1k 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
307 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
342 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
208 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
597 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
179 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
66 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
326 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
159 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
207 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
233 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 ...
6
votes
1answer
1k views

seeking to upgrade my bash magic. help decipher this command: bash -s stable

ok so i'm working through a tutorial to get rvm installed on my mac. the bash command to get rvm via curl is curl -L https://get.rvm.io | bash -s stable i understand the first half's curl command ...
1
vote
3answers
2k views

Cannot find /Users/user/tomcat/bin/setclasspath.sh

This file is needed to run this program. I am new to Mac OS X and its terminal. I am installing Apache Tomcat, using steps provided through this URL ...
3
votes
2answers
195 views

sudo - for what is it required in osx mountain lion?

New mac user here. I tried creating a symlink (installing x11) in /opt: ln -s /opt/X11 /usr/X11 But permission is denied. Obviously I can probably use sudo, but how do I know when doing so is ...
1
vote
1answer
85 views

Script acts differently whe run by cron

I have a script that runs nightly, that is returning different results than when I run it manually. I realise that this is a common question and my problem most likely lies in an environment variable ...
1
vote
2answers
171 views

Bash: Created a ~ (Tilde) in a directory by accident

I'm a beginner to using bash on OSX, and I somehow created a ~ dir in a project subfolder. (It appears as a directory, rather than a symlink.) Is there a safe way to get rid of this ~ directory ...
6
votes
1answer
151 views

What is a good way to get back to the command prompt discarding STDOUT and STDERR

I often launch applications from the cli via e.g. command & to immediately get back to the prompt back. The downside of this is, that I still get STDOUT and STDERR. So I use command &> ...
2
votes
2answers
140 views

how to handle bash * matching when there are no matches?

The following bash snippet works great when there are actually *.txt files in the directory. for txt in *.txt do echo "loading data from $txt" done ...
7
votes
2answers
2k views

Edit first line of large text file

I have a huge text file, far too big for the whole thing to be paged into memory. All I need to do with this text file is edit the first line (its a CSV file and I need to alter the titles). Is there ...
0
votes
2answers
450 views

cURL or xargs: show progress

I am using cURL to download many files and concatenate them to STDOUT. About 100,000 small files. I would like to see progress against the 100,000. Is this possible with curl or by using curl into ...
3
votes
2answers
773 views

How to use wildcards in a xargs-command?

I've got a directory with numbered files, e.g. 1_foo.txt 2_bar.asc 13_test.png, and want to move them into individual directories (e.g. 1, 2 and 13) using as simple a bash command as possible. ...
0
votes
1answer
205 views

Does bash come with knoppix 7 and if not is it hard to install?

Does bash come with knoppix 7 and if not is it hard to install? I am just learning linux and it seems everyone is suggesting to use bash to learn the command line stuff, but I can't seem to find ...
8
votes
2answers
3k views

Command-line way to send keystrokes to a window open on a different X-session

On my main machine, I have a Ubuntu desktop open and logged on. I am then also logging in to this machine from a remote computer, using X2go which creates a new X-session. I have a libreoffice file ...
1
vote
1answer
67 views

How can we give the check on shell script?

Any one can help me do this with shell script: When VM startups, it checks if a folder (dbsync-installdir) exists if it does not exists, it will download the ZIP file using wget.
2
votes
2answers
1k views

Find difference with mtime - and +

Can someone explain the difference with mtime - and + switch as both are not bringing back the results I need. I'm looking to delete all files older then 5 days find /mnt/sdb1/tmp/ -type f -mtime +5 ...
4
votes
2answers
76 views

How can I see which files are opened by a command?

I know lsof, which shows me the files opened by a running process, but if I launch a command, like calendar, that terminates immediately. How can I see what config files are read?