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

learn more… | top users | synonyms (1)

3
votes
1answer
228 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
2answers
3k views

What is the difference between “source x”, “. x” and “./x” in Bash?

I have one bash source run.sh as follows, #!/bin/bash if [ $# -ne 1 ]; then exit fi ... when I execute it in two ways, there are different behaviors. The first way is, source run.sh It will ...
2
votes
2answers
3k views

Differences between fish and bash to pass commandline arguments to alias functions?

From the answers to my other question here i learned about the possibility to pass commandline arguments to a alias function in Bash. In Fish i can edit an alias by editing the file config.fish in ...
13
votes
7answers
3k views

Auto complete for often used command line commands?

For some projects I often type in a couple commands, like for example: cd an/extremely/long/path/in/which/I/have/some/kinda/project and ./runmyproject --with some --command line --options set ...
11
votes
2answers
6k views

Shell does not show typed in commands, “reset” works, but what happened?

My problem is that the Bash shell stops showing the characters I type into it. It does read the commands though. I've come across this problem quite a few times and I don't understand what causes it. ...
11
votes
5answers
10k views

Commandline shortcut for current directory similar to ~ for home directory?

When i use the cp or move command in a terminal window, i'm currently with bash in a certain folder like this. NES@server:~/Desktop/dir1$ And now i wanna copy a file from here ~/anotherdir/dir2 ...
9
votes
2answers
9k views

How do I add a directory to MANPATH or INFOPATH?

I think I understand the instructions given in How to add a directory to my path? about adding directories to $PATH. But I don't understand how to add directories to $MANPATH or $INFOPATH. Also -- in ...
8
votes
2answers
4k views

xclip on headless server

I've been using xclip to copy the output of bash commands like so: pwd | tr -d "\n" | xclip -selection c So that I can then paste the output into another terminal session. I was trying to use it ...
8
votes
3answers
19k views

How do I create a script file for terminal commands?

In Windows I can write a file containing commands for cmd (usually .cmd or .bat files). When I click on those files it will open cmd.exe and run them commands the file contains. How would I do this ...
7
votes
2answers
325 views

Get bash history to remember only the commands run with space prefixed!

The commands executed in the terminal prefixed with blank space(s) are not recorded in the command history file. But is there a way to get the reverse i.e. the history should only record those which ...
6
votes
4answers
2k views

Keep a program running in terminal

So I am well aware of nohup and suffixing commands with & to ensure that they go into the background. However if I run a graphical application - sometimes using neither seems to do the job. So ...
6
votes
2answers
6k views

What is my crontab -e local file path? I want to set it via BASH script

In my Ubuntu, my username is "meuser". When i do crontab -e, i can setup my rules. But instead of doing it with crontab -e, how can i do it directly to a file? Which file i cant modify?
5
votes
2answers
416 views

How can I return to an application in the background?

I know that I can run an application in the background by putting an ampersand ('&') behind the command. For instance: user@ubuntu:~$ rtorrent & [1] 4618 starts rtorrent in the background. ...
5
votes
3answers
2k views

Script to Mute an Application

My goal is to be able to mute the Spotify application, not the entire system. Using the command: ps -C spotify -o pid= I am able to find the process ID of Spotify, in this case the ID is "22981". With ...
5
votes
2answers
899 views

How do I use bash's “<<” operator?

I know bash has a >> operator, to append output to files, but what is the use of the << operator?
4
votes
2answers
12k views

How to change directory using script

I have this script #!/bin/bash cd /home/user/somedir pwd it works as expected, but I would like this script to transport me to /home/user/somedir, but I stay in the same dir. How to write script ...
4
votes
1answer
4k views

What could be a reason for `.bash_profile` and `.bashrc` not to execute the exports?

the CUDA installation tutorial tells me to add the following two lines to my .bash_profile. export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH But ...
3
votes
1answer
2k views

Is it possible to do an unattended/silent lamp installation?

