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

learn more… | top users | synonyms (1)

3
votes
2answers
55 views

find everything besides directories

How can I use find command to find every type of the file (not just -type f but also specials such as sockets, device files etc.) but ommiting dirs?
8
votes
3answers
15k views

Shell script to move all files from subfolders to parent folder

I've bunch of folders in folder A. I want to move files from all those folders to A. Or I want to cut all files from child folders and paste them in parent folder. How to do that?
11
votes
1answer
1k views

How do I remove the “did you mean…” feature in the shell?

When I fail to type correctly a command, for example: luca@mostro:~$ sido No command 'sido' found, did you mean: Command 'sudo' from package 'sudo' (main) Command 'sudo' from package 'sudo-ldap' ...
2
votes
1answer
147 views

Is there a way to alias the command cd so that it protects the arguments?

When I run cd My folder There is an error because I have not protected the string. bash: cd: My: No such file or directory But this works fine cd "My folder" Is there a way to redefine cd as an ...
2
votes
3answers
2k views

Why some user functions don't get recognised by bash?

I can define a function like: myfunction () { ls -R "$1" ; } And then myfunction . just works. But if I do echo "myfunction ." | sh echo "myfunction ." | bash the messages are: sh: ...
8
votes
1answer
1k views

Bash alias -=… (alias name should be a simple dash) not working

I want to create an alias for cd - which should be just a dash (-). I tried without success: alias -='cd -' # bash: alias: -=: Invalid option alias \-='cd -' # bash: alias: -=: Invalid option ...
1
vote
2answers
10k views

“syntax error: unexpected end of file” simple script

i need some help for a very siple script, i don't get were the fault is. The script : #!/bin/bash declare -i s declare -i m declare -i h if [ "$3" < 50 ]; then s=$3+10 m=$2 h=$1 else ...
0
votes
4answers
2k views

Keyboard shortcut to a sudo-script

How do I create a keyboard shortcut to a script that needs sudo privileges? I tried to create shortcuts via Ubuntu Keyboard Settings GUI to scripts "sh script.sh", "sudo sh script.sh" , but ...
31
votes
3answers
26k views

How can I shorten my command line (bash) prompt?

Currently it is: michael@Castle2012-Ubuntu-laptop01:~/Dropnot/webs/rails_v3/linker/spec/controllers$ Outside of renaming my machine and directory structure... How could I make it be something ...
4
votes
5answers
1k views

How can I uniqely record every new command I use, and possibly timestamp it?

I've been on Linux for more than 6 months now but never went too much into the CLI (command-line interface or terminal or shell) Now as I ask questions here, get answers, or help from other sites, I ...
0
votes
1answer
312 views

how to Create SIGQUIT as command in the command line?

I am a total noob in shell scripting. I am creating .sh file to make some multiple commands, but my problem is that the last command is an executable file that after excuting it stays open and the ...
1
vote
1answer
2k views

How can I prevent two shell scripts running at the same time?

I have a tar backup script that runs once a month. It runs at night through cron. I also have a power schedule that reboots the server at 4.15 every night. The problem is that the server reboots ...
0
votes
1answer
204 views

bash ignores what I type while “apt-get” is running

I am encountering this problem: I type sudo apt-get install <package>, and hit Enter. apt-get starts resolving dependencies and downloading/installing packages. While it is running, I want to ...
3
votes
2answers
7k views

Bash Completion Doesn't Work In Root User

I'm on 12.04 and I'm trying to find a way to enable Bash completion in root user. Any ideas on how to do that?
2
votes
1answer
3k views

find: unknown predicate

This is probably not a Ubuntu question as such, but a Linux one instead, still hope some Linux user out there can help me understand this. I'm trying to use the find command to look for some files an ...
0
votes
1answer
2k views

Expect script: wait for completion

I'm using an expect script to connect to a windows machine and execute an ant script. After completion I want to delete a file and log out. The execution of the ant script takes almost 30 seconds, so ...
11
votes
4answers
6k views

Generic solution to prevent a long cron job from running in parallel?

I am looking for a simple and generic solution that would allow you to execute any script or application in crontab and prevent it from running twice. The solution should be independent on the ...
52
votes
3answers
110k views

What is difference between #!/bin/sh and #!/bin/bash?

if I write, #!/bin/bash echo "foo" or #!/bin/sh echo "foo" both yields same. I have seen some scripts starting with #!/bin/sh or #!/bin/bash. Is there any difference between them?
1
vote
2answers
277 views

Screen with ssh to overcome disconnection

I have a script name.bash. I want to run it on the server serv@domaine with ssh but I'm afraid to run it directly and close my shell and stop execution. I read that i can run my bash on the server ...
1
vote
2answers
1k views

Tab Completion Causes Dollar Signs to be Escaped [closed]

Using Ubuntu 12.04. When I'm typing a path in terminal that starts with an env variable reference, I hit tab to complete a word and it escapes the $ in the env variable reference. As a result, I have ...
1
vote
1answer
704 views

Shell script that checks user activity and sends an email to the user in case of inactivity

I need to check user activity under Linux (Ubuntu) and after 10 minutes I need to alert the user over email. By inactivity, I'm referring to CPU usage of the processes that user is running. I tried ...
3
votes
2answers
253 views

What is the best way to use the mysql charm in Juju with dynamic database credientials?

