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

learn more… | top users | synonyms (1)

2
votes
4answers
185 views

“sudo bash” ignoring read-only permission of .bash_history file

This problem is in an up-to-date 12.04, and seems to have started recently. I have my .bash_history file set to read only. Lately I've noticed that despite this the file is being modified ! Here's ...
3
votes
1answer
165 views

segmentation fault when using su or sudo

example of the problem: $ su Segmentation fault $ sudo ls Segmentation fault I tried to compile sqlite3 from source earlier. I don't know what libraries it installed. This may be the reason why ...
0
votes
0answers
77 views

Ubuntu for phones: fully functional shell?

Will “Ubuntu for phones” work with a fully functional, normal shell/terminal like in Ubuntu Desktop? I’m working with bash-scripts with the cron and lp commands, and I have problems with these ...
1
vote
3answers
106 views

How can I get mv (or the * wildcard) to move hidden files?

I am migrating my home directory from an old system to a new one, and the tarball I made contains everything, including hidden files like .bashrc. However, when I move the contents of the unpacked ...
4
votes
2answers
285 views

How to display notebook model number?

I have a notebook HP Pavilion dm4 running Ubuntu 12.04 and I'm trying to determine the model number (like HP Pavilion dm4-2015dx or HP Pavilion dm4-2033cl, etc). There's no such information on ...
20
votes
2answers
570 views

How to run a script every time internet connects

I often mount a remote drive using sshfs. I would love to have this mount automatically. However, if I mount it in my .bashrc or startup scripts, the mount often fails because my wireless internet ...
1
vote
1answer
51 views

Is $RUN a built in command to execute?

