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

learn more… | top users | synonyms (1)

2
votes
2answers
457 views

How to Tab-complete directories when in symlinked directory?

I have a symlink: /path/to/foo -> /path/to/bar/foo When in /path/to/foo I might want to cd to /path/to/bar/foo: $ cd ../ Tab Then nothing autocompletes. I can still cd just fine by typing in ...
3
votes
1answer
508 views

How would you unsuspend a computer using a bash script?

How I can unsuspend my computer with a bash script like: #!/bin/bash pm-suspend sleep 10m {unsuspend command}
2
votes
0answers
666 views

Why doesn't duply work when set as a cron job?

I have a problem with a cron job which starts but doesn't complete. Running the command manually works fine. I already read the page about cron issues and solutions here on AskUbuntu, tried the ...
3
votes
0answers
815 views

Run a script from Django view as root without asking for password [closed]

I need to run a script (text.sh) that needs sudo, without inputting password, for example: sudo apt-get update >> /home/derp/test.txt I have modified my sudoers file like this: # This file ...
5
votes
1answer
16k 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 ...
0
votes
1answer
473 views

Attempting to GREP details of a Java error

I'm running Ubuntu 11 and I'm having some issues with grep. I have a shell script (see below) which essentially checks if a certain Java program of mine is running, if not it runs it. That part works ...
19
votes
2answers
5k views

How does this [t]ricky bracket expression in grep work?

I saw this one-liner recently: $ ps -ef | grep [f]irefox thorsen 16730 1 1 Jun19 ? 00:27:27 /usr/lib/firefox/firefox ... So it seems to return the list of processes with "firefox" ...
3
votes
2answers
3k views

Run Bash Script as Root

Is there some way I can run a Bash script as root without being prompted for a password every time? I'm attempting to automate the process of starting my LAMPP install, which requires me running a ...
1
vote
2answers
5k views

Passwordless su in a Bash script?

I've run into a dilemma while migrating a Hadoop installation from Oracle Enterprise Linux to Ubuntu. The prior developer put the following command into rc.local within OEL: su reporter -c "cd ...
0
votes
1answer
4k views

Bash script throws “syntax error near unexpected token `}'” when run

I am trying to write a script to monitor some battery statuses on a laptop running as a server. To accomplish this, I have already started to write this code: #! /bin/bash # A script to monitor ...
3
votes
3answers
5k views

Why does `cd downloads` fail with “No such file or directory”?

Running Ubuntu 12.04, while in a terminal, I type ls and see list of folders, including the downloads folder. I then type cd downloads, press enter. I get bash: cd: downloads: No such file or ...
3
votes
1answer
285 views

lower-case 'c' key not working in bash

This is a bit of a strange one. I'm running Ubuntu 12.04. It's been working well but today, I ran into a hell of strange phenomenon. I can no longer type a lower-case 'c' in bash. At first I thought ...
12
votes
5answers
13k 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 ...
5
votes
3answers
779 views

How do I list the public files in my home directory? (mode 777)

I want to get the list of all the files in my home folder, having rwx (read-write-execute) or 777 permissions for everyone. Also, what is the command to know the permissions of a file?
0
votes
1answer
195 views

How to programatically fetch the download status of Google Chrome?

How would I go about determining if Google Chrome is downloading something, and getting the "percent-done" value of that download, from the terminal using a Python, Perl, or Bash script?
0
votes
2answers
1k views

How to install old version of ffmpeg?

I'm having trouble with the current release of ffmpeg, it transcodes .mp3 to .wavs in a format that is unsupported by my client. How can install this version? ffmpeg version ...
10
votes
5answers
13k 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 ...
4
votes
1answer
503 views

Difference between launching an application from a keyboard shortcut vs the terminal?

What I have observed: When I type emacs in gnome-terminal, it launches in the same environment, with variables set in .bashrc. If I use a keyboard shortcut to the command emacs, it opens in an ...
3
votes
0answers
473 views

Problem with using wmctrl to arrange windows in compiz [closed]

I'm trying to write a bash script to control the arrangement of open windows on a particular viewport and have run up against a problem which is basically I can't find a way to reposition the windows ...
0
votes
1answer
37 views

Bash error suppresion

I'm using PHP script from cli, the script calls exec() few times. There are some minor errors sometimes, which are handled by php script. I'm suppressing the errors by appending 2>/dev/null to the end ...
4
votes
1answer
20k views

useradd: cannot lock /etc/passwd; try again later

Trying to add a user: useradd -c "test" -d /home/bbbbbbbb -e "01-jan-2013" -f 10 -g admin -p secretfgjdhdgd -s /bin/bash -u 123456 blobblob but getting: useradd: cannot lock /etc/passwd; try ...
3
votes
1answer
390 views

launching a program from bash causes bash to go to new prompt

When I run a program from the console, e.g. me@box:~$ firefox I expect the console to log error messages (I think this is std out or std err?) and other items from the program, firefox in this ...
3
votes
2answers
53 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
13k 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?
10
votes
1answer
995 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
141 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
947 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
9k 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 ...
28
votes
3answers
20k 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
289 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
1k 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
200 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
6k 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
1k 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 ...
10
votes
4answers
5k 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 ...
43
votes
3answers
92k 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
268 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
666 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
246 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
4k 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
4k 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
915 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
281 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 ...