Is there a way to set up and pre-configure a lamp environment within a bash script without user prompting by dpkg and present data like mysql or root user password and such kinds of things?
3
votes
4answers
4k 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 ...
1
vote
2answers
169 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
3answers
12k 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 ...
1
vote
2answers
495 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 ...
0
votes
2answers
2k views

Bash Script using a Firefox Profile to open URLs

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 # ...
11
votes
5answers
9k views

How do I insert a line at the top of a text file using the command line?

I want to insert text at the top of an already existing file. How can I achieve this. I tried echo and tee but was not successful. I was trying to insert repo line at the top of sources.list file ...
9
votes
5answers
11k views

difference between bash.bashrc and /etc/environment file

Till data I was used to set my environment variables in the bash.bashrc file. Recently I told to use the /etc/environment file. Well, both work fine. So, what is the difference between them? I ...
7
votes
1answer
155 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 ...
7
votes
2answers
547 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
2answers
4k 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
246 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
134 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
3k 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
2answers
4k views

How to protecting cd command to deal with parentheses?

I asked here how to make cd protect spaces. Tab completion is great, but sometimes you paste the path from the clipboard so this is useful. The solution breaks with parentheses however. No matter how ...
5
votes
6answers
41k views

Every command fails with “command not found” after changing .bash_profile?

I was updating my .bash_profile, and unfortunetly I made a few updates and now I am getting: env: bash: No such file or directory env: bash: No such file or directory env: bash: No such file or ...
5
votes
3answers
9k 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, ...
5
votes
4answers
26k views

sudo: source: command not found

I've been updating some of the default profile for bash, and saw from the tutorials I was following that I could reload the new profile with the new environment settings by using: source ...
4
votes
2answers
2k views

“No such file” when running a 32-bit program on a 64-bit system

I downloaded a Chromium snapshot and unzipped it, like this: michael@ubuntu:/opt/chrome-linux$ ls chrome libffmpegsumo.so nacl_irt_x86_32.nexe chrome.1 ...
4
votes
4answers
7k 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
1answer
35k views

configure: error: C compiler cannot create executables

I was trying to install rvm using \curl -L https://get.rvm.io | bash -s stable --ruby --autolibs=enable --auto-dotfiles. It worked fine until I got a configure error: Error running './configure ...
3
votes
3answers
18k views

How to execute sh script from a desktop shortcut?

Im trying to make a shortcut to login my ssh server: ssh x.x.x.x I made the following file: ssh_home.sh Made it executable: sudo chmod +x ./ssh_home Checked by right clicking properties to ...
3
votes
2answers
4k views

Creating a script to install software after a clean install?

I find myself moving between multiple new machines lately (new laptop, new computer at work, etc.). I want to create a bash script to install all the software I use. Ninite is not reach enough. I have ...
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
294 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
1answer
281 views

Doing something if connected to particular SSID in Ubuntu

I want to write a bash script that will put off dropbox automatic synchronization if i'm connected to particular wifi ssid. How can i catch this event: for example i'm working at home and sync is on, ...
2
votes
1answer
374 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
295 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

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 ...
1
vote
4answers
81 views

Change directory structure from /YEAR/MONTH/DAY/ to /YEAR-MONTH-DAY

I need to change my directory structure for my photos from /YEAR/MONTH/DAY/ to /YEAR-MONTH-DAY I know this can sort of be done with exiftool, but it will only work on files containing EXIF-tags, and ...
1
vote
1answer
95 views

How to add element to the gsettings array at the specific location (given by index)?

I want to write a script that translates devilspie's window rules into compiz' rules. Compiz settings can be changed by gsettings keys in path org.compiz.profiles.unity.plugins.place. There are three ...
1
vote
3answers
2k views

Customize the command shell default prompt

Need help to change the command prompt. I want short name. Look below : kirti@kirti-Aspire-5733Z:~$ cd workspace kirti@kirti-Aspire-5733Z:~/workspace$ cd Ruby ...
1
vote
5answers
2k views

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

File: https://dl.dropboxusercontent.com/u/32919746/file 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 ...