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

learn more… | top users | synonyms (1)

0
votes
1answer
2k views

cannot run java application from a shell script

after download and unzip the zip package, I copy the modelsphere.bat file to modelsphere.sh, and change the content to: java -ms64m -mx512m -ss16m -classpath ...
2
votes
1answer
71 views

Which paging utility is being used?

At a bash prompt, hitting tab twice will come up with a prompt such as Display all 1770 possibilities? (y or n). What paging utility is bash using? It doesn't appear to be less or more. Is it ...
1
vote
1answer
220 views

bash script change a word into a file

I have a file like this: PRODUCT: $name | YEAR: $year | TYPE: $type PRODUCT2: $name2 | YEAR: $year | TYPE: $type2 PRODUCT3: $name3 | YEAR: $year | TYPE: $type PRODUCT4: $name4 | YEAR: $year | TYPE: ...
3
votes
3answers
948 views

How do I use command line arguments in bash?

This script moves all the doc files to a specified directory. I have managed to put an argument but the problem I am facing is putting the full path where the scripts are moving to, for example I want ...
0
votes
1answer
238 views

Is it possible for a directory to change permissions of the files that are added to it?

I have a directory and I want all files that are put in it to have the permissions of **5. In other words I want the permissions of the owner and group to stay the same but the permission to be read ...
1
vote
1answer
483 views

Possible to mangle Bash scripts?

Is it possible to mangle a Bash script such that it becomes unreadable by any human? If so, can it be de-mangled? Or, can I view what commands are being executed when I run the script?
0
votes
1answer
1k views

Using sftp to Transfer a Directory?

When I try to use SFTP to transfer a directory containing files, I get an error message: skipping non-regular file directory_name The directory contains a couple of files and two subdirectories. ...
2
votes
1answer
2k views

How to completely remove a package and all related files/directories?

I'm trying to remove samba, I've tried using apt-get --purge samba Which according to the man page is supposed to delete .conf files. However smb.conf is still there. Any tips on how to remove ...
1
vote
5answers
4k views

How to execute a .sh file when the session starts?

I have a .sh file that I execute just going to the containing folder and writing ./file.sh. I want to execute that file when the session starts, so i create a symlink in /etc/init.d. I expected it ...
3
votes
2answers
151 views

Batch Starting Servers

How I can create a batch alias for bash? I need to do this: cd /somefolder bundle exec unicorn -p 3000 rackup faye.ru -s thin -E production bundle and rackup - this is 2 servers for example I ...
6
votes
1answer
2k views

What's the difference between mkfs and mkdosfs?

I'm trying to put a linux distro .iso on my usb and the instructions suggests using the following command to make a fat32 filesystem: mkdosfs -F 32 /dev/sdc1 Is there a reason this command is to be ...
2
votes
3answers
2k views

How to find out if current shell was loaded by another shell?

When I am in a terminal, and I type /bin/bash, that starts up another bash shell, right? Is it possible to find out, via some command, whether the current bash shell has been started from another ...
1
vote
1answer
4k views

how to completely reformat a usb using fdisk?

I have a usb drive which I would like to put a linux distribution on but it already has some files on it on /dev/sdc1. Using fdisk, I deleted the first partition and wrote the changes. When I ...
1
vote
1answer
2k views

Moving files to different directories

I'm trying to move media and other files which are in a specified directory to another directory, which will be created if it does not exist. And, I'm trying to create a directory where the remaining ...
2
votes
1answer
2k views

How can I set HISTSIZE for all users?

How can I set HISTSIZE for all users on Ubuntu 10.04? I've tried adding the following lines to both /etc/profile and /etc/bash.bashrc. I'm not sure I understand the difference between the two files ...
1
vote
1answer
5k views

Where is the default bash profile file kept?

Under Ubuntu 11.10, where is the default bash profile file for new users kept? I want to edit the default file so that new users get a preconfigured .bash_profile file.
3
votes
3answers
4k views

Is it preferred to avoid use of “exit” in bash scripts as much as possible?

