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

learn more… | top users | synonyms

0
votes
1answer
215 views

How can I set a git config item as a function?

I'm trying to set up the gist gem, but I don't want to have my GitHub password stored as an environment variable or git config item. The README from the GitHub repo explains, You can also define ...
1
vote
3answers
352 views

bash script to remove select files

I have a series of files that are named according to field.%d.vtk and are generated when I run a C++ code. The codes does a series of computation inside a for-loop and dumps the output whenever i%N == ...
5
votes
2answers
2k views

How to close other windows in tmux?

I write some functions in .bashrc to make tmux easy to use: #!/bin/bash # .bashrc # vim tmux #----- -------------------- tabc() { tmux kill-window; } tabe() { tmux new-window; } tabf() ...
13
votes
4answers
36k views

How can I get the mount path of a USB device on OSX?

I have a backup script that backs up some data to a USB device. The problem I have is that OSX sometimes changes the expected mount path. For example if some file is locked under the expected mount ...
0
votes
2answers
177 views

Debian + Grails console: destroys local echo of ssh session after exit

I installed grails on a virtual vagrant box of Debian Squeeze 64. the debian box base image is available under http://dominique.broeglin.fr/2011/03/26/squeeze-64-vagrant-base-box.html the grails ...
2
votes
1answer
2k views

Send all error messages to a text file?

I'm trying to run the following command: $ psql -d template_postgis -f /usr/local/pgsql-9.1/share/contrib/postgis-2.0/postgis.sql It produces a vast amount of error output, of which I can only ...
1
vote
1answer
399 views

tail -f updates slowly

I'm not sure why, but on my Macbook Pro running lion I get slow updates when I issue "tail -f" on a log file that is being written to. I used to use this command all the time at my last company but ...
1
vote
2answers
108 views

How can I avoid descending certain directories with 'find'?

Currently I have this find command which avoids descending particular directories: find . \! \( -name ".hg" -prune \) \! \( -name "localhost" -prune \) \! \( -name "logs" -prune \) -type f The ...
10
votes
5answers
13k views

How can I do a recursive find and replace from the command line?

Using a shell like bash or zshell, how can I do a recursive 'find and replace'? In other words, I want to replace every occurrence of 'foo' with 'bar' in all files in this directory and its ...
0
votes
1answer
100 views

How does the .profile file work if I fork a process?

Lets say I open vlc or gimp on startup, but those commands don't return until the program closes. Does it just let a bash interpreter run indefinitely until they close or does it run and immediately ...
2
votes
2answers
282 views

What happens under the hood when I run a command line program in another programming language?

Some programming languages have system() exec() calls where I can run commands. What exactly happens when I do that? If I run system("ls") Does it run a bash interpreter on the string? Does it make an ...
3
votes
1answer
154 views

In ubuntu alt+f2 spawns a process that is not attached to a shell. How would I do that in bash?

emacs & Forks but the process is attached to the shell nohup emacs & Something like that works but seems to make some kind of log file Just what exactly is alt+f2 doing?
0
votes
1answer
65 views

git-number not working on Linux: sh: git-id: not found

I've set up the script git-number on my Cygwin computer without any problems. I've put all three required scripts in a folder in my home directory called bin/ and everything works fine. Now I'm trying ...
8
votes
5answers
10k views

How to get the pid of a running process using a single command that parse the output of ps?

I am looking for a single line that does return the pid of a running process. Currently I have: ps -A -o pid,cmd|grep xxx|head -n 1 And this returns the fist pid, command. I need only the first ...
0
votes
1answer
2k views

Automatically close Terminal after script execution

How do I automatically close the Terminal after script execution? #!/bin/bash cd ~/Desktop/sh-scripts/ ./start.sh & // ??? how to close Terminal
0
votes
1answer
789 views

Give permissions to www-data user to run a local script

I actually try to launch a gnome-terminal with a PHP script, and seems I have some problems with the users www-data; My script only makes an ls -l command in a directory (is just for a test) and I ...
4
votes
3answers
525 views

Handling prompts from an installer in Linux command line

I am writing a bash script that, amongst other things, installs some software. One of the installers I run requires answering some questions. For example: Is the default install folder ok (yes/no)? ...
1
vote
1answer
115 views

