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

learn more… | top users | synonyms (1)

1
vote
1answer
37 views

Why does the more command not work when bound to a keyboard shortcut?

I have two commands that both work in terminal: notify-send "$(more /home/tim/autest.sh | head -1)" and notify-send "$(cat /home/tim/autest.sh | head -1)" putting them in a script like this: #! ...
1
vote
1answer
32 views

My keyboard shortcut binding does not work with my script

I was trying to bind a keyboard shortcut to my script. I tried binding it to keyboard shortcut from System Settings>Keyboard>Shortcuts>Add Shortcut I added new shortcut and as mentioned in ...
0
votes
1answer
131 views

Trouble with pip on 14.04

I am trying to install a few different things and having issues. I thought pip could have been the issue on one of the packages I was trying to install. So I decided to try to upgrade pip, following ...
4
votes
1answer
204 views

gnome-terminal can't set 256 color support correctly with or without tmux

I've been trying to set up 256 color support correctly for quite some time but it seems to never work for me so I'm not even remotely sure what I'm doing wrong. How it looks in the terminal vs gVIM: ...
29
votes
3answers
2k views

“mv file” and now it's missing

In a terminal window, I typed: mv filename ..\.. [Note the wrong slash.] Now I can't find it. Gone. I ran some searches and looked through recoverable deleted files. Nothing. Poof. Serves me ...
1
vote
3answers
170 views

What is the syntax for IF/ELSE in bash?

I am trying to pull logs and doing few others things directly. written a small line BASH but not working. I am sure thats with IF Condition. sed -rne '/21:25:07/,/21:50:07/ p' ...
4
votes
3answers
227 views

How to use double substitution in awk?

To print the fields at 29th column in two files I used paste <(awk -F, '{print $29}' PreRefFile.csv) <(awk -F, '{print $29}' Txlog.csv) This worked fine. To print all the fields starting from ...
7
votes
2answers
189 views

Differences between “<command> & disown” and “nohup <command> & disown”

This is my understanding about the usage of &, disown and nohup: <command>: runs the process within the Terminal's current bash instance, in the foreground (i.e. the process is listed as a ...
1
vote
3answers
60 views

Get Parent ID of last process executed in terminal

back to this How do I find the PID of the last open file in terminal? I want to know the PPID (parent id of the process) of the last executed process.
0
votes
1answer
48 views

How do I find the PID of the last open file in terminal?

How to know the PID of the last open file (process) using the command line?
8
votes
7answers
1k views

Exit terminal after running a bash script

I am trying to write a bash script to open certain files (mostly pdf files) using the gnome-open command. I also want the terminal to exit once it opens the pdf file. I have tried adding exit to the ...
7
votes
1answer
197 views

How to log bash history by editing bash source?

I'm using bash-4.3.30. I need to log all my commands history on a single file. I can do that by editing the bashrc or bash_profile but I'm not going to do that. I want to play with bash source ...
7
votes
3answers
160 views

How to check the password entered is a valid password for this user?

The scenario: In a bash script, I have to check if a password given by a user is a valid user password. I.e suppose I have a user A with password PA.. In the script I asked user A to enter his ...
0
votes
0answers
32 views

After changing Ubuntu 9 version to ubuntu 12.04.If i run my code i get core dumped segmentation fault

After upgrading from Ubuntu 9 to ubuntu 12.04, when I run my my shell (below) I get a: core dumped segmentation fault This code used to work before. My C-based applications still work. #! ...
0
votes
3answers
97 views

Problem when trying to run shell script : No such file or directory

I'm trying to run the following command on bash: ./home/abcdef/Desktop/jikesrvm/dist/prototype_x86_64-linux/rvm which is giving me a bash: ...
3
votes
1answer
205 views

How do I use the “^” and “$” symbols with regular expressions in a bash script?

How do I use the "^" and "$" symbols with regular expressions in a bash script? Please give me an example using both symbols.
0
votes
1answer
73 views

.bashrc edit messes up terminal command arrow-up history print

I wanted to give my terminal prompt in Ubuntu a more personal look, and wanted to change the text prior to the '$' when writing a command. From what I've found this is done by editing the .bashrc ...
8
votes
3answers
132 views

