Bash is the shell used in Ubuntu's command-line interface.

learn more… | top users | synonyms (1)

48
votes
3answers
22k views

Bash history search, partial + up-arrow

I have searched, but not found anything on this. I am looking for a functionality in bash, using a terminal. Way back when, I had a user on a debian system, and a friend set me up with a convenient ...
1
vote
2answers
802 views

how to use grep in a conditional search previous to a sed text replace command

I am trying to change the path in whole lot of m3u files. I know I can do it with regexxer f.e. but I'm trying to learn bash. This is the command I figured out, but it is not working. grep -lr -i -e ...
6
votes
2answers
3k views

Replacement for DOS xcopy command

In DOS there's the command xcopy /s *.mp3 ..\TEMP2 How can I do this in Ubuntu? cp -r *.mp3 ../TEMP2 will copy recursively all mp3 files, unfortunately without the path because of the *.mp3 ...
27
votes
2answers
25k views

Reload bash's .profile without logging out and back in again

Is it possible to coerce bash to reload the .profile file without logging out and back in again?
4
votes
2answers
795 views

How do I disable global gnome shortcuts in gnome-terminal?

Bash has a myriad of useful shortcuts. For instance Alt+B, which moves the cursor back one word. Only I have assigned this particular combination and a few other shortcuts to do things in gnome. The ...
29
votes
3answers
28k views

How do I add environment variables?

I'm running Ubuntu 11.04. I use the terminal to start a bash session, and I want to add an environment variable: $r@hajt:~$ env THEVAR=/example But it's not working. It shows all the variables with ...
4
votes
2answers
3k views

copy only certain bytes of file?

How can I copy a file, starting at $N bytes and onward? I can use curl's -r option like this: $ curl -r 41663- http://server.com/file.ext to download from byte 41663 and onward, but how can I do this ...
6
votes
1answer
1k views

How to make gnome always run a script, not ask if it should be displayed?

I have written a script: for FILE in *.svg do inkscape --file=$FILE --export-area-page --without-gui --export-pdf=${FILE%.*}.pdf done which converts all SVG files in a directory to PDF. ...
2
votes
3answers
1k views

Bash Script: How to get file name/path

Suppose I want to associate PPT files to be opened with a bash script that converts it to PDF then opens it with the approperiate PDF editor. How do I do that? Conversion will be done with uniconv ...
5
votes
2answers
926 views

Run auto-disper automatically on device wake/thaw

I'm using a Thinkpad W510 and constantly change locations. I'm using disper and auto-disper to change screen profiles (undocked; laptop screen + external screen; two external screens). I wanted to ...
16
votes
3answers
41k views

What is the difference between 'su -' , 'sudo bash' and 'sudo sh'?

I would like to know what is the difference between su - sudo bash sudo sh I cannot login as root while doing su - because I do not have the root password - I mean I have my user password with ...
24
votes
4answers
40k views

How do I decipher diff output

I diff-ed 2 files and got 1c1 < 1 --- > 1 Both files contained just "1". How is this different?
6
votes
2answers
5k views

.sh files requires `sh app.sh` even with `#!/bin/bash` line

I am under the impression that if I include the line #!/bin/bash at the start of my file, it will be recognized as a bash script that I can run just by file.sh instead of sh file.sh But in ...
18
votes
4answers
24k views

How to save output from command (eg. diff) into a variable

