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

learn more… | top users | synonyms (1)

47
votes
6answers
15k views

What to do when Ctrl-C won't kill running job?

Sometimes, processes ignore the SIGINT signal sent by Ctrl-C in Bash. For instance, man and vi. Assuming you don't want to google or read the manual on how to exit the running process, is there any ...
3
votes
2answers
2k views

History | grep “keyword2find” does not gives unlimited history

The command history | grep "keyword2find" does not gives unlimited history that i typed in the terminal onwards i installed ubuntu. I want to see all of them without a time span.
6
votes
5answers
21k views

Add a string to a text file from terminal

I would like to modify a bunch of text files from the terminal, more precisey: add the string '50' to the first line of every text file in /mydat/ ? Alternatively, if you know of a link to a page on ...
5
votes
3answers
576 views

How can I find the binary that is executed when entering a command?

I just have installed TeX-Live 2012, but I still get moose@pc07:~$ latex --version pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009/Debian) kpathsea version 5.0.0 Copyright 2009 Peter Breitenlohner ...
1
vote
1answer
80 views

How to identify an application executable from ps

If I execute ps -ef | grep java I get the following noaccess 12144 908 0 Apr 28 ? 697:47 /usr/java/bin/java -server -Xmx128m -XX:+UseParallelGC -XX:ParallelGCThreads=4 Though, in ...
7
votes
1answer
6k views

Link to directory in bash

I'm using the ln command to create a symbolic link to a directory using bash, I went to the directory I wanted to make a link and used the following command: ln -s C#/ ~/Projetos This would create ...
5
votes
4answers
28k views

How to get the hostname using terminal command-line?

I have used arp-scan in terminal to get the ipaddress as well as mac address, is there anyway i can get to know the hostname of the ipaddress that are there in the terminal? for example there are A-pc ...
6
votes
2answers
2k views

How do I get the bash debugger to work with ddd?

ddd script.bsh does not open the script. It shows an our glass and if I want to close ddd, it says "bash is busy"... I found an old message, but it didn't help. ...
3
votes
2answers
129 views

Bash script error in my computer but NOT on some others

the script: waktu=$(date +"%H") kelompok="E20" dir_skrg=$(pwd) if (( $waktu >= 5 && $waktu <= 10 )) then salam="pagi" elif (( $waktu >= 10 && $waktu <= 3 )) then ...
2
votes
1answer
348 views

cp file in many subdirectories with *

I want to copy a file "test.sh" in directories which have all a subdirectory 2_bas (ex. prod1/2_bas, prod2/2_bas, etc...) I tried: cp test */2_bas/ but I get the error message: cp: omitting ...
2
votes
1answer
580 views

Setting the PATH in .profile works without exporting it, how?

the default .profile does not export PATH, still the PATH set there is available to all processes. How does that work?
6
votes
1answer
3k views

How to use /dev/(u)random

How can I use /dev/(u)random on Ubuntu or any *nix sistems ? I searched at google but I can't find how to :( I tried this but it says permission denied. Note : I also tried as root. /dev/(u)random ...
2
votes
2answers
901 views

enable auto-completion of apt-get for non-privileged user?

I've enabled apt-get in SUDO without password , and bash autocompletion for it need to be enabled as well , but how ? If i try to source that file: %> . /etc/bash_completion.d/apt No command ...
6
votes
1answer
1k views

How do I log into bash shell only?

On my home desktop I want to use Ubuntu Unity sometimes and just the bash shell (without any GUI) other times. Is it possible to set up a login option where I can choose between using the Unity GUI ...
5
votes
1answer
342 views

My bash function runs only once per terminal opened

When I try to run my bash function, defined in .bashrc, for a second time in the same terminal, it doesn't work. The code is the following: function nos (){ local option while getopts cs ...
12
votes
5answers
15k views

difference between bash.bashrc and /etc/environment file

Till data I was used to set my environment variables in the bash.bashrc file. Recently I told to use the /etc/environment file. Well, both work fine. So, what is the difference between them? I ...
3
votes
2answers
8k views

