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

learn more… | top users | synonyms (1)

3
votes
5answers
6k views

How to rename file names with spaces in a shell command line script

I am trying to rename all files in a folder replacing underscores with spaces. i.e. this_is_a_test --> this is a test but somehow I'm messing up the quoting > for file in * ; do echo mv -v ...
3
votes
2answers
272 views

There seems to be a difference between .bash_history and what up arrow displays, where does the up arrow get it's data?

I seem to have discovered that the ~/.bash_history file doesn't contain what is displayed when you use the up arrow. I found this by doing a command like so $smbclient -L 10.2.10.240 -umyuser -p"...
1
vote
3answers
57 views

Environment variable is not update

I try to set the $PATH reference to the current working directory, one machine work as expected, but another machine is not. basically, I have set below line in .bashrc export PATH=$PWD/bin:$PATH ...
23
votes
7answers
36k views

How to clear text in a file?

How to clear text that existed in a text file with out opening it ? I mean for example I have a file as hello.txt with some text data in it & how can I clear the total text in that file with out ...
0
votes
1answer
105 views

How do I send personalized notify-send about custom events?

watch netstat -n -A inet + notify-send "Attention new connection" or watch cat /proc/net/ip_conntrack + notify-send "Attention new connection" or watch ss -n ...
3
votes
5answers
3k views

How to run application from terminal forever? [duplicate]

I start jenkins web server using command java -jar jenkins.war. It works great. When I close terminal the application stops. How to make it run even if I close terminal session ?
1
vote
1answer
5k views

export: * not a valid identifier, whenever I use bash?