Unix (Debian) autocomplete paths thru symlinks

By default, directory symlinks on unix systems are treated as files as far as the autocomplete feature goes. For example, having a directory symlink at /srv/link/, typing /srv/liTAB does only complete ...
1
vote
2answers
100 views

How do I use BASH to change “A” Train.flac to 'A' Train in a filename?

I've tried every combination of backslash and asterisk and curly brackets, nothing seems to work. I'm using the terminal in OS X and I would really appreciate it if someone could steer me straight.
0
votes
1answer
368 views

using history command with ssh and getting output with correct time stamps [duplicate]

Possible Duplicate: using history command with ssh and getting output with time stamps Basically i want to get a record of all commands executed on my ssh server, with their correct ...
0
votes
1answer
52 views

bash script working, but outputting only 1 file

Attempting to have this script run through a directory and perform the operation on every file with the .tmp.tcx extension, so if I had 3 unique files with ${b}.tmp.tcx, I'm hoping for 3 unique files ...
2
votes
2answers
296 views

Getting “export PATH” to stick

I just upgraded to Lion and I am using bash for the first time (my previous experience is with csh and tcsh). I have encountered unexpected behavior. A simple example is: I create a file ...
0
votes
2answers
99 views

How to find out why openning a Terminal in OS X is very slow sometimes?

Is there a way to verbosely print everything that gets executed when I open a Terminal in OS X? Sometimes it takes up to 10 seconds for the Terminal to become ready for interaction and I want to know ...
1
vote
2answers
2k views

Why doesn't chmod work in this case?

I'm trying to set a small webserver for personal use. I have a fodler /srv/http/cgi-bin/ which I want to edit as user and not superuser. I tried to chmod it as mentioned here. Here is the result: ...
2
votes
1answer
249 views

bash 4.2 autocd command default over directory

Just switched from tcsh to bash 4.2 on OSX, and autocd was what allowed me to do it. But it seems that by default if you type the name of a directory that also happens to be the name of an executable ...
2
votes
1answer
419 views

Can't start a service (sudo) remotely from script and keep it running

I have a service (tomcat) that needs sudo to be started. I made a simple script on the remote server in /root/bin/test.sh #!/bin/sh sudo service tomcat start read (The script needs to do other ...
0
votes
1answer
588 views

Terminal not working: -bash: exit: with: numeric argument required what to do?

I was trying to install F# compiler and interactive on my Mac, and part of the installation process required providing aliases in the bash profile file. I suspect that I messed something up here, ...
0
votes
0answers
119 views

Terminal highlighting and auto complete

Do you know some plugin for highlighting and autocomplete in postgreSQL terminal?
1
vote
2answers
922 views

How can I automate a root command after (not during) startup?

I'm using Ubuntu 12.04 LTS, but I need to run the following command: sudo dhclient after startup to acquire a stable ethernet connection. I am running dhclient during startup already, through the ...
5
votes
4answers
2k views

How to get both PIPESTATUS and output in bash script

I'm trying to get last modification date of a file with this command TM_LOCAL=`ls -l --time-style=long-iso ~/.vimrc | awk '{ print $6" "$7 }'` TM_LOCAL has value like "2012-05-16 23:18" after ...
0
votes
1answer
93 views

Remove middle folder? [duplicate]

Possible Duplicate: Linux: How to move all files from current directory to upper directory? I have foo/bar/myfiles and I want foo/myfiles. I was trying to git clone a repo into foo, but it ...
3
votes
3answers
107 views

What's the easiest way in *nix to wildcard a substring of a filename?

I want to do something like take the part of a wildcard match and use it similarly to a regex match. The command might look something like this cat foo_* | python magic.py > magic_* If my file ...
2
votes
2answers
1k views

Bash/xdotool: Commands work, but not in a script