I've been told in php it's preferred to avoid the use of the exit command as much as possible. Is the same true for bash? For example is the following #!/bin/bash if [ -z $1 ]; then echo ...
7
votes
2answers
13k views

How-to make file have different color when doing ls?

When I execute command ls it displays files and folders. folders are typed in light blue. I would like to have xml files types in pink color. How to do it?
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 ...
6
votes
1answer
16k views

Find file or directory in whole directory structure

How can I find a file with a specific name in bash. I want to search through the whole system. I tried with find, but that only work through one level.
11
votes
3answers
25k views

How to execute command every 10 seconds (without cron)?

When I execute cron I get this fault cron: can't open or create /var/run/crond.pid: Permission denied So, how to do it without cron? P.S. I want to check if file in svn has changed and I have a ...
1
vote
1answer
815 views

How to stop executing bash script when there are errors? (if problem)

I build my application using Maven. In my script after I build the app I startup application server. The problem is that if build is not succesfull the application server is started any way. If I ...
2
votes
1answer
324 views

How to prevent terminal from killing process with ctrl+z

I know that you can restore the process by hitting fg and enter after you stop a job with ctrl+z, but I don't think I've ever intended to stop a job.. ever. e.g. I always bump it when typing ctrl+x in ...
9
votes
3answers
9k views

How do I combine multiple grep commands?

I have a command like this: | grep -v @param | grep -v @return | grep -v @Test | grep -v @throws and its getting bigger, is there any way to make this neater?
1
vote
2answers
181 views

How to download code with weird interface

Here is a code for Eclipse Drag and Drop http://www.vogella.de/code/de.vogella.dnd.jface/codestartpage.html I would like to download it, how to do it using wget?
2
votes
1answer
600 views

How to escape spaces in pwd path when creating a Boost build script?

I want to compile Boost with some specific options (eg: using zlib from its latest source) So I try next bash code like: WD=`pwd` #//... cd $BOOST_ROOT_DIR echo_run ./bootstrap.sh #// problem with ...
1
vote
1answer
97 views

Get disk utilization by file-type?

Is there a way to get a break down of a disk (or directory) utilization based upon file-type from the command line? I guess I could write a bash script to find+du based upon a few known file-types, ...
0
votes
1answer
258 views

Line gets overwritten instead of continuing on same line

I have a problem with the bash prompt. When I type a command that exceeds the length of the width of the screen it continues on the same line and overwrites what I have written, and then continues on ...
19
votes
5answers
1k views

How do I teach bash in Ubuntu some curse words?

When bash encounters an unknown command(word?) it does this : The program 'hello' can be found in the following packages: * hello * hello-debhelper Try: sudo apt-get install <selected ...
2
votes
4answers
5k views

Script for an incremental file system backup

I'd like to run the following incomplete script weekly in as a cron job to backup my home directory to an external drive mounted as /mnt/backups #!/bin/bash # TIMEDATE=$(date +%b-%d-%Y-%k:%M) ...
2
votes
1answer
2k views

Applying chgrp “apache” to entire directory failed

I've been tried to change group of the whole directory with code example below [bash terminal on ubuntu 11.10]: chgrp apache -R ./test1 but failed and said : chgrp: invalid group: `apache' user ...
2
votes
1answer
2k views

Typing commands into a terminal always returns “-bash: /usr/bin/python: is a directory”

I think I messed something up on my Ubuntu server while trying to upgrade to Python 2.7.2. Every time I type in a command that doesn't have a response, the default from bash is this: -bash: ...
6
votes
3answers
1k views

How do I set environment variables in an Emacs session launched from Gnome Panel?

My .bash_env file sets several environment variables, including PATH and EMAIL, but in an Emacs session launched from the Gnome Panel (command: "/usr/bin/emacs23 %F") these variables do not have the ...
1
vote
1answer
414 views

My terminal prompt PS1 mixed up

By the way I'm on a Mac OS X but I'm connected to an Ubuntu Server. Yesterday I installed a module for node.js(after a hour I deleted it) which asked me to add something to the .bashrc file and now ...
5
votes
3answers
2k views

