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

learn more… | top users | synonyms (1)

3
votes
1answer
652 views

Load configuration from XML (Xfconf)

I'm trying to make an app to switch your XFCE4-Panel's layout between 3 layouts. I applied those layouts and copied the XML file where Xfconf stores its configuration for the panel. The general idea ...
2
votes
3answers
3k views

Install C Shell in Ubuntu 11.04 Terminal Temporarily

One of my friend wants to use C Shell in Ubuntu 11.04 Terminal instead of Bash Shell for sometime, Is there any way to do it without affecting System in any way?
1
vote
2answers
3k views

How do you run a java program from a bash script?

I am trying to run a minecraft server from a "run.sh" script. So far I have this: #!/bin/sh java -Xms512M -Xmx2048M -jar minecraft_server.jar nogui I'm running the script from the same directory as ...
6
votes
3answers
424 views

How do you get details from the output of the locate command?

When I run the ls -l command I get details about the files in the current directory like permissions, owner, group, file size. Is there a way I can get these same details instead of just the ...
1
vote
1answer
1k views

How to change putty color scheme on linux user basis?

When I ssh into my server all but one of my users has the color scheme. The one that doesn't, well everything shows up as gray text. Is there a way I can change this color scheme? Also, why would ...
1
vote
1answer
108 views

Bash Evaluation

I know that in Bash if statements can be evaluated with expr by using: if [[ 5 > 0 ]]; then echo true; fi How does Bash evaulate the following form of if? if [ 5 -gt 0 ]; then echo true; fi
29
votes
6answers
69k views

Bash remove first and last characters from a string

I have a string like that: |abcdefg| And i want to get a new string called in someway (like string2) with the original string without the two | at the start and at the end of it so that i will ...
15
votes
4answers
4k views

What file system do I have installed?

Is there any way to check it from command line?
3
votes
3answers
9k views

Fast way to create gui for bash app

I want to build a simple GUI for an app that use bash so for example clicking on a button would execute some bash commands and so one. There's a GUI creator also simple, i need only buttons and ...
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
215 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
934 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
235 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 ...
7
votes
1answer
15k views

How can I make my shell scripts run in a new console automatically?

Hello I am running Ubuntu 10.04 and learning the ROS (Robot Operating System) which means that I enter quite a lot of shell commands I am currently creating some BASH script files to make my work ...
1
vote
1answer
468 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?
3
votes
3answers
1k views

what type of path in bash is more preferable

In bash file first line should specify the path to interpreter. But on different servers Linux, Unix, or BSD this path could be different. What is more preferable #!/usr/bin/env bash or ...
0
votes
2answers
3k views

How to get samba (computer 1) to show up on windows 7 (computer 2) if both are in the same lan?

Sorry for the newb factor but I have two computers (one linux, one windows). I followed this directions on this website. And have been able to make it past the last step without any problems: ~$ ...
22
votes
7answers
41k views

Can you set passwords in .ssh/config to allow automatic login?

I'm using ubuntu 11.10. I'm using ssh for connecting to many servers daily, so i put their parameters in .ssh/config file; like this : Host Home User netmoon Port 22 HostName test.com Is there a ...
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
1answer
956 views

Why ubuntu does not have /usr/bin/bash

this is not a problem, just curious: Why ubuntu does not have /usr/bin/bash ? as link to /bin/bash or other direction.
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
150 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 ...
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 ...
26
votes
3answers
29k views

apt-get autocomplete package name is broken

At some moment apt-get install autocomplete was broken It was very useful to me to see packages name with Tab press How to repair this autocomplete?
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 ...
4
votes
4answers
8k 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 ...
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
3k 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
4answers
449 views

What do the paranthesis and $ sign mean in echo $(ls)

The output of # ls and # echo $(ls) are the same. What exactly does the $ sign and the parenthesis mean? Also, what is going on a technical level that causes the output of these two commands ...
7
votes
2answers
12k 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?
5
votes
3answers
13k 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 ...
9
votes
2answers
35k views

Compress in .tgz

I want to compress files in .tgz. I know how to make tar.gz(with tar and gzip) and some people say it is almost the same, but I need to make a .tgz, how??
3
votes
2answers
852 views

Check connection and reconnect wifi [duplicate]

I'm building a wireless photoframe. The one thing I haven't been able to figure out is how to get my wifi connection back up using a recommended method. Right now I edited /etc/network/interfaces so ...
6
votes
1answer
5k 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?
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.
3
votes
2answers
7k views

How can I install a specific older version of Firefox and keep it from automatically updating?

I wrote a bash script to configure a suite of tools for continuous integration on top of Ubuntu 10.04.2. The script recently stopped working and I tracked the problem down to the newer version of ...
1
vote
1answer
146 views

How to make error message?

When I execute bash script in eclipse the error output is written in red text. I have some behaviour in my code that is letting "user" know that error has occurred, how to make in error look like ...
11
votes
3answers
24k 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
809 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
316 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 ...
2
votes
1answer
590 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
2answers
177 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?
9
votes
3answers
8k 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
1answer
94 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
256 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 ...
2
votes
2answers
533 views

Why “cd ..” doesn't work in this if

pwd | grep 'database$' if [ "$?" = 0 ]; then echo "has db" cd .. cd .. echo "after has db" fi after I execute it I see has db after has db and I'm still in the same dir, how to fix it?