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

learn more… | top users | synonyms (1)

3
votes
2answers
2k views

Script doesn't work when it is run using '#!/bin/sh'

I have a script that use shebang : #!/bin/sh, but when I run it in my Ubuntu 14.04 terminal, it doesn't work and it says that some lines has unexpected operator. My friend in another computer could ...
3
votes
1answer
284 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 ...
3
votes
3answers
18k views

Paswordless Rsync Over SSH Without Key Authentication [Un-Safe]

I want to set up an RSync job that would connect through SSH. I have my computer ( backup@myhost ) and the remote host ( test@remhost ) and I need to backup the folder ~/something with all it's ...
3
votes
4answers
5k views

execute script after desktop loaded?

I want to execute bash script on startup that opens several terminals in different workspaces. Script works just fine if I call it from terminal, but it doesn't work if executed from crontab using ...
2
votes
4answers
45k views

How to write the path of a folder with space in it's name? [duplicate]

I can't figure out how to write the path of a folder that includes spaces in its name (in Terminal). I tried: cd /path/path/path/"A Folder"/file cd /path/path/path/'A Folder/file cd ...
2
votes
1answer
1k views

Sort files in directory by creation date(Birth)

In my Download folder I have a lot of files.I need first a way to arrange them by type second files with same type arrangement become by the type that i added(or can say downloaded or birth (if i am ...
2
votes
5answers
3k views

How to remove special 'M-BM-' character with sed

I have file that was created by copying content from DOCX document with LibreOffice into text file. I have modified file with sed to remove additional spaces and other stuff but then I noticed space ...
1
vote
3answers
109 views

Bash shell for loop process with two paired variable names

It's common to use bash shell for example to bulk rename plenty files. Usually I used the following structure, for file in ./*.short do # do command done That's for filename with .short extension. ...
1
vote
3answers
146 views

Can i edit a bash shell command?

I just wants to modify a bash shell command like exit so when i write exit in the terminal it clears the screen, and echo some text, wait 2 seconds, then execute the exit function. So is there any way ...
1
vote
1answer
193 views

Run script in Terminal via context menu (Open with Terminal)?

this question is simple about "Open/Run in Terminal".... Looks Ubunutu doesn't support bash/shell-scripts the way we know from KDE and any other OS: I tried the obvious: Right click in file ...
1
vote
2answers
720 views

setting up a script to rotate scren Lenovo Yoga Thinkpad S1

I am trying to set up a Lenovo Yoga Thinkpad S1 to rotate the screen with the touch of a button but I am having a little trouble with the script that actually does the work. I have found the scripts ...
1
vote
2answers
11k views

Ubuntu adding path/Environment variables

I am trying to install apache maven 3 in Ubuntu 12.04 lts. What I did was open the terminal then I typed the following commands export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.5 [Then ...
1
vote
2answers
4k views

How to use Bash Script to open URLs in a different profile with Firefox?

Working on a script to automate some tasks in Firefox. These tasks should run through a clean Firefox profile, so they are fast and don't interfere with any of my regular surfing. #!/bin/bash # ...
1
vote
2answers
241 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
548 views

Creating a directory of recently created files

On a system I have, files are uploaded through a series of various mechanisms into one central "incoming" directory. Once a day those files are processed and they are moved off to where they need to ...
17
votes
1answer
2k views

Why does bash thinks that 010 is 8?

Why does bash think the number 010 = 8? x=010 echo $x 010 echo $(( x+0 )) 8 echo $(( x-2 )) 6 I thought it might be binary, but 010 = 10 = 2. So why does it get 8, and how can I make it think ...
12
votes
5answers
1k views

Using cd command to navigate directories in Ubuntu which have special characters [duplicate]

When I want to navigate into directories having special characters in their names I get an error message. For example: aman@desktop:~/Aman$ cd !)e$!gn&(reate bash: !: event not found ...
8
votes
5answers
547 views

How do you output the filename in find command while using -exec?

I use the following line to find all sub-directories of the PWD and run svnadmin verify on each directory (I already know that they're Subversion repositories) find ./* -maxdepth 0 -exec svnadmin ...
8
votes
3answers
165 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, ...
8
votes
1answer
302 views

How to execute a terminal command every time the firefox windows closes

I need to execute this: rm -rf ~/.wine-pipelight/*; rm -rf ~/.wine-pipelight/./.*; cp -a ~/viewright_backup/. ~/.wine-pipelight every time the Firefox window closes. But not necessarily when all ...
8
votes
1answer
24k views

How do I get the parent process ID of a given child process?

How to get parent pid from a given children pid? I know I can mannully check it under /proc, I am wonder if there is a smart/better way to achieve this in Ubuntu. Note the parent may or may not be ...
7
votes
2answers
665 views

What is the difference between `VAR=…` and `export VAR=…`?

What is the difference in doing $ MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=384m" to doing $ export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=384m" and is there any side-effect of doing either in an SSH ...
7
votes
3answers
11k views

Daily cron job not running

A quick overview: I have a script that will daily backup my source code repository from SVN into a tarball for that day. I have tested the script and it works very well as long as I run it as sudo, ...
7
votes
2answers
7k views

How to find the version of an Ubuntu machine remotely?

I have more than 60 to 80 systems running Ubuntu. Some of them are with version 8.04 and some of them are with latest version 10.10. Now we are in the process of upgrading all older Ubuntu version to ...
6
votes
2answers
320 views

Bash prompt doesn't print until I interact with console again

I don't even know where to begin to diagnose this one. Usually, when a command finishes, the prompt prints itself for the next command. However, that is not happening. Hard to explain with words, I'll ...
6
votes
1answer
163 views

Conflict between variable substitution and CJK characters in BASH

I encountered a problem with variable substitution in the BASH shell. Say you define a variable a. Then the command $> echo ${a//[0-4]/} prints its value with all the numbers ranged ...
6
votes
2answers
6k views

How do I remove all metadata from a quicktime movie file?

My camera takes .mov files as movies. How can I remove all metadata from them so I can feel confident sharing them on youtube without accidentally sharing when/where they were filmed, what type of ...
5
votes
4answers
102 views

Specific edits to a text file (awk?)

I have a file that looks like TITLE 1.000000000000000 10.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 10.0000000000000000 0.0000000000000000 ...
5
votes
1answer
273 views

How to automatically install a program bash suggests I install?

I am thinking of the use case of this output: The program 'tiger' is currently not installed. You can install it by typing: sudo apt-get install tiger How can I get it to prompt me to install that ...
5
votes
2answers
352 views

useradd doesn't allow the user to log on

On an Ubuntu 14.04.2 LTS the following command: adduser fu and then entering a password bar and just pressing Enter on all other questions, creates a user that allows me to log on and has the ...
5
votes
3answers
151 views

To which directory should I install a program from a bash script?

I want to install Netbeans 7.0.1 with a bash script from the Netbeans website. The default directory chosen by the installer is /home/geoffrey/netbeans-7.0.1. But I do not think it belongs there.
4
votes
3answers
209 views

Dealing with bash breaking commands of a certain length

Consider you want to run this command in bash: echo -n "Command of a specific length will break at the second run attempt." Here's the output for a 24x80 TTY: ubuntu@ubuntu:~$ echo -n "Command of ...
4
votes
3answers
225 views

How I can monitor new files in a directory and move/rename them into another directory?

A program generates output textfiles, named output.txt, after every 15th iteration of a certain process. Doing so, it overwrites the last output.txt. I want to keep the files however, and I can't ...
4
votes
1answer
2k views

How to check in a bash script if passed argument is file or directory?

I have to write a simple bash script in Ubuntu which would allow me to pass it some arguments and I want to check if these arguments which can contain spaces are files or directories. How can I do ...
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 ...
4
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. ...
4
votes
2answers
9k 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?
4
votes
1answer
3k views

Can't change theme of ZSH in Ubuntu 12.04

I have changed the theme in my ~/.zshrc file however whilst some of the colors in the prompt change the text size and background color remain as the Ubuntu default. Any one know how I can override ...
4
votes
4answers
10k views

Does executing sudo su and su root do the same thing?

What are the technical differences between the two? The only thing I noticed is that sudo su requires you to enter your own password (assuming you're not root) While su root requires you to ...
3
votes
2answers
548 views

copy to clipboard current path from console with no mouse [duplicate]

I'm wondering if it possible to copy to clipboard output of pwd command. I often need to copy some path and I have to select it with mouse, do several clicks and that is annoying for me. What I want ...
3
votes
1answer
4k views

Using sudo aptitude/apt-get update does not work

Trying to update via terminal via aptitude or apt-get is not working. There is no other package management program running in the background or any other user. I tried both, sudo aptitude update ...
3
votes
1answer
306 views

link key to a bash script

I'm trying to link a button (now without function) to a bash script that I have made on UBUNTU. I'm using a clevo W150HNM/Sager NP5160 I want to use 1 or 4 for this(see photo on ...
2
votes
4answers
202 views

Alternative way to run a sudo command on startup

I am trying to write a script for my Ubuntu system to hibernate, whenever the amount of battery left is (say) 5%. This script will run on startup. I can get the battery left using upower -d |grep ...
2
votes
1answer
334 views

14.10 gnome classic metacity unable to hook up keyboard shortcut to binary

I am trying to get the Aero Snap effect working on an Ubuntu 14.10 using Gnome Classic Metacity. I found a command that works if I execute in on a terminal window: wmctrl -r :ACTIVE: -b ...
2
votes
1answer
8k views

Run bash script from php

I want to run a shell script within a php webpage to check some processes running on my system (Ubuntu 12.04). Googleing I've found about shell_exec() but I can't manage to run the script when loading ...
2
votes
2answers
9k views

Execute sh script from *.desktop file?

What I want to do at all, is that: Create script that has icon on it. So I know only one way - file.desktop file with icon. Settings icon on it was successful, but I have no luck setting EXEC value :/ ...
2
votes
1answer
961 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 ...
2
votes
1answer
358 views

How to stop bash prompt colours from escaping

I'm trying to configure bash to display the current git branch, based off the example here, but I can't figure out how to get bash to stop escaping the colour strings. Everything I try results in the ...
2
votes
2answers
2k views

Ubuntu 12.04 Can't Login-Tty Console said: -bash: /usr/bin/byobu/-launch: no such file or directory

I face problem in login to Ubuntu 12.04. I think it's caused by accessing super user (if not wrong). I type sudo nautilus to put a background to burg, but i fail x_x. After reboot, i can't login to ...
2
votes
2answers
2k views

gnome-terminal and logging

Is there any way to log every that was displayed in gnome-terminal? for example I have a complex command doSomethingThatPrintoutsAlot ; doSomethingThatPrintoutsAlot2 ; doSomethingThatPrintoutsAlot3 ...