I am creating a Juju charm to encompass many Django development projects. I have the charm installing Django, wsgi, and Apache2. Django uses a separate database, user, and password for every project ...
1
vote
2answers
5k views

find: missing argument to -exec

The following works from the terminal no problem find testDir -type f -exec md5sum {} \; Where testDir is a directory that contains some files (for example file1, file2 and file3). However, if I ...
6
votes
2answers
5k 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 ...
3
votes
2answers
5k views

How can I automate a root command after (not during) startup?

I'm using Ubuntu 12.04 LTS, but I need to run the following command: sudo dhclient after startup to acquire a stable ethernet connection. I am running dhclient during startup already, through the ...
7
votes
3answers
5k views

How do I install utorrent by hand?

So I'm new to Ubuntu, in fact I've only installed it yesterday. There are a few programs I want to install.. both of which are a .tar.gz and a .tar.bz2 file. When I double click on them, they just ...
5
votes
2answers
944 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 ...
1
vote
0answers
293 views

Need to close the 12.04 GNU Bash screen [closed]

I recently upgraded my Toshiba Satellite P105 laptop from Ubuntu 11.04 to 12.04 (I don't have windows there). It was working fine for a couple of days, but now every time that I start the laptop, I ...
2
votes
3answers
2k views

Loop in bash to create decimal number

How to generate a numbers 0.01, 0.02, 0.03 ... until 0.2 in bash ? i run this example but it doesn't work #!/bin/bash # # Script for running several experimentations one the same JVM # for ((i ...
3
votes
1answer
3k 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. ...
1
vote
1answer
30 views

Can I suppress the last-minute 'writing to disk' dialogue when umounting? (bash script)

I have a bash script that will copy files over to drives upon insertion and then unmount. The actual copy line is simple: cp $SRCDIR/$FILE $DRIVE and the umount: umount $DRIVE However, once cp ...
3
votes
4answers
407 views

“rm” doesn't accept internal command as a paramter

Why doesn't this work? rm $(gsettings get org.gnome.desktop.background picture-uri | awk '{gsub("file://","");print $0}') rm: cannot remove ...
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
2answers
4k views

How to replace/fix a messed up /bin/sh and /bin/dash

I have corrupted my /bin/sh and have no idea how to replace it. I accidentally copied over it. How can I fix this? I am running Ubuntu Server 11.10, no X. update: I have tried the fix that was ...
3
votes
1answer
662 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: ...
2
votes
1answer
1k views

Shortcut to terminal/bash script without 'instant close'

I've created a desktop entry in ~/.local/share/applications. It looks similiar to the following: [Desktop Entry] Version=1.0 Encoding=UTF-8 Name=Crontona Server GenericName=CA Server Comment=BDAF ...
5
votes
1answer
574 views

Synchronize profiles across servers (.vimrc and .bashrc)

I'm on a few different servers on any given day. I'm starting to really tweak two files in my bash profile: .vimrc and alias.sh. Would anyone have a recommended way to save and sync these two files. ...
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?
1
vote
2answers
524 views

How to organize scripts and tools under ~/bin in directories, but have them in $PATH?

I always have ~/bin added to the $PATH in my ~/.profile. As is default in Ubuntu. # set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi ...
13
votes
3answers
16k views

Configure gnome-terminal to start bash as a login shell, doesn't read .bashrc

I'm trying to integrate RVM with gnome-terminal. Per default, gnome-terminal does not start bash as a login shell. I enabled run command as a login shell as suggested in this answer about the same ...
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 ...
12
votes
3answers
11k views

Can't make ZSH the default shell

I am trying to set ZSH as my default shell, however it keeps reverting back to bash. I have tried this code: sudo chsh -s $(which zsh) I've also tried: sudo chsh -s /bin/zsh Also tried these ...
0
votes
2answers
109 views

Is there a way I can record when the stderr is printed to a log file?

I'm running the command php someFile.php 1>> stdout.txt 2>> stderr.txt Is there a way I can record when the stderr is printed?
2
votes
1answer
2k views

~/.bashrc changes have no effect?

I have been trying to set some custom colors on the user@hostname:~$ on the terminal. I edited both ~/.bashrc and /etc/bash.bashrc Where it said: debian_chroot:+($debian_chroot... I just changed ...
1
vote
1answer
2k views

Script for checking for installed applications

I'm trying to write a script for ubuntu 10.0.4 to check for an application on my system. I want the script to see if the particular named application is installed, and if it is, if it needs updating. ...
0
votes
0answers
241 views

Bash Script for counting the number of processes running returns odd answer [duplicate]

Possible Duplicate: Process ID using ps aux I was writing a script to display the number of processes running for the script I am running. The file name is test.sh The code is ...
3
votes
2answers
521 views

How to write bash actions to a file?

I know that there is a way to write bash shell outputs to a file. However, I want to know what commands have been executed by an application as some of these executions are not outputted as a shell ...
3
votes
1answer
1k views

Bash runs executable fine in 10.04 but not in 11.10 or 12.04

First post, but I come here often and this is the first time I haven't found the answer already posted, so I registered. I have a simple binary executable that runs fine in 10.04. ./buds Opening ...
7
votes
2answers
620 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 ...
4
votes
1answer
280 views

How to stop SSH filesystem from discarding root permissions after every command?

i have a small bash script that mounts my sshfs... problem is it ask for the server/host password for every mount... i have four mounts and i have to enter it every time for 4 times and its ...