Bash Tab Auto-complete not working for apt

apt-get install and apt-cache policy do not complete package names. I have double checked /etc/bash.bashrc, no irregularities. Googled for answers but none suffice. Any help/advice?
0
votes
1answer
8k views

Why I am getting Can't open /etc/rc.d/init.d/functions error?

I got bash script from internet for for Running the Clamav Antivirus in Demon mode. But am getting the below error. Can't open /etc/rc.d/init.d/functions I checked /etc/rc.d/init.d/ directory there ...
2
votes
1answer
71 views

How can I prevent programs from running reboot scripts or “reload your computer scripts from start up”?

I would like to prevent any program within my PC from running modified scripts without super user authorization, such as instruction on rebooting my pc from start up to forcing through software ...
0
votes
1answer
247 views

Bash Script help required

I am trying to get this bash script that i found on a forum to work. Copied it to text editor. Saved it as script.sh chmod 700 and tried to run it. rootdir="/usr/share/malware" day=`date +%Y%m%d` ...
1
vote
1answer
62 views

Tell user to reload his pc in script

I need to send a message to a user,that he needs to reload his pc, and i need to do it like some programms do (showing the red power button in the rigth top part of the screen "Reload your computer" ...
1
vote
3answers
347 views

how to check if stream is empty?

For example I want to execute : ps x | grep something | grep -v grep | somecommand I want to execute somecommand only if there is something running. How to do that ?
0
votes
1answer
59 views

What does ENDOFMENU do? [closed]

I have been given an example program, I am wondering what exactly the <<ENDOFMENU and ENDOFMENU does, won't it work the same if you leave it out and just use the while loop? #!/bin/sh echo ...
2
votes
1answer
389 views

Printing Checks from CLI or GUI

Looking for a program or a way to print onto my bank checks in Ubuntu. I don't want to use GNUCash or KMyMoney as those are bank register program's and it's too much work to open one of those each and ...
3
votes
3answers
2k views

regex on the shell?

I wanted to do some simple regex so i am trying to get the 16. I tried grep but i dont see how to write \1 or $1 to only output the capture data and i tried sed but i think i did it wrong due to ...
0
votes
1answer
2k views

What is this PS1 variable doing in .bash_profile file?

Currently my terminal prompt looks like: blankman-MacBook-Pro:~ $ My .bash_profile has: export PS1="\[\033[36m\]\h:\W \[\033[33m\]\$(parse_git_branch)\[\033[00m\]\$(git config ...
1
vote
1answer
364 views

apt-get install - how to get report about failed installs?

I've created my script to install software on a new computer. Basically it includes lot's of apt get install <pkg name> -y lines. How can I get a short report about installs that has failed? ...
5
votes
2answers
2k views

How to diff two folders to multiple patch files

I'm not much of a unix guy so I'll just go ahead and ask: I have a following problem - two folders with plenty of subfolders. I need to diff them. I tried this: diff -drupN vanila_kernel_3.0.8 ...
2
votes
4answers
581 views

Why is the following bash command not working properly?

I have the following bash command: $(ls -l /var/ | grep www) > cat folder_exists but it is not working properly. What I hope to achieve is a command, that checks to see if there is a www folder ...
0
votes
2answers
2k views

Autojump in 12.04 doesn't work

https://launchpad.net/ubuntu/+source/autojump I installed with apt-get, checked out the man page and added . /usr/share/autojump/autojump.sh to my .bashrc, like it says. When I cd around the ...
1
vote
1answer
573 views

How to fetch a image from online(http) and make it as a wallpaper using Ubuntu terminal

I need to change the background of my desktop in Ubuntu 12. 04 with a command in terminal, in order to make a script with bash. Does anyone know how to do it? but i want the image from internet... i ...
1
vote
2answers
302 views

Simultaneous commands

I'm trying to get bash to execute two commands simultaneously. I've read a little about job control, &, bg, fg, but the problem is that the command I want to run doesn't run properly in the bg. ...
22
votes
3answers
34k views

Why does “ps aux | grep x” give better results than “pgrep x”?

I've just tried the following command on my Ubuntu, it doesn't show a thing: pgrep php5 shouldn't it return the process id of php5(which the following command just does)?: ps aux | grep php5 So, ...
0
votes
2answers
961 views

Running gedit in background

So I've got this working in a 10.04 ubuntu OS in bash where I can run: $ gedit app/file.rb bash opens that file with gedit but it is tied up. How can I make my earlier command equivalent to $ ...
4
votes
2answers
1k views

How to go back to previous line of a script in terminal?

I am trying to write a script but I'm stuck here. See the code please! aug@august:~/play$ for i in {1..100..4} > do > echo "august" > touch august $i+$2 > mkdir dir Is there any way to ...
26
votes
4answers
9k views

What is the purpose of the -9 option in the kill command?

Is there a difference between kill -9 212121 and kill 212121
8
votes
2answers
284 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 ...
1
vote
1answer
177 views

can't control pianobar after using echo

I have a script that starts pianobar (pandora player) and autoloads into tty2 after booting. I'm running Ubuntu Precise 12.04. it's a pretty simple script: #!bin/bash sleep 5 echo "2" | ...
5
votes
2answers
1k views

Source or dot operator overriding execute permission?

If I have turned off execute permissions on hello.sh and try to execute it ~$ sudo chmod 0666 hello.sh ~$ ./hello.sh -bash: ./hello.sh: Permission denied I get the permission error. But I can ...
2
votes
2answers
922 views

Why wont my pipeline work?

I am trying to make a bash script that will find all the mp3s in my Downloads folder and move them into a music folder. Why won't this line work? find ./ -type f -name \*.mp3 | mv *.mp3 ...
2
votes
2answers
1k views

Bash: command not found

I have a script that needs to know the processor architecture. I'm doing this way: if [["$(uname -m)" = "x86_64"]]; then wget ...
5
votes
2answers
7k views

Writing scripts with arguments?

I want to write shell script that takes an argument, and then applies it to files. Specifically, I want to give a term, and then have it compile term.as with mxmlc ("mxmlc term.as"), then run ...
0
votes
2answers
298 views

When should you push variables in quotes in boolean conditions? [closed]

Are the following two boolean expressions the same? if [ -n $1 ] ; then if [ -n "$1" ] ; then If not - When should you put a variable in quotes?
5
votes
4answers
968 views

Reuse last line on terminal

When one issues a command that does not exist in the terminal, it results in: The program 'programname' is not installed. You can install it by typing: sudo apt-get install programname Is there ...
0
votes
1answer
103 views

Where I'm making the mistake in here document?

I read the use of here document. I tried something like this: echo $* <<End anto End What I'm trying here is, when I run this script rather than taking input from command line, I'm asking ...
4
votes
2answers
705 views

Unable to set background image using python (2.7.3), bash and gnome3

#!/usr/bin/env python import os bashCommand = "gsettings set org.gnome.desktop.background picture-uri file:///home/malon/autowallpaperchanger/" + pic_name print bashCommand os.system(bashCommand) ...
7
votes
5answers
898 views

How are the programs in /bin directory compiled into a non-readable format?

I've noticed that most of my commands/programs in the /bin directory are compiled. I wish to duplicate this non-readable code format myself. Can someone tell me why and/or how these programs get this ...
1
vote
1answer
644 views

Bash script: Program with parameters as a single variable: command not found

I wrote the bash script below (called hdmi_output) and it's working in most parts as I expect it. For example, I run hdmi_output run firefox and Firefox is started on the external monitor. But ...
1
vote
1answer
1k views

Print specific dates in a specific format

I would like to write a bash script that prints out the date in the following format: 20120205_16 (year)(month)(day)_(24 hour) so the command to do this for the current date is: date ...
20
votes
2answers
5k views

How does this [t]ricky bracket expression in grep work?

I saw this one-liner recently: $ ps -ef | grep [f]irefox thorsen 16730 1 1 Jun19 ? 00:27:27 /usr/lib/firefox/firefox ... So it seems to return the list of processes with "firefox" ...