I have a .sh script that starts a java service of mine (I didn't write this). Can someone explain how this actually executes? start() { .. .. # setup classpath . $ROOT/bin/_cp.sh ...
1
vote
3answers
73 views

how to detect that specified machine is present in local network

how can i detect - using bash if possible - that specific (i.e. name or mac address) machine has appeared in local network? IP addresses are dynamically assigned, so I can't rely on "traditional" ...
2
votes
1answer
97 views

Bash Prompt Changes Colors on ls

My prompt is: PS1="\`if [ \$? = 0 ]; then echo \[\e[33m\]':)'\[\e[0m\]; else echo \[\e[31m\]':('\[\e[0m\]; fi\` \e[0;1m\w\e[1m\n\$ " The problem is when I use ls, the prompt changes colors to the ...
1
vote
1answer
98 views

List all human users

How can I list all human users that I've created? I've tried cat /etc/passwd and it just lists a lot of stuff.
1
vote
1answer
115 views

bash history not being preserved

this is a fresh install of ubuntu 12.10. i haven't even looked at the bashrc or profile files when i noticed that history would work fine for the current session. as soon as i closed the terminal, ...
1
vote
1answer
45 views

command which takes in password as argument? [duplicate]

Is there any bash command or technique through which we can enter in password alongwith the command which requires the password of superuser? for e.g sudo apt-get install kde <password> I am ...
2
votes
0answers
83 views

Tell if windows are open and not minimised from shell script Unity

I'd like to add into my .bashrc a little script that sets the terminal background to transparent iff I don't have any non-minimised, non-terminal windows open and leaves the terminal background as ...
29
votes
4answers
1k views

Removing files with a certain extension except one file from terminal

I need to remove all files with .gif extension except one file with name say "filename.gif". What is the optimal way to go about doing this in terminal? The command rm *.gif removes all gif files ...
3
votes
1answer
40 views

Correct place to put colors of prompt (PS1)

Say I want to change the colors of my PS1, or for the sake of simplicity I just want to change the content, so I want to do this: PS1="touch me : " My problem, doubt is: If I put this in ...
1
vote
0answers
49 views

Execute custom bash script with sudo without passwd prompt [duplicate]

I run ubuntu-12.04 desktop x86_64. I have a simple script that needs to be accessible from the Desktop and run as root: $ cat ~/Desktop/flash.sh #!/bin/bash - cd ~/tools sudo ~/tools/fastboot-HW.sh ...
0
votes
0answers
35 views

Can I store a password in a bash script? [duplicate]

Is there some way to store (for example hashed etc.) secured password in a script that will be used during connection to server? Storing password and username as clear text in code for me is quite ...
1
vote
2answers
158 views

Bash script to open up a terminal and cd into a directory

I'm trying to write a simple bash script, which when run from the command line, will cd into a default directory and then open up the folder in the file-browser: #!/bin/bash if [ -z "$1" ] then # ...
1
vote
0answers
64 views

Why is top breaking history-search-backward in bash?

I have a line in my .bashrc the following line: bind '"\e[A": history-search-backward' that causes that when I write "abc" to command prompt and press up arrow, bash searches in history only for ...
6
votes
2answers
366 views

How to 'cd' to a directory found with 'find'?

I have a file in gmai.rb in the below directory: root@ubuntu:~# find / -name gmail.rb|more /media/aruprakshit/FA686DE4686DA05D/Rubyscript/gmail.rb But when i am trying to reach to the Rubyscript ...
0
votes
0answers
45 views

Netbeans not working after restarting the computer

I have NetBeans 7.1 installed on Ubuntu 11.10. I had to restart the computer to free up some disk space that had been gobbled up by apache. (apache2/error.log had taken up well over 90% of the disk ...
3
votes
1answer
271 views

Unable to apply wallpapers

We are unable to apply wallpapers, we are getting the following error. How do i fix it?? Error: Error setting value: Can't overwrite existing read-only value: Value for ...
3
votes
1answer
66 views

How to sandbox Bash shell to affect only current directory?

I heavily use Bash to automate my work. Hence I often [re]write long chunks of code right in the prompt. Is there a way to make commands in any way affect only files from current directory? So in case ...
2
votes
1answer
30 views

What is the difference that explains different results of different ways to assign values in a command-line?

What is the difference that explains the different results of these commands? a=2 echo $a set a=2 echo $a a=2; echo $a set a=2; echo $a
0
votes
0answers
144 views

ubuntu 12.04 pre-compiled binary syntax error: “(” unexpected

I'm trying to run a pre-compiled executable (.x) file but get the error trace.x: 1: trace.x: Syntax error "(" unexpected The machine I'm trying to run on is a relatively fresh install (<1 ...
0
votes
0answers
73 views

msmtp not working?

I was trying to send mail from bash, but it doesn't work and I can't find the reason... So my .msmtprc file is account default host smtp.gmail.com port 587 from account@gmail.com tls on tls_starttls ...
0
votes
1answer
137 views

How to execute a script before login screen?

I would like to know , how can I run scripts before the login screen.I mean My script should start running before login screen will appear.How can I achieve that?. I am the root user of that PC. ...
0
votes
1answer
88 views

bash and c - 2 processes in concurrency to write a file

I made a C program, it forks 2 processes and each one of them uses system() to call 2 scripts (script1.sh and script2.sh), what I want to do is let them write in a file (output.txt) in parallel ...
2
votes
1answer
24 views

Where to publish useful customised functions

I have started to write a customise function, that encapsulates a bunch of actions that make my daily work easier. A few questions about sharing the function with the community: What would be the ...
0
votes
3answers
135 views

How to determine status of upstart job in bash script?

How do you determine if an upstart job is running inside of a Bash script? That is I need a "boolean" value to do something like: #!/bin/bash if [ determine_if_job_x_is_running ]; then echo "I see ...
3
votes
2answers
127 views

Long lines overlap in Bash PS1 customized prompt

I have configured a fancy two-line PS1 bash prompt, with server name, time, user name and other useful variables. PS1="\n\[\033[1;34m\]\342\226\210\342\226\210 \u @ $SERVER_NAME""$BBlue"" ...
3
votes
3answers
136 views

how to avoid space in filename?

I have a bunch of files which need to be converted from .mp4 to .mpeg.one. A friend of mine had suggested me this simple script. However it doesn't work because filenames contain blank spaces. Here ...
1
vote
1answer
145 views

Auto confirm when running bash scripts?

I am working on a simple bash script that configures new servers how I want them. It's nothing special but it will hopefully save me quite a lot of time in the future. How do I prevent prompts like ...
0
votes
4answers
56 views

Counting files per owner recursively

From an entire directory structure I would like to output all the owners and how many files belong to each owner. I would like an output like this: +-------+-----+ | alex | 3 | | liza | 345 | | ...
1
vote
3answers
129 views

Bash script generating image from video with specific title in subdirs

I have the following bash script generating a jpg file with the same name of the video file. Now I need to change the bash script to generate the jpg file with the name image.jpg instead of with the ...
3
votes
2answers
143 views

What is the life of an infinite loop send to background?

When will an infinite loop end? E.g. if I run while :; do sleep 1; date +%s; done & when will this end — on closing the terminal or on shutdown?
0
votes
1answer
160 views

zenity alternative for bash scripts in package sources?

Zenity is a bit too limited for my use cases. What are the alternatives? Must be inside package sources. Must be useable from within bash scripts.
2
votes
2answers
81 views

How to list available space excluding mount points in home directories?

I ran df -lP which gave me the following output: Filesystem Size Used Avail Use% Mounted on /dev/sda1 7.6G 2.2G 5.1G 30% / varrun 506M 108K 506M 1% ...
3
votes
1answer
135 views

Custom command to open VLC with some options

I am trying to create a script to run vlc to play (or queue if a playlist is already present) some videos. so far in my ~/bin/ folder I have created a file ``myvlc'' with the following command: ...
3
votes
1answer
59 views

Bash - Get Sudoer Username?

Say I have the following bash script: #!/bin/bash echo $( whoami ) This is what it outputs with and without sudo: alix@netbook:~$ ./test.sh alix alix@netbook:~$ sudo ./test.sh root The script ...
2
votes
1answer
211 views

Run program from a shell script but behave as one process only?

Is there a way I can execute an application from a shell script but not create another process. I want it to look like one process only. It doesn't matter whether my shell script is replaced by a new ...
0
votes
1answer
121 views

What is the best way to add some configuration to bashrc?

I'm currently trying to configure a server using Precise Pangolin and Vagrant (a software allowing me to provision a number of software when booting my VM). My current question is a pure bash one. ...
1
vote
0answers
65 views

Create DSL connection using Bash Script and connect using the same

I have been using ubuntu live OS everyday as my internal hard drive has gone for replacement. On every boot up i need to create a DSL connection to connect to the internet which is a mundane task. I ...
14
votes
1answer
237 views

Why use env in shebang?

What is the purpose of using #!/usr/bin/env <sh|bash|python> shebang compared to #!/bin/bash, #!/bin/sh or #!/usr/bin/python?
1
vote
2answers
628 views

Init.d startup script not working for No-IP

I have just installed No-IP on a brand new Ubuntu 12.04 install. The program starts fine when I start it from the CLI, but if I try to make this startup script work it won't start. I got this script ...
1
vote
1answer
111 views

How to force quit out of an infinite loop in a bash script gracefully

I wrote a bash script that logs keycodes in a simple file. I have put the code in a while loop because I want it to log continuosly. But if I run the bash script in the terminal, the cursor just keeps ...
4
votes
1answer
86 views

What does $$ mean in the shell?

What does the output of the command below mean? (result is positive integer) echo $$
0
votes
1answer
81 views

How can I execute scripts as root without pointing to its location?

I tend to use sudo arp-scan --localnet --interface wlan0 a lot, but I find it cumbersome to type this each time. To speed things up, I've created a script, called arp-lw-scan, which should do this for ...
-3
votes
1answer
75 views

bat file to batch? [closed]

hello i would like to know if its possible to turn this batch file into a working basfile for ubuntu, im completely new to all this. It works on a windows machine but it does not work on ubuntu. I ...
6
votes
0answers
118 views

command prompt suddenly starts with (base) [closed]

For seemingly no reason today my command prompt added (base) as a prefix. I didn't change the shell or anything else. Neither the .bashrc or /etc/bash.bashrc files have (base) anywhere. The command ...

1 2 3 4 5 22