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

learn more… | top users | synonyms (1)

4
votes
2answers
1k views

How can i make the PC make a 'beep' sound when network cable is unplugged?

How can i make beep sound in the PC when the network cable is unplugged or no network available to any specific interface such as eth0 or eth1? Follow up: $ sudo apt-get install beep $ cat ...
2
votes
3answers
2k views

can I redirect file as input to notify-send?

I want to use command notify-send and display text from a file as a notification so that I can only edit that file to change command or forward contents from outputs of other programs to notify-send. ...
1
vote
1answer
1k views

How can I capture text from a specific terminal and redirect it to a log file while simultaneously working? [duplicate]

I viewed this question to redirect text to file while displaying the output. My question is how can I redirect it while working AND without constant | tee command. My plan is to use this question to ...
3
votes
4answers
861 views

How to xkill an application by its id?

I need to simulate the behavior of the keyboard shortcut (ALT+F4) using Terminal for a given application. If I open for example gedit and click ALT + F4 , then GEDIT will be xkilled. If I want to ...
2
votes
1answer
285 views

Run Bash script before every print job

I'm using refilled printer cartridges that don't show ink levels, so I made a bash script that keeps count of printed pages (from CUPS log) and shows a warning when it reaches about 200 pages (known ...
1
vote
2answers
144 views

download file from web source, selectively

If anyone has heard of Bukkit, you know that their files are usually of three types: Development, Beta, and Realease. Click (here) for examples. I need a script that: Loops through the directory ...
0
votes
1answer
412 views

How to check for missing files in filesystem or directory with bash (after crash)?

After the system unmounted the root partition, I detected that some files are missing in the filesystem. wifi and the gwibber icons disappeared from the indicator applet I am trying to check if ...
3
votes
4answers
6k views

bash profile works for user but not sudo

I've modified my .profile to include a folder if a flash drive is plugged in. When running the command as the user it works fine but tells me the scrip must be run by sudo (this is what i want). ...
1
vote
1answer
142 views

Unity Icon for a bash ran program

So I downloaded the .tar.gz for eclipse, extracted and set it up. I created a .desktop file so I could dock it in unity. I then want to be able to have a bash script open the program from the ...
31
votes
9answers
94k views

How to move multiple files at once to a specific destination directory?

I got a bunch of files in some directory (along with many other files) that I want to move. Luckily, all the files I want to move contain a certain identifier in their names, so I can ls | grep ...
0
votes
2answers
702 views

How to delete older files using a bash script?

How to find and delete older files (older than 7 days) in a folder using a bash script? It's a folder in a server which contain automatic backups. Need to delete old ones automatically so there's ...
7
votes
2answers
3k views

Setting Default Byobu screens

I've just installed Quantal as a fresh install, and want to set up Byobu as it was on my old system. In a previous version of byobu there was an option in byobu-config (via the F9 key) to create new ...
3
votes
3answers
3k views

Cannot use “./” to execute a shell script

Maybe someone here would be able to help me out. Have installed Ubuntu 12.04 LTS (kubuntu) on two machines. The .bashrc and .bash_profile files are identical as the file structures on each machine is ...
1
vote
1answer
2k views

Permission Denied Error when trying to reload ~/.bash_profile

Hello people I am trying to reload the "~/.bash_profile" but I get the "Permission Denied Error" and "sudo" does not work is there a way I can reload the "~/.bash_profile" because it's an integral ...
0
votes
0answers
134 views

/etc/bash.bashrc executed but not ~/.bashrc [duplicate]

The bash man page says: "When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, " I can see that bash.bashrc is executed ...
2
votes
2answers
775 views

How to reset bash keyboard shortcuts?

How can I reset the bash shell's Ctrl + C keyboard shortcut? I changed it a few months ago and can't seem to recover it.
1
vote
1answer
1k views

Get working directory of terminal, not the script

I have a script that i want to create files, depending on the directory the user (me) is in (it can be called from command line). However, it creates the file in the same directory the script is ...
4
votes
3answers
3k views

How to retrieve tweets from command line?

Is there a simple way to retrieve someone's tweets from the command line? The account would be public, and the command - or script, if necessary - would retrieve all or a specified number of most ...
4
votes
1answer
243 views

Adding new commands

I have added some new commands to ~/.bash_profile but every time I start a new terminal session, it seems to forget these commands and I have to do . ~/.bash_profile again. Is there a way to avoid ...
5
votes
1answer
337 views

Git autocomplete is asking for a password, not sure why

I'm running into an issue with autocomplete using git... I am using ubuntu 12.10 and when I perform the following keystrokes g i t Space Bar Tab I am presented with the error Pseudo-terminal ...
2
votes
1answer
4k views

What can cause my .profile file to not be loaded when a new terminal shell is initialized?

There are no errors in xsession and I don't have a .bash_login or .bash_profile file, so I'm 100% certain neither of those is loaded and thus cancels .profile loading. When I rename the .profile to ...
18
votes
5answers
13k views

auto-completion does not work for “sudo apt-get install”

Okay a college of mine just showed me that you could do sudo apt-get install <type first letters of package> <TAB> That it auto-completes the name of the package. Just for an example... ...
0
votes
4answers
3k views

Adding root privileges to a bash script

I am in need of adding root privileges to a bash script which uses sudo; so that whenever we run the script from the terminal; irrespective of the fact that the user is root or not it should not ...
1
vote
1answer
457 views

Bash Script Progress

I am forming a new question based on an earlier one I posted here in regards to a BASH Script I am writing. This is only one function of the script but I started here because I figured I would have ...
2
votes
2answers
1k views

cd command not working anymore

I just did two things : install scm_breeze and mercurial : git clone git://github.com/ndbroadbent/scm_breeze.git ~/.scm_breeze ~/.scm_breeze/install.sh sudo apt-get install mercurial And now my cd ...
1
vote
2answers
537 views

How to make the apt autocompletion work in minimal system (in LXC container)?

When I work inside thin LXC container on 12.04 I have only very basic system. In particular the /etc/bash_completion.d is missing the e.g. apt, that I find particularly useful. Is there any standard ...
2
votes
2answers
571 views

“too many arguments” checking a condition and execute some action in case it's not true?

I have edited my sudoers file to allow my non-root user to run sudo commands without being prompted for a password. In vim, how do I create a function that checks whether this condition is true, if ...
3
votes
1answer
462 views

Can I do filename pattern matching in a bash script?

Can I do filename pattern matching in a bash script? test is a directory with the following files ... bob@bob-laptop:~/test$ ls exclude exclude1 exclude2 include1 include2 From the ...
5
votes
2answers
1k views

How can I return to an application in the background?

I know that I can run an application in the background by putting an ampersand ('&') behind the command. For instance: user@ubuntu:~$ rtorrent & [1] 4618 starts rtorrent in the background. ...
3
votes
1answer
106 views

Get a list of file types that can be opened with a specific application

In Ubuntu, is there any way to obtain a list of file types that can be opened with a specific application? For example, I'd like to find a list of all files that can be opened with the program ...
11
votes
1answer
1k views

How can I automatically time commands in bash?

In tcsh, there's the variable time: The time shell variable can be set to execute the time builtin command after the completion of any process that takes more than a given number of CPU ...
8
votes
2answers
7k views

bash doesn't keep history

I run Ubuntu 12.04, and for some reason bash does not keep my command history. the ~/.bash_history file contains only 3 commands that I typed a few months ago. How can I fix this? EDIT: here's the ...
3
votes
1answer
326 views

Size/length limitations of bash scripts

I am wondering if there is any size, length or even run-time limitations with bash scripts. I am installing php-hiphop on debian squeeze(I know it's not ubuntu but I presumed there were some bash ...
36
votes
1answer
8k views

What's the difference between set, export and env and when should I use each?

Every so often I'll bash out a bash script and it strikes me there are a few ways of setting a variable: key=value env key=value export key=value When you're inside a script or a single command ...
0
votes
2answers
498 views

History list without timestamp and unique the results

Using bash, I save my history with the timestamp. How do print the history omitting the timestamp? alias h=history alias g=grep -i To find lines that I used for heroku, I type: > h | g ...
4
votes
1answer
292 views

why aren't my bash aliases applied when logging in to server

When I log in to my Ubuntu 12.04 LTS server my bash aliases aren't applied, but if I execute bash from the command line they are. ~/.profile executes ~/.bashrc: if [ "$BASH" ]; then if [ -f ...
3
votes
1answer
86 views

no features in bash in new vps?

I have 12.04 server minimal running on my VPS. When I ssh into the server, only $ is showing at the prompt for each prompt. There's no typical <directory> <username>$, no autocompletion ...
5
votes
2answers
8k views

How to write Bash script What is the command to open a terminal with two different tabed terminals and execute some commands separately tabs?

How to write Bash script to open a terminal with two tabs, and execute commands in both tabs? for instance: tab 1 opens skype tab 2 opens chromium-browser In the end, I want one more thing: write a ...
1
vote
3answers
446 views

Script to un-hide files with specific extention in folders reccursively

I have this folder that contains many folders, each containing many files with the name structure .XYZ.zip. I'd like to rename them (using bash) to XYZ.zip (i.e. un-hide them). I've seen a question ...
1
vote
2answers
4k views

Transmission shutdown script for multiple torrents?

I have written a shutdown script for transmission. Transmission calls the script after a torrent download finishes. The script runs perfectly on my machine (Ubuntu 11.04 & 12.04). #!/bin/bash ...
5
votes
3answers
10k views

Bash script to take screenshot and save the image - Ubuntu

I wrote a bash script as below: #!/bin/bash echo "Enter a file name" read filename import -window root $HOME/Desktop/$filename.png I expected this script to take a screen shot and save the image ...
2
votes
3answers
4k views

Best practices for using 'sudo su'

I have been using the terminal for a while now and sometimes (actually, a lot of times) I use a command, like: cp /etc/test ~/testFolder/ and I get this error: cp: cannot open `/etc/test` for ...
14
votes
2answers
4k views

How can a script detect a user's idle time?

I want to check, inside a bash script (*), how long the user of a X session has been idle. The user himself does not have to be using bash, but just X. If the user just moved the mouse, for example, ...
5
votes
3answers
3k views

Removing numbers and hyphens from file names recursively

I am modifying a simple BASH script to remove numbers and hyphens from the start of my MP3 files. The aim is to rename files such as: 11 Song 1.mp3 1-1-Song 2.mp3 11-1 Song 3.mp3 to: Song 1.mp3 ...
1
vote
2answers
746 views

Difference between sh file.sh and file.sh

I have two questions : What is the difference between executing sh filename.sh and filename.sh? How can I make both of them giving me the same output ? I'm asking this question as right now I'm ...
4
votes
3answers
174 views

How to move only a specific amount of images from a folder

I have a folder that has 200.000 images. I want to do the following: Move an X amount of images (50 images, 100 images, 200 images) from that folder to Y folder. Each Y folder can be a number ...
1
vote
1answer
1k views

Sudo Non-Password access to /sys/power/state

On my computer, pm-hibernate appears to be broken, however using the command echo disk > /sys/power/state appears to work perfectly. Now I just need regular user access to it, using sudo. How do I ...
1
vote
1answer
218 views

Wrong autocompletion with sudo apt-get

Does anybody know why if I type: apt-get upg<TAB> I get: apt-get upgrade but if I type: sudo apt-get upg<TAB> I get: sudo apt-get upgrade-from-grub-legacy
1
vote
2answers
1k views

Launching a Ruby Script from the bash does not work, even with the shebang

I am using Ubuntu 12.04 64 bits. I've recently installed the ruby1.9.1 package and the wx-ruby gem using : sudo gem install wxruby-ruby19 in order to install the ruby1.9 compatible version. So I ...
8
votes
3answers
17k views

error while loading shared libraries libSDL-1.2.so.0

I am trying to install ioquake on my ubuntu server. When I try to run it, I get this message: # ./ioquake3 ./ioquake3.x86_64: error while loading shared libraries: libSDL-1.2.so.0: cannot open ...