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

learn more… | top users | synonyms (1)

1
vote
3answers
5k views

How to reset default permissions for /etc?

By mistake I have made permission changes for /etc. Now it's giving me the following error message: bash: /etc/bash.bashrc: Permission denied I have no name!@chandan-Inspiron-5520:~$ sudo ...
0
votes
2answers
185 views

How to make bash scripts execute when clicked upon?

I am trying to create a bash script for the Dash home button, as I am trying to fully replace the Unity dock with the Cairo Dock. Unfortunately, I have been unable to make it so that the script only ...
13
votes
7answers
5k views

Auto complete for often used command line commands?

For some projects I often type in a couple commands, like for example: cd an/extremely/long/path/in/which/I/have/some/kinda/project and ./runmyproject --with some --command line --options set ...
2
votes
2answers
18k views

Android SDK and Path

Since I've downloaded the Android development kit as a package (sdk, eclipse bundled together), I extracted it into /opt/android/sdk I ran the command nano ~/.bashrc command and opened the file. Now ...
2
votes
1answer
241 views

Is it possible to make a python script that runs on a specific terminal-profile

I have this python script that connects my desktop to the internet. there is not much text in it only a few messages about current status and time. So it would be really nice if i can open it (.sh ...
1
vote
2answers
1k views

constantly check if the virtualbox is started or still booting up from a script

I am writing a shell script to start a virtualbox (ubuntu). After the command I want to put a for loop to keep checking the status of virtualbox and the script comes out of the loop only after the ...
0
votes
1answer
374 views

wget and curl somehow modifying bencode file when downloading

(this is a copy from my post on Stack overflow I am hoping someone in the ubuntu community can shed some light on the situation for me) Okay so I have a bit of a weird problem going on that I'm not ...
1
vote
1answer
335 views

Application running in foreground?

Gvim has the -f option. Its man page says, -f Foreground. For the GUI version, Vim will not fork and detach from the shell it was started in. What does this mean? I ...
2
votes
1answer
80 views

cd to target folder after copying?

This could be quite a simple one, but I can't find any answer for it. If I am in a terminal and use the cp command, is there a way of instantly cding to the target directory? For example, is there ...
3
votes
1answer
2k views

Relative path to source when copying or moving [duplicate]

This might be trivial, but here goes. In terminal, I tend to find myself moving/renaming/copying files that are not in my current working directory instead of cd-ing to the directory of those files ...
7
votes
3answers
22k views

How to execute sudo commands with Expect & send commands in bash script?

Can any body let me know how to execute sudo commands with expect. I tried the following but this is not working. Can anyone give me suggestion please? set login "sasuke" set addr "hostname" set pw ...
7
votes
5answers
701 views

How to use syslog for else output ( show up with whois - query )?

There is log-file /var/log/syslog with the output of ip-addresses like e.g. SRC=10.158.0.1. I want to scan from this file every printed address in SRC= ... and then to make query with whois (SRC= ...
4
votes
2answers
1k views

A script to monitor new files in folder so I can add them to an external XML files

I want to monitor (by cron, I got that part covered :P) new audio files in folders so I can add them toa separate XML files which act as an podcast RSS feed. The file structure looks like this: - ...
0
votes
1answer
118 views

Hide desktop startup screen

I am working on a hardware device running on Ubuntu. One of the most important features is good presentation - in my case not showing the OS startup screen etc. Currently I am using upstart to start ...
1
vote
2answers
3k views

How to Import a Variable from a Script?

I want to get a variable from another script, as demonstrated in http://stackoverflow.com/questions/5228345/bash-script-how-to-reference-a-file-for-variables However, the answer uses source command ...
2
votes
1answer
253 views

Using source vs bash commands

test.sh mkdir test echo $1 echo $2 It appears that following two commands do the same things. Are they the same? If not, how could I alter my example to show the difference? cat test.sh | bash -s ...
1
vote
1answer
1k views

how to know process pid of bash function running as child?

I am trying to know the pid of a function that was run as child process on a script FUNCtstPsSelf.sh #!/bin/bash echo "pid=$$;ppid=$PPID" ps -p $$ function FUNCtstPsSelf() { sleep 3; echo ...
0
votes
3answers
25k views

Where my linux password is stored on my system and how i can retrieve it? [duplicate]

I am currently logged in on my Linux system and i want to output my Linux password and username on my terminal, what commands i need to write and in which file it is stored and how i can retrieve it ? ...
9
votes
2answers
6k views

xclip on headless server

I've been using xclip to copy the output of bash commands like so: pwd | tr -d "\n" | xclip -selection c So that I can then paste the output into another terminal session. I was trying to use it ...
0
votes
2answers
5k views

Bash script with execution permissions won't run with dbl click

I have a bash script that has permission to execute, but when I double click it in nautilus it wont execute, instead it opens its text in gedit. In properties it says open with: gedit, and that ...
2
votes
3answers
515 views

How to declare functions as variables

I want to declare variable with pwd() function, which will give me the current path. I want to use pwd() function as ${pwd} variable, something like that. How I must write? Thanks!
0
votes
3answers
190 views

Options in bash commands

Are the commands' options case sensitive? i.e. I did rm -r directory And rm -R directory And I got the same results, whereas when I did ls -r directory and ls -R directory I got ...
0
votes
1answer
219 views

how do you make the scripts in /home/$user/bin accessible using sudo? [duplicate]

How do you make the scripts in /home/$user/bin accessible using sudo? as in: sudo $NameOfScript in using Ubuntu 12.04
7
votes
3answers
9k views

Changing behavior of bash prompt when functioning as root

Before you click away, this isn't the typical "how do I make my bash prompt have color" question. I've already customized my bash prompt to look like this: [user @ host]----[$(pwd)] $ where ...
18
votes
6answers
51k views

Not able to execute a .sh file: /bin/bash^M: bad interpreter

I wanted to execute a shell script: -rwxr-x--x 1 root root 17234 Jun 6 18:31 create_mgw_3shelf_6xIPNI1P.sh I tried to do a standard procedure, but I am got this error: ...
20
votes
5answers
7k views

Run a command with the argument from the last command

When running commands, sometimes maybe you need to run a command with the argument from the last command. How can you do this? Of course, excepting the use of the arrow keys and Del keys: ...
1
vote
1answer
151 views

How to run a command for all users in a specific group at login, any help would be appreciated

We are using Ubuntu Server 12.04.2 to host virtual devices in our office. Our boss has written a program for Ubuntu that logs all activity and time spent at a single workstation to monitor misusage of ...
0
votes
1answer
236 views

How to insert parameter into command in bash script?

I have a bash script called "startserver.sh". I call it from another file like this: sudo sh /opt/startserver.sh 400 I want to use the parameter "400" in startserver.sh like this: java -Xmx400MB -jar ...
0
votes
1answer
1k views

source .bashrc does nothing

after installing virtualenvwrapper I edited .bash_profile and added those lines (it was blank actually) export WORKON_HOME="$HOME/.virtualenvs" source /usr/local/bin/virtualenvwrapper.sh then I ...
0
votes
1answer
321 views

How to extract a record in a text on string match in a file using bash

Hi I have a text file sample.txt as =====record1 title:javabook price:$120 author:john path:d: =====record2 title:.netbook author:paul path:f: =====record3 author:john title:phpbook subject:php ...
1
vote
1answer
111 views

user recognizes command but root doesn't

I installed arm-linux-g++ and added its directory to PATH and it recognizes the command. But when I try it with sudo it says command not found. I even tried adding its directory to bashrc--root but ...
2
votes
1answer
1k views

Why is “rm” so much slower than deleting files via the File Manager?

I witnessed that deleting directories (with the size of a couple of gigabytes) which contain many files is very slow when using rm. It takes up to several minutes! When deleting the same folder via ...
3
votes
1answer
502 views

Doing something if connected to particular SSID in Ubuntu

I want to write a bash script that will put off dropbox automatic synchronization if i'm connected to particular wifi ssid. How can i catch this event: for example i'm working at home and sync is on, ...
0
votes
1answer
4k views

Apply iconv to all of the files in a directory

While trying to convert a collection of .srt files: iconv -f cp1256 -t utf-8 directory/* > target/* it converts all of the 22 files in the directory to one file in the target directory called *. ...
0
votes
1answer
55 views

Flag scripts in ubuntu

Is there a way to create flag scripts in ubuntu that go off when a particular command is executed in the terminal, like for example when I execute sudo ifconfig wlan0 down Another script would get ...
0
votes
1answer
154 views

Executing binary does not work and does not return anything, although expected

I have downloaded biber from here: http://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/1.6/binaries/Linux/ Neither the 64bit nor the 32bit executables work for me: After downloading ...
6
votes
1answer
5k views

bash script source: No such file or directory

I have a script that begin like this #!/bin/bash VALKYRIE=~/myProjects/valkyrie source $VALKYRIE/cluster.conf but when I run it it returns line 2: ~/myProjects/valkyrie/cluster.conf: No such file ...
1
vote
1answer
447 views

“Permission denied” error using dpkg-scanpackages and gzip

I'm quite new to Linux. I wanted to set up my own local apt-repository using instructions given here. However, when i execute the script as: #! /bin/bash cd /var/www/debs/i386 dpkg-scanpackages . ...
1
vote
1answer
390 views

Bash alias permanent <without running bash or . ~/.bashrc>

I'm used to putting my alias in .bashrc, but Ubuntu suggests putting them in .bash_aliases. So that's fine, I put my alias there in the .bash_aliases file. However I want to run my aliases once I ...
2
votes
1answer
905 views

Replacing some characters in the previous command

Sometimes, being rushed, it is possible to type some characters wrong in a command-line. If the command is long, the mistake correction may be cumbersome (using arrow keys). So the problem is: how can ...
1
vote
2answers
540 views

Activate dash after minimal GUI installation on Ubuntu Server

I installed the ubuntu desktop package without recommends on Ubuntu server 12.04 and noticed that dash does not work - it just won't find any applications (screenshot). How can I activate it? I assume ...
1
vote
2answers
480 views

Bash refuses to execute correct binary

I've installed the current version of texlive (2012), which installs its binaries into /usr/local/texlive/2011/bin/i386-linux/. I subsequently added this directory to the PATH variable by modifying ...
2
votes
2answers
717 views

Detecting if folder exists and renaming by pattern

Me again with another command-line script question :) I made a helper script that looks like this echo 'target.bak -> target.old_bak' mv target.bak target.old_bak echo 'target -> target.bak' ...
2
votes
2answers
9k views

executing a shell every minute using cron

i want to run this bash code every minute using cron. I saved it onto /root/activate.sh #!/bin/bash for file in /home/user/torrents/*.torrent do if [ "$file" != "/home/user/torrents/*.torrent" ]; ...
3
votes
1answer
2k views

Generating a single LaTeX file by merging different LaTeX files

I have a main LaTeX file which inputs many other LaTeX files i.e. for example \documentclass{article} \begin{document} \input{input1.tex} \input{./Input_folder_1/input2.tex} \input{input3.tex} ...
0
votes
1answer
199 views

How to modify an input in bash script?

I want to do the following on a bash script: I want the user to enter a file name and the bash script must move the file to another file as follows. If the user enters input.tex, I want to move this ...
17
votes
6answers
70k views

How to determine if a string is a substring of another in bash?

I want to see if a string is inside a portion of another string. e.g.: 'ab' in 'abc' -> true 'ab' in 'bcd' -> false How can I do this in a conditional of a bash script?
4
votes
3answers
9k views

tail: inotify cannot be used, reverting to polling: Too many open files

When I try to tail -f catalina.out, I get the error: tail: inotify cannot be used, reverting to polling: Too many open files I tried the answer in this post: Too many open files - how to find the ...
0
votes
1answer
3k views

Bash alias not found stuck on my terminal

I was trying to make my Ubuntu connect to nexus tab and used the following command lines: echo "alias android-connect=\"mtpfs -o allow_other /media/GalaxyNexus\"" >> ~/.bashrc echo "alias ...
0
votes
1answer
2k views

How can I use the backspace character as a backspace when entering a password? [closed]

I just saw this code somewhere. It allows the user to enter his password and change it to an asterisk/star. But it doesn't recognize the backspace key. The code thinks that the backspace is part of ...