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

learn more… | top users | synonyms (1)

5
votes
2answers
3k 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
405 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 ...
11
votes
5answers
9k 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
794 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
325 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
317 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
23k 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
199 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 ...
27
votes
4answers
9k 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
674 views

No Bash completion in VNC connections? [closed]

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 ...
1
vote
1answer
551 views

Display number of hours since a specific time in bash

I have a command that outputs a single date in whatever format I please. Now I need a simple way of calculating (with bash) how many hours have passed since that date (default is yyyy-mm-dd hh:mm). ...
5
votes
2answers
11k views

How can I direct a pipe input to ls command?

When I type sth. like that find . -name *foo* | ls -lah it gives me a ls-output of 'pwd' like I had no file(s) given to 'ls'. To simply use ls -lah $( find . -name *foo* ) works well (when the ...
4
votes
2answers
3k views

How to recall history in teminal

I installed Ubuntu 10.10 yesterday. Then while using the terminal I noticed that once I quit a terminal session its history is gone, although history exists for applications in terminal ...
5
votes
3answers
356 views

Bash cannot expand backticks interactively

On RHEL5.2 (bash 2.3.25) I can cd `pwd`/[TAB] and pwd is substituted into my current working directory, using the output of pwd(1). How can I achieve the same functionality in Ubuntu 9.10 (bash ...
2
votes
4answers
197 views

Find and bash problems in recent Ubuntu versions

I've been having a problem the last six months or so when combining searches in bash. The exact example is related to Python programming but would apply to any kind of detection/manipulation. Suppose ...
3
votes
1answer
1k views

cannot insert backslash with bash, python, works fine with csh, idle

I have a strange problem with inserting backslashes (Ubuntu 10.10 and 11.04, the upgrade changed nothing). The key combination on my keyboard (Swedish Thinkpad T400) is AltGr + ?. However, this seems ...
19
votes
4answers
7k views

Bash auto complete for environment variables [closed]

The bash autocomplete feature does not seem to work with environment variables in 11.04. The current behavior is indicated below export SCRIPT=/home/user/script cd $SCRIPT/<tab> results in a ...
23
votes
3answers
5k views

Bash auto-completion with added spaces – why, and how to fix?

I use tab completion more than typing letters. I used to type rm ~/De<TAB> and it would be completed to rm ~/Desktop/ so that I could continue on the next level. Recently, that behaviour ...
0
votes
2answers
937 views

Shell tweak to show current path in addition

I'm using ubuntu 10.10 and now I got in the shell something like that: machine1user@mylinux:~: how can i change it to machine1user@mylinux:/my/current/path :~: ?
2
votes
3answers
519 views

Integer operators in bash

How can I use ++, +=, *=, etc operators in bash script. Examples please. Example in C++: int a = 7; a = ++a + ++a; printf("%d", a);
3
votes
1answer
2k views

How do I disable pathname expansion in bash?

Suppose I'm a lazy bum and want to avoid putting every string in quotes when passing arguments to a function, how do I avoid the characters * and ? being used by bash for patname expansion? ...
0
votes
1answer
168 views

What command runs when I SSH into a server?

When I SSH into a server, I see the MOTD then I am in BASH. What command is running that takes care of displaying the MOTD and then starts the shell?
0
votes
2answers
3k views

Copy file to dir using wildcards or regular expression in destination?

I want execute this cp debian.master/abi/2.6.38*/amd64/generic debian.master/abi/2.6.38*/amd64/core2 but bash gives error in second *: cp: cannot create regular file ...
8
votes
1answer
3k views

Why does /bin/sh point to /bin/dash and not /bin/bash?

As far as I understand bash is the default shell in Ubuntu, so why does /bin/sh point to /bin/dash?
33
votes
6answers
29k views

/etc/profile not being sourced

For 11.04, I did a fresh install of my system. Part of that install was to install rvm, which sticks a rvm.sh in /etc/profile.d/. This doesn't work as /etc/profile (which loads each +r in ...
1
vote
1answer
1k views

Bash: change environment temporarily

I am using a dev tool which supplies a script that sets environment variables. If I source the script the environment is modified for the duration of the bash secession. In order to revert the changes ...
0
votes
1answer
197 views

Weird Stuff in Terminal When I Hit Tab

For some reason, today, everytime I hit tab in the terminal this shows up: cat bash: warning: setlocale: LC_CTYPE: cannot change locale (en_CA) Display all 150 possibilities? (y or n) This ...
8
votes
3answers
7k views

Apt-get install multiple packages without stopping

I am making a bash script that installs various packages using apt-get install. However, I notice that if there is a line that says: sudo apt-get install package1 package2 package3 and either of ...
0
votes
1answer
914 views

My SSH tunnels get interrupted because the host machine falls asleep. Bug or Feature?

My gnome-power preference is set to automatically sleep after 30 minutes of inactivity. Apparently it thinks that a ssh connection is not a valid reason to keep it alive. Is this a feature or a bug? I ...
2
votes
3answers
2k views

How to find out if current shell was loaded by another shell?

When I am in a terminal, and I type /bin/bash, that starts up another bash shell, right? Is it possible to find out, via some command, whether the current bash shell has been started from another ...
37
votes
3answers
79k views

How do I find the version of bash I am running?

(learning bash) I was trying to check the bash version so I typed /bin/bash -v. That outputted a whole lot of text to the screen (contents of .bashrc, and other files sourced from it). Could I have ...
5
votes
2answers
11k views

bash: [: too many arguments?

I'm trying to create a directory and cd into it: In ~/.bashrc: function abc() { appname=$1 appdir="$HOME/code/$appname" if [ mkdir $appdir -a cd $appdir ]; then echo Success else ...
22
votes
9answers
161k views

How do I run .sh files in Terminal?

Whenever I open a .sh file, it opens it in gedit instead of the terminal. I can't find any option similar to Right Click → Open With → Other Application... → Terminal. How do I open this file in the ...
3
votes
1answer
13k views

How to redirect output to screen as well as a file in a yet-to-be-created directory?

My aim is to log all output from a script into a directory that the script is going to create. For example, I have: ~/.abc.sh: #! /bin/bash rails new myapp When I run... cd ~/code . ~/.abc.sh ...
0
votes
3answers
2k views

How to change directory at the end of a bash script?

In my .bashrc: function rnew { $HOME/.dotfiles/railsnewapp.sh $1; } Essentially, I call rnew from any directory, and it creates a directory in ~/code/appname, installs Rails into it, and then I ...
8
votes
2answers
268 views

What is the program that suggests installable packages?

One of the features of Ubuntu that I really like is the one that suggests packages to install if you try to run a program that isn't installed, like this: $ nmap The program 'nmap' is currently not ...
2
votes
2answers
2k views

How can I change the user during a bash script execution?

I have written a bash script from which i execute it from the root. I want to execute a particular command in a user account rather than root account.So how to execute that command in a user account ...
5
votes
1answer
8k views

Extracting from a tar file - Default behavior: overwrite or keep?

In the documentation, I read that tar has the following options when extracting files from a tarball: -k, --keep-old-files don't replace existing files when extracting --overwrite ...
0
votes
4answers
755 views

How to escape this in the bash script?

I'm trying to complete a batch of 3 videos to leave it there till morning processing but it seems there are special characters in it... I try it "raw" in the terminal and it works but in bash script ...
4
votes
4answers
522 views

How to create bash file and allow it to accept an argument from the terminal?

In recall for nostalgic feelings, I've remembered the .bat files on DOS. :) Here's the thing: Each time I need to generate a documentation for a given web application I have to: sudo phpdoc -o ...
3
votes
1answer
297 views

link key to a bash script

I'm trying to link a button (now without function) to a bash script that I have made on UBUNTU. I'm using a clevo W150HNM/Sager NP5160 I want to use 1 or 4 for this(see photo on ...
22
votes
4answers
35k views

How to change extension of multiple files from command line?

I have many files with .abc extension and want to change them to .edefg How to do this from command line ? EDIT: I have a root folder with many sub-folders, so the solution should work -r ...
0
votes
2answers
278 views

whats wrong with this zenity code?

whats wrong with this code? #!/bin/bash ARCH=$(uname -m) if ["$ARCH" = "i686"]; then zenity --info --title="Architechture Checker" --text="Your Architechture is 32-Bit" if ["$ARCH" = "x86_64"];then ...
2
votes
3answers
318 views

Can I boot straight into bash from a USB drive installation?

I need to boot from a USB drive installation of Ubuntu 10.10 to do some maintenance on an older machine, and I don't feel like waiting for five minutes for the gnome to log me in. Is there a boot ...
2
votes
1answer
197 views

Extra dash insertion when trying to run tar

I have a really weird issue where I'm getting an extra - insertion on tar: # tar -zxvf mod_wsgi-3.3.tar.gz /bin/tar: unrecognized option '--zxvf' Try `tar --help' or `tar --usage' for more ...
0
votes
1answer
210 views

Is there a better (closer to home row on keyboard) shortcut for the home directory in bash than tilde?

I don't like reaching for the tilde ~ key so often when I'm specifying file and program paths relative to the user home directory on the command line. Does anyone have any tips for cutting the number ...
0
votes
3answers
209 views

variables in bash

for i in *.jpg do j = '$i | cut -d . -f 1' convert $i $j".png" done temp.sh: line 3: j: command not found I know about mogrify, just wanted to know how to get variables done in bash.
1
vote
1answer
2k views

Path not setting up for a setup

I am unable to add path of my omnet bin directory for the installation. During the installation i go to the omnet directory and enter ./configure which gives me the following errors WARNING: your ...