I am making a bash script for Linux which closes the terminal window if the window loses focus. On the command line, I was able to do this: termwin=$(xdotool getactivewindow) while : do if [[ ...
3
votes
2answers
250 views

How to print dir tree of a 7zip archive?

Before extract archive.7z, I always check what in side: $ 7z l archive.7z ...SKIP... 2010-01-01 00:00:00 ..... 25856 7367 jsloader/resource/gre/modules/source-editor-textarea.jsm ...
1
vote
1answer
1k views

brew doctor giving error on a directory that has been removed

I just installed homebrew and as suggested, I ran the brew doctor command. I am linux newbie and do not know how to fix most of these things. But I would like to ask especially about the following ...
0
votes
1answer
448 views

using emacs shell with gnu screen?

How can I use a bash shell in emacs (M-x shell) when I am trying to connect restart a GNU screen session (on a remote ssh connection)? When I try it, I get: avilella@remote-machine-002~$ bash ...
5
votes
2answers
2k views

Symlink to current folder as absolute path without typing whole path

Symlinks are saved shortcuts for relative paths: ~/foo➤ ln -s . ~/bar/foo ~/foo➤ ls -l ~/bar total 8 lrwxr-xr-x 1 me me 1B 15 May 14:38 foo -> . The file ~/bar/foo is a symlink to bars ...
16
votes
4answers
2k views

Undo tar file extraction mess

I just untar'd an archive that produced a mess of files into my tidy directory. For example: user@comp:~/tidy$ tar xvf myarchive.tar file1 file2 dir1/ dir1/file1 dir1/subdir1/ dir1/subdir1/file1 ...
0
votes
2answers
271 views

bash: ./wls1036_solaris32.bin: Invalid argument

Having some experience in ubuntu, I installed solaris 11g recently to work on WebLogic. I've downloaded wls1036_solaris32.bin file. When I run ./wls1036_solaris32.bin in the terminal, I'm getting ...
1
vote
1answer
1k views

“php: command not found” after changing PHP system files in OS X

I wanted to install Symfony on Mac OS X Lion. Apparently, as MAMP was already installed on my computer, there was a problem with the "timezone" field in the php.ini file. I can't remember exactly the ...
1
vote
4answers
2k views

Get PID of process started in screen by su

i have a simple script that starts quassel-core in a screen session as different user! The script is: #!/bin/sh su ircc -c 'screen -dmS quassel /home/ircc/quassel/quassel-core' I want to start and ...
0
votes
4answers
69 views

Re-use existing jobs when opening files

The question is best given by examples: vim example.txt #Opens Vim on new or existing file Ctrl+Z vim someother.txt Ctrl+Z vim example.txt #Auto-runs `fg 1` since example.txt is already open ...
3
votes
2answers
176 views

CTRL-[keys] and arrows not functionning in terminal / ipython

I'm using ipython Inside the python shell, when I press up instead of showing the last command, it prints ^[[A also CTRL-[keys] are fubar. CTRL-p prints ^P Everything is normal under ...
1
vote
1answer
1k views

tmux: set pane title to currently running command?

How can I make tmux to set pane_title automatically to currently running command? Actually the setting automatic-rename is just what I want for pane_title, but for it's only for window_name.
2
votes
1answer
1k views

: colon command for bash

Speaking as a bash newbie I have been upgrading my .bashrc via copy/paste + github and I have come across the : command that stumps both me and google. e.g. : ...
4
votes
4answers
9k views

bash process uses 90% CPU, comes back on computer restart

I’ve replaced the old HDD of my late 2008 unibody MacBook (8 GB of RAM, running OS X 10.7.4) with an OCZ Vertex 3 SSD. After doing this, I've installed Lion and restored my data from a Time Machine ...
0
votes
1answer
343 views

How to make curl reconnect after 60"?

Sometimes, curl freezes: $ curl -O 'http://www.site.com/index.html' www.site.com/index.html --> index.html % Total % Received % Xferd Average Speed Time Time Time Current ...
2
votes
1answer
66 views

How to map // to ~/?

Is it possible to remap ~/ to //? I want to be able to do something like cat //something.txt and have it be running cat ~/something.txt Or if this isn't possible, mapping ~ to something easier to ...
1
vote
1answer
1k views

Bash Script for loop that is breaking lines up instead of using the whole line

I am writing a very simple script and I'm getting stuck on something stupid. Basically I have text file in which each line is comprised of 3 words separated by a space. When you cat the file it ...
0
votes
2answers
783 views

using history command with ssh and getting output with time stamps

Basically i want to get a record of all commands executed on my ssh server, with their times. The codes i have tried are : ssh user@ip 'export HISTFILE=~/.bash_history; set -o history; history' I ...