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

learn more… | top users | synonyms (1)

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
23k 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 ? ...
0
votes
3answers
187 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
216 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
1
vote
1answer
146 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
231 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 ...
1
vote
1answer
106 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 ...
0
votes
1answer
3k 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
53 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 ...
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 ...
2
votes
1answer
830 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
1answer
383 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 ...
1
vote
2answers
532 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
votes
1answer
614 views

bash script does not work

I am trying to run a bash script that does the following: The following bash script will populate Keystone with some initial data: Projects: admin and services Roles: admin, Member ...
19
votes
6answers
27k views

Shell script to -9 kill based on name

Is there a way (perhaps a script) how to automate this process: petr@sova:~$ ps -ef | grep middleman petr 18445 2312 1 12:06 pts/2 00:00:01 /home/petr/.rvm/gems/ruby-1.9.3-p362/bin/middleman ...
2
votes
2answers
690 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' ...
1
vote
2answers
444 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 ...
0
votes
1answer
195 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 ...
2
votes
5answers
995 views

How to grep whole manual?

I can do for example man cp | grep verbose to findout if cp man has word "verbose", how can I do something like (pseudo-code) man * | grep copy to find out what command to use for coping?
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. ...
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 ...
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 ...
1
vote
1answer
977 views

Shell not handling escape character spaces

Recently it seems that shell has changed how it handles spaces in parameters. It used to handle them properly (Or at least as I intended it to), but now it recognises it as a bunch of different ...
0
votes
1answer
375 views

Can't seem to get script/cron job to work?

ive written a ffmpeg script to mass convert mkv into mp4. when i run the script as my user, and enter my password for sudo privileges it works very well from the command line. the script is: #! ...
0
votes
1answer
512 views

Installing IRAF problem

I've installed iraf v216 on my desktop computer without any difficulties but installing it on laptop(HP pavilion g6) is giving me a lots of trouble. I can't solve this particular problem, and I don't ...
0
votes
2answers
849 views

open bash terminal in a specific directory

How can I config bash - I'm using Gnome Terminal - to open the shell into a specific directory? I know I can insert a cd /directory into .bashrc, but that isn't good enough because if I use Open ...
2
votes
1answer
360 views

Automatically cd into directories?

In the terminal You use cd ../../........ to get to wherever you want, But I am lazy, I am wondering if it is possible to automatically cd into the directories if the command is simply the directory. ...
0
votes
1answer
56 views

How do I change the location in the terminal with a custom string?

If I have a really long path to a folder, and I just want the string 'longlocation' to replace it in the terminal, I know I can edit the .bashrc file and add this command: alias changelc='export ...
1
vote
1answer
156 views

Bash is printing (only) one of my aliases before every prompt

I think this is the relevant bit of my ~/.bashrc file: # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors ...
4
votes
1answer
2k views

LXTerminal and XTerm Resize Command

I want to execute a command in a bash script that will resize the terminal window. In xterm xterm -geometry=30x30 will create a new xterm window, and lxterminal --geometry=30x30 will create a new ...
5
votes
3answers
9k views

Move running program to background in bash

If I'm running a program in bash, I can suspend it by pressing Ctrl+Z. If I want to leave the program running, I can then use the bg command. Is there some way to directly put the program in the ...
3
votes
3answers
5k views

How to find text and replace that line if exists with terminal otherwise just append line to end

I want to put in sudo gedit /etc/sysctl.conf the one line vm.swappiness=10 which I sometimes change. By default this line doesnt exist so I use echo "vm.swappiness=10" | sudo tee -a /etc/sysctl.conf. ...
0
votes
1answer
190 views

Can't login to GUI, only to tty1-6, /bin is not included in the PATH environment

I was trying to make the brightness controls work after I had made a clean reinstall of Ubuntu 12.04 on my Gateway computer, based on this thread, and proceeded to restart because I also had a few ...
15
votes
2answers
32k views

How Do I fetch only the numbers in grep?

I have file like this : other lines . . . blah blah blah (:34) I wish to find the occurrence of numbers in the above file. I came up with : grep [0-9] filename But that is printing the ...
1
vote
1answer
1k views

When $SHELL variable does not change when I switch shell

I am using 'zsh' by default. But when I am in my zsh shell, I enter 'bash' to switch to bash, why the $SHELL variable does not change? Can I make screen to use whatever shell I right before execute ...
1
vote
1answer
946 views

how to export bash arrays? any workaround tips?

I am using the bash version 4.2.37 at ubuntu 12.10. But since ubuntu 12.04 I am unable to export arrays in bash... This is an example (type these lines in the command line, it is not a script): ...
4
votes
1answer
778 views

Rsync behavior in a cron script

I have an nfs device that creates checkpoint (backups) everyday. I want to use Rsync to copy these checkpoints to another device (Drobo connected via iSCSI). So I've run the script on a single nfs ...
2
votes
2answers
2k views

No duplicated lines in bash history [duplicate]

Supposedly, adding export HISTCONTROL=ignoreboth to .bashrc would do the trick, but what I see in practice is there still exists duplicated lines in my .bash_history file. You can see my .bashrc ...
9
votes
2answers
3k views

How can my script determine whether it's being run by bash or dash?

I'm running a fresh Oneiric install (i.e. not an upgrade) on two different systems and running into the same set of seemingly related problems. The most frustrating of the bunch is that, when I use ...
0
votes
1answer
481 views

How to build libHaru and the examples which are included

I downloaded libHaru from http://libharu.org/. libHaru is a opensource pdf creator. Now in the INSTALL file says I only have to run ./configure && make && make install. When I run this ...
0
votes
2answers
5k views

/usr/bin/env: bash: Permission denied

Suddenly, when your Seniors Linux Server admin does not come at office. And Then Junior Linux Admin take a charge of it, then it is NIGHTMARE for them. Please help. I'm not able to recollect, that ...
1
vote
1answer
248 views

bash substring syntax as a means of disambiguating environment variable identifiers

When bashing, I know that double quoting is sometimes necessary if an environment variable (EV) contains embedded spaces. Example: "$JACK" rather than $JACK. Sometimes it is recommended to use the ...
2
votes
1answer
516 views

Change Gsetting with script on Logout

System : Ubuntu Raring Ringtail (13.04) from fresh installation. Purpose : Main : Change gsetting (desktop wallpaper) with script on user logout. What's I've Done : (carefully read) I try to stop ...
1
vote
2answers
392 views

kdialog --password used with sudo?

I am using kdialog for a small Utility in making, Now i run into this promblem. There is one or more commbined functions that take sudo 3 or 4 times in a row. So its really annoying to have to enter ...
2
votes
3answers
10k views

if condition on multiple lines in bash shell

I have a bash shell function that takes an argument and perform something on it if needed. do_somthing() { if [need to do something on $1] then do it return 0 else return 1 fi } ...
0
votes
1answer
84 views

bash permissions

My friend was trying to tighten up security on his ubuntu server and changed the permissions on bash. He logged out, and now the computer won't let him log back in. The server is an off-site server ...
1
vote
1answer
177 views

How to use readline to insert a predetermined string onto the command line with a shortcut when using Bash?

Is it possible to have an arbitrary amount of text placed next to the cursor on the command-line? I have heard that it is possible using Bash, but I am not sure how to accomplish it. It seems to be ...
0
votes
1answer
217 views

How to fake Ubuntu version number to applications

I'm trying to install Intel C++ compiler on Ubuntu 13.04, but the installation script says that only Ubuntu 12.10 and below are supported, and there is no option to force installation. So is there any ...