How to run a script when a directory is changed by another user?

I know has been a bit of discussion about topics similar to this. But here is what I am basically trying to do. I have a watch directory called watched and whenever a file is added to that directory, ...
1
vote
1answer
26 views

bash file for managing public private and history of website

I have a website and i have 3 versions I have the beta version with the most recent and usually not fully working changes. I have the public site that is on www. lastly, i have the history that I ...
0
votes
1answer
85 views

Unable to run apt-get with proxy even after setting the environment variables

I was trying to configure proxy in my lubuntu 14.04. Since I wanted to use the username and password for my proxy authentication, I opted ntlm and installed it. Now I can use my proxy link as ...
0
votes
1answer
19 views

having elevated priority and general @audio permssion in rc.local

I am trying to run jackd instance from /etc/rc.local (along with a few other applications) from a custom made init script. The system is ubuntustudio and I have setup everything to have elevated ...
6
votes
1answer
158 views

What do these commands from a shell script do?

I'm just starting to learn bash. I have the following script, and I would like to know what does the following commands do in order to start to understand a little bit this world. if [ ! -w "." ] ...
-1
votes
1answer
185 views

How to create logfile for a bash script?

I've written a bash script that runs multiple instances of a program and would like to write the entire output of the script to a logfile. I tried #!/bin/bash touch <.../somewhere/logfile.log> ...
4
votes
1answer
154 views

Writing a program that will demo the $PS2 variable

I've been customizing my terminal prompt, and found that it's possible to change the "secondary prompt". However, I have no way to test the changes I make to this one so I was wondering if a simple ...
1
vote
2answers
94 views

Running a command in screen daemon mode

I am trying to run a command in screen mode using the command screen -dmS screen_name sed -i 's/a/b/'g some-file.txt Nothing happens. When I put the same command in a script and run the command: ...
1
vote
2answers
52 views

Rsync --delete option doesn't delete files in target directory

I'm trying to use the --delete option in rsync to delete files in the target directory which isn't present in the original directory Here is the command I'm using: rsync -avz --ignore-existing ...
5
votes
4answers
424 views

Get previous commands in Terminal that match the currently typed command [duplicate]

In some terminals you can do something like this... Type some command nmap -sn 192.168.1.1/24 Then go on to do other things in the terminal for a while. Then later you can type nmap and then ...
1
vote
1answer
45 views

Different shells on SSH and local

So I've got an Ubuntu 14.04.2 computer that has OpenSSH Server installed on it. Whenever I use the computer locally, through the terminal, if I run: ~$ echo $SHELL /bin/bash However, if I SSH into ...
1
vote
3answers
56 views

What does this egrep command do?

I run this command egrep "\" string_demo | wc -l I got output below: akshay@akshay-K53SC:~/shell$ egrep "\" string_demo | wc -l > abc > pqr > xyz > ">" will continue until I press ...
0
votes
0answers
13 views

purpose of bamf-2.index [duplicate]

What is the purpose of /usr/share/applications/bamf-2.index ? I have noticed the applications it contains are installed in my computer. But I don't think it contains the complete list. Because the ...
0
votes
2answers
126 views

Enforce a shell script to execute a specific python version

Update. Changing the alias unfortunately does not work. I have changed the alias to alias python='/usr/bin/python2.7' however the shell script still runs the python script in 2.4.3. Muru - I am ...
1
vote
1answer
240 views

Customize Colors for Bash Terminal

I found this nice color library called Solarize which promises to liven up my hacking experience with a color terminal. I am not where to add the Solarize files to change. I found some ...
2
votes
3answers
176 views

Error when running script in bash

I wrote a script in bash to basically create aliases, but for any reason, it doesn't work in some cases. Here it's the code: #!/bin/bash #Script to create unique and permanent aliases _add_alias() { ...
1
vote
1answer
65 views

How to remove all lines in a file containing a string from another file

I want to remove all lines in a file containing a string from another file. So I don't want to remove the lines which are identical, there are none, but remove all lines if they share a string from ...
5
votes
3answers
283 views

