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

learn more… | top users | synonyms (1)

3
votes
2answers
300 views

How to run a bash .sh after starting a program in PlayOnLinux?

I have a little script that needs executing every time I open a wine program. The script is pretty simple: #!/bin/bash xdotool windowmove 67108871 1440 0 How do I get PlayOnLinux to run this script ...
2
votes
3answers
4k views

Minecraft server (Bukkit) .sh bash file not opening

My Minecraft server (Bukkit) .sh bash file is not opening! I did make it executable (in permissions, I clicked "anyone" for executable). Here's the code: #!/bin/bash cd "$( dirname "$0" )" java ...
0
votes
2answers
2k views

Inserting variable into sed command in bash script

I have text file similar to this: Some-text Keyword Some-text Some-text Keyword Some-text Keyword Keyword I want to replace every "Keyword" with "number.extension" where number is 1 at first ...
5
votes
3answers
3k views

How can I shorten the bash prompt's current path to one letter per directory?

I can't remember where, but I've already seen the bash prompt's current path shortened in an interesting way: every directory contained in the path (excepted the last one) is replaced by its first ...
0
votes
1answer
612 views

Bash command: ls -lah not showing /etc directory?

Ok guys, elementary question. I was poking around my server, and I noticed that when I 'ls' the / directory, /etc folder is not displayed. Why is that? I can very easily cd into it, but why is it ...
0
votes
1answer
517 views

bash script : is it possible to recognize video format from files (to batch extract audio from them)?

I have written a little bash script to extract audio from video files in batch mode. Sound is extracted from each mp4 file to flac format using avconv (and the flac codec). #!/bin/sh # # Batch ...
4
votes
4answers
39k views

Bash script not executing from crontab [duplicate]

I have the following bash script: #!/bin/bash mysqldump -u ******** -p******** --all-databases | gzip > /home/srvlinux01/MySQLBackups/database_$(date +\%Y-\%m-\%d).sql.gz which is located in ...
9
votes
2answers
382 views

Why does the sequence matter in the execution of these bash commands?

There seems to be some inconsistency that I am not able to understand regarding the bash shell. If I execute: ls;date;time the results of the three queries are shown in sequence. However, on ...
4
votes
2answers
2k views

How do I gvfs-mount without opening a file manager window?

I like to have my devices mounted in Nautilus/Nemo by default when I log in, so I can have symlinks to certain directories. And I don't mean a custom mount or a mount with 10 lines of cryptSetup and ...
1
vote
1answer
449 views

Configure Fail2Ban with bash script

I'm trying to configure the /etc/fail2ban/jail.local config with an bash script. I was thinking to use sed and regular expression to change the sections I need. sed -i "s/^bantime = 600/bantime = ...
0
votes
1answer
271 views

Just installed Ubuntu on my Nexus 10… how do I get to a bash terminal?

I just installed the Touch preview on my Nexus 10. It is not at all what I expected. I thought it would be just like my desktop; I'm not at all interested in the "experience"... all I want is a bash ...
4
votes
1answer
3k views

How to evaluate an arithmetic expression in an “if” statement?

This is my script: #!/bin/bash num=1 while [ $num -lt 100 ] do if [ $num % 3 -eq "0" ] then echo "fizz" elif [ $num % 5 -eq "0" ] then echo "buzz" elif [ $num % 3 -eq "0" ] && [ ...
2
votes
1answer
195 views

Delete lines starting with pattern from a file

I tried several commands: tr, sed but to no avail. Here's the file: > ... > ... > setEPS() > postscript('images/boxplot_default.eps') > ... > ... I want to delete those two ...
0
votes
1answer
98 views

Moving bytes from one files to another

I have an empty file (only zeroes are in it) of size 9,0KB and I need to write another file (with size 1,1KB) to it, but the first file must not lose it's. So if the whole file is 00000000000000... ...
10
votes
1answer
4k views

how to set icons and theme from terminal?

Is there a way to set active icon theme and GTK theme from a terminal? I would like to write a script that installs and sets everything up the way i like it on a fresh install.
4
votes
2answers
286 views

Is 1.abc!``!+123 a valid file name?

Is this a valid file name 1.abc!``!+123 in Ubuntu? I issued the command rm 1.abc!``!+123 and got error message -bash: !``!+123: event not find Why? How to I delete the file?
2
votes
2answers
4k views

Run a screen session on boot from rc.local

I am trying to run a detached screen under a specific user in rc.local on boot. The code below is what I have so far, but it is not working for me. The su part seems to be giving me an error. su - ...
1
vote
0answers
31 views

Bash Script to set “system wide” proxy settings [duplicate]

I am wondering if there is a command (or series of commands) that would do the same thing as network-network proxy-apply system wide. I believe I can export a variable, but I think that that button ...
6
votes
2answers
8k views

How to save terminal history manually?

It's my understanding that the history file is updated when the terminal exits. But sometimes my computer crashes out, and the terminal doesn't exit cleanly, and then I lose those commands from my ...
3
votes
1answer
161 views

Need to run a .bin file, but same error keeps coming up

I have a .bin file that needs to run. I'm trying to start it through the Terminal, and I keep getting an error that says: LSB 3.0 or higher not found I can't get to than internet at my school ...
2
votes
2answers
939 views

how to find exact file without listing folders

my current folder is the top of the folder tree structure somewhere inside I have an *.rpm file. how do I find that *.rpm file in a way that'll list only its full path when found and not list every ...
3
votes
2answers
7k views

Create zip of folder with same name

I want to create zip of a folder from command-line. I can do something like zip -r folder.zip folder. I want to give the zipped folder same name as the original folder. I can simulate this by writing ...
2
votes
2answers
632 views

create backup from directory

I would like to create backup from directory using cron. I wrote following command: cd path && sudo zip -r "backup-$(date +"%Y-%m-%d").zip" git/ && sudo mv "backup-$(date +"%Y-%m-%d").zip" /backup/ ...
5
votes
1answer
3k views

How can I create zip file with the date in its name?

In the command-line, how can I create a zip file from a directory, whose name would be the current date? I can use zip -r name dir, but how give it the date for a name?
4
votes
2answers
223 views

Creating a terminal command to extract tarballs

This is pure laziness, but I'm looking to create a custom terminal command to extract tarballs - ie "targz" then a filename would extract a tar.gz tarball, and "tarbz2"... Well, guess. I followed the ...
0
votes
1answer
3k views

How do I set CLASSPATH variable for Tomcat in 12.10?

Previously, I have set the JAVA_HOME path using the terminal with the following command: export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386" >> ~/.bashrc Now, I want to set the CLASSPATH ...
2
votes
4answers
805 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 ...
4
votes
4answers
4k 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 ...
23
votes
5answers
17k 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 ...
10
votes
2answers
12k 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 ...
1
vote
1answer
168 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
720 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
644 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 ...
2
votes
1answer
1k 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
275 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 ...
5
votes
1answer
277 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 ...
30
votes
4answers
13k 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
2answers
127 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
55 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
44 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
4k 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
1answer
665 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 ...
7
votes
2answers
536 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 ...
3
votes
1answer
922 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
615 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 ...
5
votes
1answer
75 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
3
votes
0answers
361 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 ...
3
votes
1answer
1k 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. ...
1
vote
2answers
995 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 ...
1
vote
1answer
27 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 ...