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

learn more… | top users | synonyms (1)

3
votes
1answer
830 views

Locale warning while executing adduser

I just tried to add an user to a group $ adduser someuser sudo perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_US:en", LC_ALL = ...
5
votes
1answer
171 views

Can I create a new script and chmod it in one command?

When writing answers on here, it's often necessary to create a new script and chmod +x it to make it executable. I won't go into whether this is a good thing or not, but explaining to people that they ...
0
votes
1answer
3k views

Open file with terminal and close terminal afterwards

I want to open a file using the terminal on ubuntu. To have it independent from the terminal, I use gnome-open: gnome-open text.pdf And since I'm lazy, I also have this alias in my .bashrc: alias ...
1
vote
1answer
116 views

Bash escape from script

I have a simple app launcher script used to open a few apps in a ceratain folder on a certain workspace: #!/bin/bash if [[ -n "$2" ]] then wmctrl -s $2 fi terminator ...
2
votes
1answer
843 views

Can't redirect all output of program

I am attempting to redirect all output of a program (Steam) to /dev/null so it doesn't show up in the terminal. Here's what I've tried: steam & > /dev/null 2>/dev/null and steam & > ...
11
votes
1answer
851 views

Bash comparison and expression operators

I'm new to bash programming. I've read two good, long guides, but they made a mess in my head about operators and keywords. Which are more commonly and widely used? I don't know when to use which ...
2
votes
1answer
170 views

awk quoting program text

I just came across a gotcha in awk, and I would like to know if anyone can explain to me why this happens. The following 2 lines behave differently if I run: # grep -Rl BASE_DIR --exclude-dir=.svn * ...
0
votes
1answer
19 views

Permissions depending on parameters passed to application

I have a java app that writes to a very important table I have. This is sudo protected, but this app takes a parameters for where the output should go. The default is the REAL DEAL but the "output" ...
1
vote
2answers
235 views

Deleted /bin instead of /android-project/bin

An android project has its /bin directory and what I wanted to do is to deleted this. What I actually mean is delete /path/to/android-project/bin not the /bin directory. So I executed this command, ...
1
vote
2answers
4k views

Bash script that convert any output (text) to json form

I want to create bash script that it converts output of other scripts (Normally simple text) in a valid json form. How can I do this ? Example: awk '/^Mem/ {printf("%u%%", 100*$3/$2);}' <(free ...
1
vote
2answers
3k views

Why is setting alias in .profile not working?

I have this as the last line in my .profile: alias gl="cd /home/jrenner/glances/glances" yet even after reboot I get command not found when typing gl. What is happening? I am logged in as the ...
2
votes
1answer
3k views

Problem sourcing variables inside Upstart

I'm trying to use the variables defined in /etc/environment in an upstart script running on 12.04. I'm able to export the variable to the child process but for some reason I not able to use them in ...
2
votes
2answers
4k views

killall doesn't kill all and rarely kills, what is the command for then?

I occasionally use the killall command to kill processes. The reason why I say ocassionally is that in some cases it hasn't worked for me. A recent example was with thunderbird where there were about ...
3
votes
2answers
2k views

How to pause a running aria download

When downloading big files it necessary to pause the download many times. A big file can be downloaded by using wget. First start download, then kill wget, then resume download by wget -c. I want to ...
0
votes
1answer
266 views

how to use expect with bash

I Have created a shell script as given below.This script will login to a remote server as a normal user then switch to root user for creating a directory.The script is as given below. ssh -t ...
6
votes
1answer
2k views

VLC “:rate=2.0” - Where do I put this in command-line?

I figured out a way to transcode my videos so that they would play at double speed using the GUI as "Convert/Stream" --> "Show More options" and adding ":rate=2.0" after ":file-caching=300" in the ...
1
vote
1answer
124 views

How to use ' and " (quotes) as an argument

Intro In a script I want to run a command in a separate window so that output of the command will show in a new window (which is an output stream like top) and they do not interfere each other. For ...
2
votes
1answer
1k views

Permission Issues with command in rc.local

I am using a command to start a screen session and run a bash script for a user. /bin/su username -c "/usr/bin/screen -dmS test bash -c '/home/username/test.sh; exec bash'" When I boot, I am seeing ...
33
votes
2answers
9k views

Bash: delete from cursor till end of line with a keyboard shortcut

Consider the following bash prompt, where ^ denotes the prompt location: # git commit -am "[bug 123456] Do this and that with the bug" ^ Suppose that I want to commit ...
2
votes
0answers
162 views

Running bin file in bash script [closed]

I want to build a bash script that runs a bin file. However the question is: how to continue the script even after bin operation is completed to perform other commands?
3
votes
2answers
878 views

How do I run a py file with pico in the terminal?

I got this when I tried to open a .py file on the terminal line I edited in pico: lightning@rigel5:~$ ./hello.py bash: ./hello.py: Permission denied How can I easily open a .py file from the pico ...
3
votes
2answers
4k views

Copying from mount share drive to local folder through script

This is my first time trying to work with Linux Scripts so this may be something obvious. Here is what I am trying to do: Remove all contents from local folder - rm /home/user/Documents/Exercise/ ...
2
votes
2answers
74 views

How to port the bash settings?

I want my own bash environment vim tmux and so on, that I can customize for my develompment needs. Then upload it to github and install whenever I set up my computer new. Any HowTo's how to proceed?
3
votes
2answers
611 views

Using read without losing the TAB

Im using read in a while loop to automatically change a makefile after download. Here is part of the script, while read a; do if [[ "$a" = "FCOMPL=g77" ]] then echo "FCOMPL=gfortran" ...
4
votes
1answer
9k views

Why does “if [ 0 ]” execute the “then” statement in bash script?

This guide says: An if/then construct tests whether the exit status of a list of commands is 0 If I execute 0 in the bash, it says: 0: command not found So its exit status is not 0, and [ 0 ] ...
1
vote
2answers
85 views

How to create a bash file allowing a folder from CD be transferred to Documents?

i want to transfer the myfiles folder from CD to Documents in a more decent way of transferring. I think creating an executable bash file is better. this bash file when clicked will allow the ...
3
votes
1answer
278 views

Saw an interesting command but can't alias it

Saw an command from this post http://askubuntu.com/a/266839/75967 that I would like to alias find {,/usr}/{,s}bin -printf '%f\0' | xargs -0 whatis | sort | less I assume the less or the | is ...
0
votes
1answer
193 views

Create bash with xinetd

I'm making an intentionally vulnerable Ubuntu server for an information security class. I'm trying to create a bash shell that is accessible without authentication, a user should just be able to ...
0
votes
2answers
664 views

Fix bash_profile to Develop Ruby on Rails Apps

I just installed Ruby and Rails stuff on my machine, and start to learn. But every time I close the Terminal and re-open it, I have to re-type the command . ~/.bash_profile in order to run Rails ...
0
votes
1answer
355 views

Command line FTP download latest files

I am trying to use the command line ftp to download files from a specific date and onwards. Is there a simple solution for this? Thank you!
0
votes
1answer
447 views

Does adding a folder to your classpath add sub-folders?

I am doing this in a script: if [ -d $SERVICE_HOME/../config ]; then CLASSPATH="$SERVICE_HOME/../config:$CLASSPATH" fi And the /config folder has sub-folders in it also, will files in the ...
3
votes
2answers
314 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
668 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 ...
1
vote
1answer
543 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
43k 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
393 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
472 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
272 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
215 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
99 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
5k 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
294 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
5k 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
3answers
10k 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 ...