Need help with bash checking if computer uptime is greater than 5 minutes

I have an bash script that runs on a every minute cron. It checks to see if a necessary program is running and starts it if it is not. Occasionally it will run before the user has actually autologged ...
1
vote
1answer
9k views

How to get line number from grep?

the fallowing grep grep -r -e -n coll * will display fullpath/filename: <tag-name>coll</tag-name> I would like to know what line has the fallowing text, I tried adding -n, but it ...
3
votes
2answers
1k views

How to create daily job without write access to /etc?

I don't have write permissions to /etc and its sub folders, but even do I would like to have bash script that is executed every morning. How to set it up? also when i type cron in command line I get ...
0
votes
2answers
1k views

How to append text to file every morning?

I would like to append current date to text file every morning at 7am. if the computer is turned off I would like it to be executed after its turned on.
5
votes
3answers
361 views

Bash cannot expand backticks interactively

On RHEL5.2 (bash 2.3.25) I can cd `pwd`/[TAB] and pwd is substituted into my current working directory, using the output of pwd(1). How can I achieve the same functionality in Ubuntu 9.10 (bash ...
2
votes
0answers
558 views

How can I search for the fastest update server on the command line? [duplicate]

Possible Duplicate: How do you select the fastest mirror from the command line? This is easily done through the GUI, but can it be done from the command line? I have a BASH script for ...
2
votes
1answer
287 views

How to make tail -f show time when line was appended?

I'd like to know the time when line was appended when file is being tail -f'ed. Is it possible to configure tail to do something like that?
0
votes
1answer
127 views

help me problem in my shell script

I need back from 2 or 3 to 1 after print error ?? 1 echo -e "program set defulte home dirctory /home/admin/$un" echo -e "DO you want use defulte home dirctory? Yes=1 & NO=2" ...
1
vote
1answer
232 views

bash text processing and error message

for example I have this script that kills firefox ps x | grep firefox | grep -v grep | awk '{print $1}'| xargs kill -9 but when there is no firefox running it spits out: Usage: kill pid ... ...
0
votes
1answer
16k views

why syntax error near unexpected token ' fi '

#!/bin/bash # # # # echo -e "please insert user name :" read un echo "$un" len=${#un} echo "$len" ze=0 te=10 if [ "$len" -eq "$ze" ] than echo "no argument" exit fi if [ "$len" -ge ...
1
vote
1answer
419 views

shell script to insert line into /etc/passwd , /etc/shadow ,/etc/group and save it

Can anyone help me to add one line to any file from this: /etc/passwd , /etc/shadow ,/etc/group exp; username:!!: …. add to /etc/shadow by shell script without vi program
6
votes
2answers
9k views

“command not found” when running “lessc” from bash

I have installed lessc via npm, Node.js Package Manager, and when I run lessc from terminal using lessc /var/www/less/style.less /var/www/css/style.css it works perfectly. However, when I put this ...
2
votes
1answer
206 views

How to swap X-Server with Emacs org-mode?

I'm quite impressed of emacs' org-mode. So I want to use it for note-taking during lectures. To use it "distraction-free" my idea is the following: I want to register a bash-command, which swaps the ...
2
votes
3answers
301 views

Teminal non-responsive on load, can't enter anything until CTRL+C

I have an issue with terminal in Ubuntu 10.04. When I launch it, it hangs, like this: I cannot do anything until I press Ctrl + C: I cannot remember when this started. What can be wrong? Looks ...
4
votes
1answer
5k views

When you run `update-rc.d myscript default` - what is called on startup/shutdown?

What gets called on startup/shutdown when you run update-rc.d myscript default? Docs seem fuzzy, I want concrete. I am guessing that this happens: At startup (specifically at entry to runlevel 2, ...
1
vote
1answer
355 views

How to interpolate a variable immediately after a `$` or `\$` in the bash prompt?

I am using this function: function test(){ local var="hello" PS1="\u\$$var" } The output I am trying to get from the function is john$hello. But what I get is just john. If I add a space ...