Count down script is not working

I am trying to create a script that will count down to 0 from what ever number I give it. Below is my script and basically nothing happens, no error message, I merely get the standard command line ...
1
vote
0answers
34 views

speech-dispatcher always stop working after terminal exit?

In a previous question I made this line: trap 'clear; ~/ascii3.sh; spd-say "Exit"; sleep 2' EXIT The content of ascii3.sh is: echo -e "\033[01;31m" echo " _ _ __ _ _ ____ __ __ _ ...
-1
votes
1answer
35 views

How to stop renaming a file which was already renamed using loop in shell script

I have a directory name dir1 containing another directories named 1,2,3,4,5. Now I want to rename directory 1 with 4, 2 => 5, 3 => 6, 4 => 5. but my problem is using mv command in shell script ...
1
vote
1answer
27 views

heredoc variables between underscores

Say I have something like this, tee filename <<EOF ... access_log /srv/users/serverpilot/log/$APP_NAME/$APP_NAME_nginx.access.log main; ... EOF where $APP_NAME is a variable. Bash ...
2
votes
1answer
64 views

sed to execute a command as replacement with substitution pattern as argument

I am trying to replace time in a log file by: cat mlog.log | sed -e "s/^[0-9\.]*/\$(date -d @&)/" Why it always first execute $(date -d $&) but not doing replacement at first and then ...
1
vote
1answer
100 views

USB mouse on Ubuntu stops working [duplicate]

Many times my mouse USB suddenly stops working, though the trackpad works just fine. I have to click it to make it work again. I have found the following solution: sudo bash for i in ...
1
vote
0answers
64 views

Running a bash script on “Switch User”?

I've had my first dabble with bash and got a working script going for each user on session start which checks if a NAS share is mounted and if it is unmounts it and mounts as the current user. This ...
1
vote
3answers
69 views

Force “bad” (not 0) return code of terminal command?

I have a framework written in python, and for testing purposes I basically want to do a subprocess (aka shell call) ... that should simply come back with a RC != 0. I tried to invoke some non-existing ...
2
votes
3answers
178 views

How to run a bash script after 20 sec on Login?

I want to run a bash script like: #!/bin/bash echo 'cpu limit bomi player at 40%' cpulimit -v -e bomi -l 40 Just 20 seconds after Login into my user. Can you please help me to do that? ...
2
votes
2answers
64 views

Timing limiter for execution of commands in Bash/Shell Script

I have a shell script which looks like this: echo firstOutput read -s command0 command1a command1b command1c echo secondOutput command2 command1a, command1b, command1c are individual commands but ...
0
votes
1answer
32 views

Create an alias for a directory while working in virtual environment

I've checked this. But right now I'm working in a virtual env. cam@cam:~$ cd Desktop/django-user3 cam@cam:~/Desktop/django-user3$ source newenv/bin/activate (newenv)cam@cam:~/Desktop/django-user3$ ...
13
votes
1answer
668 views

opposite of eject command?

I have a ton of CDs to image, and I just got curious. I can eject with the eject command. What command inserts the disk tray back into the CD drive? yes it is the type that can pull the tray back in. ...
4
votes
3answers
296 views

improve bash script

I have a quad core desktop, and i wanted to know the average temprature according to sensors. so i wrote this bash 1 liner. echo `sensors -A | awk {'print $3'} | sed 's/+\|(crit\|0:\|°C//g'` | awk ...
-2
votes
4answers
72 views

Why am I getting a syntax error in this script?

When running the script below, I get an error: The script is: clear echo "Enter a num" read num if [ "$num" -ge 0]; then f=1 i=1 while [ $i -le "$num" ]; do f=`expr $f \* $i` ...
7
votes
3answers
360 views

How do I search shell command history with a text editor?

I know that Ctrl+R let's you search command history, but it's a little primitive. Is there a way to export all my command history (not just the current terminal session, but the full history) to a ...
2
votes
1answer
119 views

I see one backslash, but there are actually two backslashes!

Does anyone can help me to understand that weird issue? I was trying to rename a very long list of folders. I went to the parent directory and listed all the folders to rename in a text file: find ...