I keep seeing -bash: export: `=': not a valid identifier -bash: export: `/usr/lib/jvm/default-java': not a valid identifier -bash: export: `=': not a valid identifier -bash: export: `/usr/share/...
1
vote
1answer
295 views

How can I force the backlight to never turn off?

I'm using Ubuntu 13.10 with GNOME 3.10 on a Packard Bell EasyNote-TK37 (Intel GM45 Express graphics), and I've had significant problems with my backlight. Initially, upon booting the backlight would ...
1
vote
1answer
581 views

Opening Sublime Text 2 from Terminal Problems

When I run the command sudo sublime from my terminal, it opens the program but will not allow me to run any other commands in my terminal until I close sublime text. This doesn't work because I'm ...
2
votes
1answer
3k views

How to run bash script in upstart conf file?

I made bash script "kvm_manage". How should I write .conf script and run my bash script inside? It is possible? I am beginner..
0
votes
1answer
163 views

Concatenation in Shell Scripting Bash

I wanna check if 2 lines have equal $4 my shell must check if the diffrence between $3 in line 2 and $2 in line 3 is equal 1 it must concatenate both line into one like this 1;1000000000;1099999999;2 ...
12
votes
2answers
27k views

Explaining “-bash: No such file or directory” [duplicate]

Why would bash claim that a file doesn't exist when it clearly does? $ ls -l a -r-x------ 1 configurator configurator 3904 Dec 7 10:36 a $ file a a: ELF 32-bit LSB executable, Intel 80386, version ...
0
votes
2answers
76 views

when to use -f or -a tag in if loop

I'm confused between two tages that can be used in if statement in bash scripting. One is -f and other is -a. Their description states as follows: [ -f FILE ] True if FILE exists and is a regular ...
1
vote
3answers
308 views

How can I prepend a random letter/number to the beginning of each filename?

I'm working on a system where I'd like the first letter of each filename to be random - not necessarily unique, just random. I'd like to be able to run this from a cron job. For example, I would be ...
1
vote
1answer
108 views

Keep working with bash while a program is running [duplicate]

I know, this is a very stupid question and the answer is out there in Googleland. But I just can't find it. I want to start a process/program (e.g. firefox) in bash and keep working with the terminal....
0
votes
2answers
3k views

Save enviroment PATH once I added one

I'm trying to add an environment path for android studio, and I've done the following steps: checking is there is already: echo $PATH add my path: export PATH=$PATH:/home/ubuntu/Programs/android-...
0
votes
1answer
386 views

Retrieve data from sql into specified place in text

I'm very new to sql and bash-scripting, but even so I've manage to make a sql-table with coming events. And I manage to make a Script deleting old events and export everything in the table to a ...
0
votes
1answer
413 views

How to remove a record from bash tab completion options

Every time I type "ssh use" in my bash terminal and press tab the command gets completed to "ssh username.dreamhosters.com" but that was not what I was looking for. How can I remove that entry from ...
4
votes
1answer
990 views

How to check if the AC laptop adapter is plugged or not?

I need to check in a bash script running when my laptop starts if the AC adapter is plugged or not. Is this possible?
1
vote
1answer
88 views

How would I make this bash script that displays certain system processes related features?

Basically I need to make a bash script that acts as a handy tool for diagnosing performance issues. The script needs to first determine each unique process owner on the system, and then for each user ...
1
vote
3answers
8k views

changing shell from zsh to bash

My web server was tampered by someone who was using zsh shell. I feel more comfortable using bash shell, as that's the defaults that come with Ubuntu and OS X (the two main operating systems I use). ...
2
votes
2answers
59 views

Scripting bzr commands

Can someone push me in the right direction to either use a shell script or Python to make a script to simplify pushing a bzr branch to launchpad? The script process would be simple: cd /directory/...
176
votes
5answers
344k views

How to increment a variable in bash?

How to increment a numeric variable in bash? I tried with var=$var+1 and var=($var+1) but it doesn't work. My variable is a number, but bash think that is a string. My bash version is 4.2.45(1)-...
2
votes
1answer
1k views

Is Zenity progress bar affecting variables

Hi guys I am currently trying to implement zenity progress bar to my while loop, however I noticed that my variable which are meant to be incremented did not increment. Here is a sample test script I ...
0
votes
2answers
875 views

Cannot move file to subdirectory of itself

I'm having a little problem with renaming a bunch of files in a folder. The script: for file in $1 do mv $file $file | sed -r 's/^.{20}//' | sed 's/.\{16\}$//' done The output: mv: cannot ...
0
votes
1answer
134 views

Make a string from array of Strings

I have a piece of bash code, in which I would like to make a long string from an array of strings. The bash code is as follows: # Load all the SNPs arrSNPsToBeExtracted=( $( cat $indexFileName ) ) ...
1
vote
2answers
829 views

I'm parsing the output of `ls` and something went wrong

I made this simple script to copy a file recursively to many sub-directories. Here I am showing the problem for 3 sub-directories. I have 3 sub-directories and 2 files in a directory as follows 0.003/...
26
votes
7answers
48k views

Command to convert an upper-case string to lower-case?

What is the Bash command I can use to convert an upper-case string to lower-case and vice-versa? Thank you.
0
votes
1answer
140 views

Ubuntu corrupt PATH

So I modified profile file under /etc/ and now I cannot use commands like sudo, ls, etc., but I cannot modify this file without sudo. The question is: how can i get to sudo and gedit. I imagine it ...
3
votes
3answers
1k views

How to pipe/dump clipboard contents to a file?

I want to pipe/dump the contents (esp. text) of the clipboard/Ctrl+C to a file, preferably using Bash or Perl (in order). I'd rather not use GUI applications please.
-1
votes
2answers
26k views

Bash return permission denied error when I redirect the output of ls to a file [duplicate]

I'm currently studying shell commands, one of the exercises consists in creating a structure with various directories and subdirectories. I wrote ls -laR > hello, it was supposed to create a text ...
0
votes
1answer
369 views

When piping output to a file, why are stderr and stdout in the wrong order?

I have a perl script: warn "1\n"; print "2\n"; warn "3\n"; print "4\n"; I pipe the output to a file: perl script.pl &> foo cat foo: 1 3 2 4 Why isn't the output in order, and how do I ...
3
votes
3answers
1k views

Executing vi on directory does not list files

This seems like a new bug (feature ?) that’s creep into Ubuntu 13.10. When I execute vi on a directory it doesn't list the files which I can navigate to with the arrow keys; it just shows an empty ...
4
votes
1answer
577 views

When trying to Install Shiny Server for R, the command in the setup instructions triggers a Bash syntax error, how do I fix it?

So I'm trying to install shiny server for the R programming language on Ubuntu 12.04, using the information available at this page on the program's github. However, when I get to this step: # ...
4
votes
1answer
623 views

What do + and - mean in the output of jobs command?

I cannot find the answer anywhere. When i have several jobs that are in the background and i list them with jobs i get the following: [1] Stopped command1 [2] Stopped ...
-2
votes
1answer
477 views

How to fix the screen being to bright in Ubuntu 12.04 and up

How to fix the screen brightness and color being too bright in ubuntu.
2
votes
1answer
580 views

How to use debcondf Show results with debconf-set-selections?

I'd like to know in common how to use the results of debconf-show with debconf set selections to precvonfigure deb packages with the command line or within a shell script For example If I use sudo ...
2
votes
1answer
333 views

Bash error when trying to execute a file

i am kinda new to linux and in programming so please excuse my lack of knowledge. I'm trying to run a basic program named trial.c with an executable file named trying but when I type ./trying in the ...
0
votes
2answers
903 views

How to change environmental variable permanently?

I am trying to use third party packages in Python. To import all the modules I need to update PYTHONPATH. I read several blogs on it but still I have following questions unanswered. Is sys.path &...
3
votes
3answers
2k views

how to check if PPA is already added to apt sources list in a bash script

Do someone know how to check if a PPA is already added to my system before i add it with the add-apt-repository command in a shell script. That would be very helpful. Thank you.
0
votes
1answer
121 views

UbuntuOne using bash script to copy files

I am new to ubuntuOne. I need to copy / backup a folder, using bash script. Is it possible? I did not find where are the local copies of the files, saved by ubuntuone. Thanks.
2
votes
2answers
1k views

Simple CLI to append one file to the end of another

If I have two text files, file1.txt.and file2.txt, how do I append the contents of file2.txt to file1.txt (without overwriting file1.txt) using a simple command-line?
3
votes
1answer
1k views

“Can't open” an /opt file

This is my first post. I wanted to ask for any idea so to solve my problem. I am using Ubuntu 12.04 LTS, and my purpose is to use OpenFoam CFD software. I am trying to execute an script called Allrun ...
0
votes
1answer
441 views

PATH variable to Apache OPENNLP OK but doesn't work

yesterday I installed in my Ubuntu AWS 12.04 (Amazon) micro istance OpenNLP and seemed working. Today when digiting opennlp:command not found Following suggestions found here: I modified my ....
0
votes
1answer
456 views

run a script as non-root user

I want to run a script say some_script.sh(that requires root permissions, contains some sudo do something in a for loop) as non-root user. I have a script as shown below. I want to run this script as ...
0
votes
2answers
79 views

Resetting an alias

In my .bashrc file I created a new alias: alias source=mvn eclipse:eclipse -DdownloadSource=true -DdownloadJavadoc=true I executed source .bashrc, however I realized the horrible mistake I made and ...
1
vote
1answer
815 views

Use rsync to change only the date modified of folders/files

I just transferred 1.8TB of data from an external hard drive to an internal hard drive using rsync, but I didn't add the "-t" flag, so the "Date Modified" for every file on the internal hard drive is ...
0
votes
2answers
2k views

How to run bash commands in Ubuntu 13.10? [duplicate]

before in Ubuntu 12.04 when I make simple bash commands, it works but in Ubuntu 13.10 I can only open it with gedit! How I can run it by only one click?
1
vote
3answers
4k views

wget download list to specific directories

I would like to create a short but sweet script for wget to use a .list file. The catch is that I'd like to set directories that these files go into. Example: file: url.list [group 1] http://www....
-1
votes
1answer
581 views

bash: ./mono: No such file or directory

I downloaded something off the internet for my ubu12.04x86 and whenever i cd to that directory and try ./mono is gives me bash: ./mono: No such file or directory mono is a type of .net->deb ...