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

learn more… | top users | synonyms (1)

11
votes
4answers
10k views

Autocompletion doesn't work while logged as root

I have just came across something that is really bothering me. Autocompletion on ubuntu works like a charm but when I login as root, e.g. su I get tab autocompletion only sometimes. Why does it work ...
10
votes
1answer
96k 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 --...
5
votes
1answer
73k views

Run executable file on terminal

I'm new to Ubuntu and currently on it because of assignment. I would like to ask few questions: How do I make new command to run a shell script? For example, when you type passwd on terminal it runs ...
1
vote
2answers
13k views

Change the terminal prompt [duplicate]

This can be really trivial,but it helps in ways of making it more comfortable while coding and sending commands to terminal. My terminal source/bash/root name(my apologies, I dunno which is the right ...
22
votes
4answers
25k views

How save my “alias” entries forever [duplicate]

I want to save my alias commands forever like the default ones when I type "alias" so I don't retype them every time I leave my bash
15
votes
2answers
573 views

What's the missing argument to -exec?

I use the following command to clear a directory, of files and directories over 30 days old, and move them to an archive directory which I can delete after a few weeks if nobody asks for their files ...
11
votes
2answers
1k views

Re-run an application script when it crashes?

I have some applications that need to run on my laptop all the time. I use a bash script to start these applications. In my script I have a loop that looks similar to this: while true; do ...
9
votes
1answer
56k views

How to run Bash script as root with no password? [duplicate]

Possible Duplicate: How do I use sudo in my script without needing a password? I want to run a bash script as root with no password prompt. I tried visudo with no luck(your_username ALL=(ALL) ...
9
votes
4answers
496 views

Prevent all commands from being defined as an alias

Is there a way to prevent all commands from being defined as an alias? For example a user shouldn't be able to define rm or any other command (Ubuntu default commands) as an alias name.
7
votes
1answer
3k views

Getting the default text editor used in system

I have been searching and browsing for a long time and have not been able to find an answer to my question. I have used select-editor and I note that I am using /usr/bin/nano. Is this the default ...
6
votes
2answers
2k views

Get a file's emblem from command line?

I'd like to be able to determine what emblem a file has from the command line. Is there a way to determine this? Also, is there a way to apply emblems from the command line? I usually have a cron ...
5
votes
2answers
1k views

How does one open the HUD from the command line.

Alt is used to open the HUD in 12.04. I'd like to use alt to execute a second action as well as open the HUD by having alt execute an executable script. So Alt = script, that does HUD and other ...
20
votes
6answers
21k views

How to start a terminal with certain text already input on the command-line?

Rather than rephrasing my question, let me describe to you the desired user-case: I create a short shell-script to run command "gnome-terminal --someoptionflagname 'my text to be posted'", and ...
19
votes
2answers
29k views

How to grep 2 or 3 lines, one containing the text I want, and the others just below it?

This is a snapshot of error log: 06:16:29,933 ERROR EmailRMManager$:45 - Exception In get Message com.rabbitmq.client.AlreadyClosedException: clean connection shutdown; reason: Attempt to use closed ...
6
votes
2answers
11k views

How to write Bash script What is the command to open a terminal with two different tabed terminals and execute some commands separately tabs?

How to write Bash script to open a terminal with two tabs, and execute commands in both tabs? for instance: tab 1 opens skype tab 2 opens chromium-browser In the end, I want one more thing: write a ...
5
votes
3answers
33k views

how to check if $1 and $2 are null?

I am running some script which passing the string argument and I want to do if else statement shown as below: if [ $1 != '' ] && [ $2 != '' ] then do something..... but it shown Error ...
4
votes
2answers
5k views

Running commands on boot in 11.10

So I am getting properly confused on how to create a startup script on my Ubuntu 11.10 server. I have read about init-scripts, upstart-jobs and more, but I get even more confused the more I read. I'...
4
votes
3answers
2k views

How do I list all available shell builtin commands?

We know bash supports number of buitin commands like: $ type type cd help command type is a shell builtin cd is a shell builtin help is a shell builtin command is a shell builtin I want to get ...
3
votes
1answer
5k views

How do I launch a bash script using a keyboard shortcut?

Just like the title says, how do I launch a bash script in my ~/Downloads folder using a keyboard shortcut? I've tried binding cd ~/Downloads && ./bash-script.sh to different accelerators (ex. ...
19
votes
1answer
2k views

Why use env in shebang?

What is the purpose of using #!/usr/bin/env <sh|bash|python> shebang compared to #!/bin/bash, #!/bin/sh or #!/usr/bin/python?
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 ...
9
votes
2answers
2k views

Running .sh every 5 minutes

I have a .sh script that downloads a photo from Japanese satellite's server and sets it as a background picture. I've put it into startup list, but how do I run it every, like, 5 minutes, ...
6
votes
1answer
42k views

The fastest way to create a file from a terminal

What is the simplest way to create a file using a command-line? Usually I use: touch filename But is this the simplest/fastest way?
6
votes
1answer
7k views

How to execute script on shutdown?

I want to execute script before I shutdown my machine that writes date to a file (so I do know what time I finish working). How to do it?
3
votes
1answer
1k views

How to extract/inject ID3 tags via bash?

I have a huge collection of MP3 files that have ID3 metadata. Is it possible to extract existing tags and images to plain text (e.g. JSON, XML)? Can I inject from plain text to MP3 file? How can I do ...
2
votes
1answer
2k views

how to pass a{sv} arguments to gdbus?

i have problem to passing the arguments of the function in a dictionary format (string,variant); i try to run a screencast in gnome and to start the function i need to pass these asrguments: -method ...
2
votes
3answers
42k views

Where my linux password is stored on my system and how i can retrieve it? [duplicate]

I am currently logged in on my Linux system and i want to output my Linux password and username on my terminal, what commands i need to write and in which file it is stored and how i can retrieve it ?
0
votes
3answers
168 views

How to cd into a directory with blanks?

I have a directory called "foo bar baz blob". How can I $ cd "foo bar baz blob" I have tried with quoting (" and ') and with escaping the blanks (\ ). It does not work. Tab-completion does not work ...
0
votes
2answers
104 views

Select Command not working while run shell scripts on remote machine

I want to run my shell script on a remote machine and I need user want to give value for some variable for that we use Read command while run script on local machine but I use the same command while ...
21
votes
5answers
11k views

Showing a “cowsay” fortune in every new terminal session

I wish to display a cowsay message in every terminal window. The command I use is fortune | cowsay Any ideas how to make it appear whenever I start a new terminal session?
20
votes
4answers
4k views

What is the meaning of ./ before a given path?

I've been told to run this: ./yiic message ./app/messages/config.php But I don't understand the ./ meaning, can anyone clarify please. Note: Believe me, we can't google that. I've tried: ./ ...
15
votes
2answers
6k views

Why does Ubuntu's default ~/.profile source ~/.bashrc?

These are the contents of the stock ~/.profile that came with my 13.10 (commented lines removed): if [ -n "$BASH_VERSION" ]; then if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi ...
13
votes
4answers
28k views

error while loading shared libraries libSDL-1.2.so.0

I am trying to install ioquake on my ubuntu server. When I try to run it, I get this message: # ./ioquake3 ./ioquake3.x86_64: error while loading shared libraries: libSDL-1.2.so.0: cannot open ...
11
votes
4answers
2k views

Running a script created in Notepad (Windows) on Ubuntu

I created a Notepad file on Windows and copied it to Ubuntu. The file contains some iptables rules. After making the file executable using chmod +x and executing it, it didn't work. However, when I ...
10
votes
2answers
15k views

How can I protect parentheses passed to a cd command?

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 ...
9
votes
4answers
4k views

How can I play a song in the background via my command line?

I have installed play : sudo apt-get install sox libsox-fmt-mp3 I can now play my audio files like this : play Desktop/SONGS/01\ -\ Oh\ Baby\ Girl.mp3 Since I'm learning shell, I wish I could ...
8
votes
3answers
670 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
2answers
2k views

What's the use of complete command?

While running the complete command on my gnome-terminal, it shows some commands.What are they? And what is the use of complete command? $ complete complete -F _minimal complete -F _filedir_xspec ...
7
votes
4answers
3k views

Use of default alias “alert”

The default alias Alert is for the command notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//...
7
votes
2answers
850 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
1answer
1k views

How to automatically set terminal title to directory name without path

Currently, my bash terminal/tab title is set based on the directory I'm in. For example: bob@bobscomputer:~/i/had/some/great/pie/yesterday This isn't very useful if I have multiple tabs open side-...
6
votes
5answers
3k views

Redirect pipe output to the same file

Is there any short way to save the pipe output to the same file that it's processed. For example, this is what I am actually doing $ cat filename | sort | uniq > result $ rm -f filename $ mv ...
6
votes
4answers
1k views

Pipable command to print in color?

I'm a bit new to bash scripting, and I'm wondering if there is a program or built-in command to pipe to that will print in a specified color? Or is there an echo argument to do so? Like I could do: ...
5
votes
1answer
946 views

How to run a script on each login or once a day if not run that day already?

I've made a custom directory where I've put a couple of my favourite wallpapers. I made a script which examines this directory, counts the number of PNGs, and then randomly sets one image as a ...
4
votes
4answers
7k 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
2answers
4k views

Auto confirm when running bash scripts?

I am working on a simple bash script that configures new servers how I want them. It's nothing special but it will hopefully save me quite a lot of time in the future. How do I prevent prompts like ...
4
votes
2answers
725 views

Why won't this script run on startup?

This script works perfectly when I launch it manually. How can I get it to run on startup? The function of the script is to get Docky to auto relaunch in the case of a crash. I created the script ...
3
votes
1answer
711 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, ...
3
votes
2answers
2k views

How to use -exec option in find command

I wanna solve some problems in compiz with my brain and hands. By the way I entered following command to build compiz from source in Ubuntu 12.04 find /opt/compiz-built/share/gconf/schemas -exec ...
3
votes
1answer
13k views

Permanent PATH variable

How will I make this /media/De Soft/mongodb/bin PATH variable permanent? Everyone is saying export PATH=$PATH:media/De\ Soft/mongodb/bin to your ~/.profile, or .bashrc, or .zshenv depending on your ...