I want to test if there is any output from the diff (test if files are same), if none echo "Passed $x" else echo "Failed $x". I came up with some intermidiate step (save the output from diff to a file ...
3
votes
2answers
614 views

Use user's icons in a bash script

I am looking for a way to use the icons from the users theme (in gnome) in a bash script. The solution could be a environment variable or a file where the path to the users icon set is written. Eg. ...
0
votes
2answers
127 views

Bash - CP difficulties

cp -r /opt/lampp/htdocs/codeigniter_2.0.2 /opt/lampp/htdocs/test/ That command is making this: /opt/lampp/htdocs/test/codeigniter_2.0.2 and I need only the content of codeigniter_2.0.2 inside test. ...
5
votes
1answer
925 views

Source/Dot operator error on login. Possibly caused by bad byobu uninstall

I am getting an error message every time I ssh into my box or run sudo -i. It looks like this for login: login as: person chands@ubuntu-server's password: -bash: .: filename argument required .: ...
4
votes
1answer
2k views

Toggling between Unity 3D and unity 2D [closed]

Generally, I much prefer Unity 3D over the 2D version, which is a bit broken on my machine. However, I frequently give presentations, and Compiz doesn't support multiple screens. I've been forced to ...
0
votes
1answer
2k views

cannot run java application from a shell script

after download and unzip the zip package, I copy the modelsphere.bat file to modelsphere.sh, and change the content to: java -ms64m -mx512m -ss16m -classpath ...
2
votes
3answers
4k views

I accidentally overwrite /etc/bash.bashrc file. Please give the default content

I accidentally overwrote the /etc/bash.bashrc file. Please give me the default content in that file to restore, or the file itself.
4
votes
2answers
495 views

Upgrading Evolution from source

As with most people I presume I am running Evolution 2.32.2 inside 11.04 Natty and regardless how annoying the crashes are I prefer it to Thunderbird. Obviously as soon as 11.10 Oneiric is released ...
2
votes
1answer
214 views

How to swap X-Server with Emacs org-mode?

I'm quite impressed of emacs' org-mode. So I want to use it for note-taking during lectures. To use it "distraction-free" my idea is the following: I want to register a bash-command, which swaps the ...
1
vote
2answers
145 views

How do you write a script that alerts you in the Terminal like mail's “You have mail”

I guess I'm looking for how to make a script to run whenever you press ENTER in bash, so that it can alert you by echoing a line about some event if an event has occurred.
2
votes
1answer
864 views

git-ls-files: command not found

I googled this command and it said it is provided via git-man, which I have installed. Anybody having issues with this command not being found? It appears based on git-ls-files manpage that we can ...
4
votes
2answers
173 views

How can I create something similar to an alias, that does properly expand to the initial command?

I have set up aliases for apt-get update, apt-get install, and so on. Thats quite convenient. But what I really would like to have is something like this: type agi TAB vi and have it automatically ...
3
votes
3answers
5k views

Bash Script: catching errors in a block of statements

I have a large iptables ruleset that I manage with my own bash script. Most of the commands in the script are simple, single-statment iptables commands. I am trying to improve the script by adding ...
3
votes
2answers
7k views

installing programs from the bash script

I wish to install a large number of programs from the software center on all my 8 machines. Installing each program individually would be time consuming so I decided to write a bash script for ...
33
votes
3answers
59k views

BASH script to set environment variables not working

I've written the following script to set some environment variables when needed. #!/bin/sh export BASE=/home/develop/trees echo $BASE export PATH=$PATH:$BASE echo $PATH Below the command and the ...
3
votes
1answer
2k views

Changing shell to zsh broke my terminal

I ran sudo chsh -s /bin/zsh to change my default shell to zsh. I then restarted my computer. When I turned it back on I get just $ as the prompt, so it doesn't look like I even get bash any more. ...
44
votes
3answers
44k views

How to grep for tabs without using literal tabs and why does \t not work?

When I search for tabs in a file with (e)grep I use the litteral tab (^v + <tab>). I can not utilize \t as a replacement for tabs in regular expressions. With e.g. sed this expression works very ...
3
votes
1answer
4k views

Configuring syslog for bash script logging

I want to use syslog to do some bash script logging. I see /etc/rsyslog.d/50-default.conf, but I'm new to syslog. I want to configure local0 for logging for my scripts. Should I be editing this ...
1
vote
2answers
668 views

Running Matlab with Gnome-Do: bash script problem

In Ubuntu, Matlab should be started with the following command: setsid matlab -desktop Accordingly, I've created such a bash script: #!/bin/bash setsid matlab -desktop and saved it as ...
5
votes
2answers
698 views

How to re-start a python script without killing other python processes

I develop an app called Unity Mail. A quicklist option «Edit accounts data» needs to restart it. File /usr/bin/unity-mail: #!/bin/sh python /usr/share/unity-mail/unity-mail.py $@ File ...
7
votes
3answers
11k views

How To Customize Ubuntu Bash to make it like Mint?

I love Linux Mint's bash customization. It includes both a color prompt and a quote displayed with ASCII art. Is it possible to have it in Ubuntu?
1
vote
1answer
1k views

Red5 start script not working

I have an EC2 instance running Red5 and I added the following script to the scripts that run on startup and shutdown of the server: ################# NOTE FROM DOMINICK # First Follow these ...
2
votes
1answer
443 views

Why isn't .profile sourced on login to LXDE?

I switched recently from GNOME to LXDE and since then my .profile file hasn't been sourced on login. I found out that my PATH variable doesn't include ~/bin anymore. However, my .profile file includes ...
2
votes
1answer
378 views

bash dirtrim produces strange results with ~/foo/bar/var directory

In some of my projects, I keep a var or a lib folder for runtime output and external libraries. To keep my prompt rather short, I have the export PROMPT_DIRTRIM=3 option in my .bashrc. This works ...
4
votes
1answer
784 views

Adding bash script to disable Nvidia graphic card at startup?

I've found the way to disable my hybrid card GT 540M on Asus K53SV at: https://launchpad.net/~hybrid-graphics-linux That's great, but I need those commands to be executed automatically at startup. ...
6
votes
2answers
4k views

How to open a file or folder from Terminal with mouse

I'd like to know if there is a way to open a file or a folder from terminal using the mouse? When I wrote a URL LINK in terminal, it's allows me to open that link on my default browser. So I'd like ...
1
vote
1answer
416 views

Enabling Compiz “Extra” or “Normal” effects per bash in Ubuntu

Enabling disabling compiz per bash is pretty simple per compiz --replace, But how can I switch between the None / Normal / Extra -- Visual Effects in the "gnome-appearance-properties" only using a ...
4
votes
1answer
4k views

What could be a reason for `.bash_profile` and `.bashrc` not to execute the exports?

the CUDA installation tutorial tells me to add the following two lines to my .bash_profile. export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH But ...
3
votes
2answers
2k views

Shell script to restart a process if it outputs a certain piece of text

I have a python program which, from time to time, crashes with a number of different exceptions usually due to network issues. The only way to get it to work is to restart it. How would I write a ...
13
votes
5answers
12k views

Search for duplicate file names within folder hierarchy?

I have a folder called img, this folder has many levels of sub-folders, all of which containing images. I am going to import them into an image server. Normally images (or any files) can have the ...
6
votes
3answers
838 views

directory name with space and bash

I'd like to exclude the directories "temp" and "Ubuntu One/" from backup. What is the correct escaping of the space???? RSYNCCONF="--delete --exclude=.* --exclude=temp/" Thanks in advance! Chris ...
4
votes
1answer
350 views

Custom bash prompt is buggy

I followed some articles on how to change the prompt, I've got the result I was looking for, but when the cursor reach the end of the screen it doesn't go new line and tab completion it's strange. # ...
2
votes
1answer
328 views

How to `cat` filename returned by `which`?

I answered this question but realize that it could be better. How can I convert: $ which gjslint $ cat /usr/local/bin/gjslint Into something like this: $ cat < which gjslint -bash: which: No ...
7
votes
4answers
29k views

Is it possible to pass passwords on a shell script?

Long time i am searching for this, i would like to know is it possible to pass passwords in a shell script? Many of the answers returned with no. Recently i read an article stating that how to pass ...
1
vote
1answer
213 views

plus or dash at perm bits?

When I need to find all files with SUID recursively starting from root directory I can do it in two not so different ways: find / -perm -4000 and the second one: find / -perm +4000 Which ...
35
votes
4answers
15k views

How to navigate long commands faster?

Is there a way speed up Linux CLI navigation when I must enter long commands? I simply use arrows right now, and - if I have a long command it takes some time to get from start of the command to the ...
2
votes
0answers
738 views

No Bash completion in VNC connections? [duplicate]

bash completion is not working with a vnc connection. I works if I login with ssh, but not with xterm/bash in a vnc connection. I tried with different display managers and with different machines, no ...