Bash is a free shell for Unix-like operating systems, from the GNU Project

learn more… | top users | synonyms

2
votes
1answer
2k views

Messed up $PATH variable in Mac OS X

I did something to my PATH. I was trying to add some new path and now none of the command like open ~/.bash_profile work, and echo $PATH only shows one path which is /Application/Filename. Is ...
0
votes
3answers
105 views

Emacs and Shell in the same window?

Just wondering if there is any way to put emacs and shell in the same window. Like split the shell in to two parts, one for shell it self, the other one for emacs. Or is there any way to switch the ...
0
votes
1answer
1k views

Auto log in SSH using expect

I wrote a script to auto login into a remote server. The login data is stored in a database. /usr/bin/expect <<EOD spawn ssh -oStrictHostKeyChecking=no -oCheckHostIP=no $SSHUser@$SSHHost ...
0
votes
1answer
162 views

Bash script dosn't open in terminal on reboot

Quick overview, I have created a script that reboots the laptop after x amount of time and x amount of cycles. I have added the script to the start-up applications and the script does seem to be ...
2
votes
1answer
102 views

bash tail & watch

I have a app server that I start and it writes output to stdout. I want to be able to watch that output and issue a command (in this case growlnotify -m "Server is up") when a specific line is sent ...
4
votes
1answer
52 views

How to filter output from a command in OS X

I am in need to monitor the the writes from an unknown application to a known directory through creatbyproc.d. I'm going to have to leave this up and running for up to 36 hours which will not be ...
2
votes
2answers
80 views

Can I associate my command history based on my cwd

I often navigate between multiple directories in a bash session. Sometimes upto 4. For each directory I am in I often have an exclusive set of commands that I fire and this set can be between 7 and 10 ...
2
votes
1answer
200 views

How can I know if the set -e option is enabled or not?

I'm writing a shell function that will be called from many different places and I want to ignore all errors occurring inside the function disabling the (possibly enabled) set -e shell option, ...
3
votes
2answers
9k views

how to stop cp: overwrite './xxx' ? prompt

How can I stop the cp command from prompting to overwrite. I want to overwrite all the files with out having to keep going back to the terminal. As these are large files and take some time to ...
0
votes
1answer
127 views

file to store the bash settings for a virtual terminal

When You press [ALT+F1...F6] on Linux machine You see "virtual terminal" usually. When I log in via virtual terminal on my Debian machine - bash does not implement settings from $HOME/.bashrc and ...
1
vote
1answer
82 views

Custom prompt doesn't work on Mac's terminal

I like to use a custom prompt (current path in blue) on my unix machine: export PS1='\[\e[0;34m\]\w \$\[\e[m\] ' But when I try to use it on Mac's terminal it doesn't work: it fails to detect the ...
2
votes
2answers
225 views

Custom prompt doesn't work on Mac Terminal

I like to use a custom prompt (current path in blue) on my unix machine: export PS1='\[\e[0;34m\]\w \$\[\e[m\] ' But when I try to use it on Mac's terminal it doesn't work: it fails to detect the ...
1
vote
1answer
189 views

Where is $DYLD_LIBRARY_PATH getting

echo $DYLD_LIBRARY_PATH returns /Library/Oracle/lib but I don't find anything in .bashrc and .bash_profile. I am using Mac OS X 10.8 and I don't have .profile file in my home directory.
0
votes
1answer
106 views

Bash delete file when variable = x

I'm creating a bash script which reboots the system at each reboot it adds a new line to a text file, I then read the text file before each reboot. Once the variable holding the number of lines ...
1
vote
3answers
997 views

bash - test if disk is unparitioned

I'm currently working on a DIY network storage which aggregates free disk space using mhddfs. Now what I want is, for example given a hotswap bay, when I insert a brand new unpartitioned disk, I wish ...
4
votes
3answers
2k views

Sublime Text Editor command not found

I have installed Sublime on my Mac Lion Laptop, and followed the guide here http://www.sublimetext.com/docs/2/osx_command_line.html but as always it did not work. I dont have a ~/bin directory on my ...
4
votes
2answers
2k views

Configure Console2 to open bash in current folder

I've seen this but it doesn't work for me. I'm not using Git's version of bash but the one that comes with cygwin, so that could be part of the problem. Here is how I have my tab in Console2 set up: ...
3
votes
1answer
56 views

Why am I not able to add directory in linux $PATH

I am trying to add ~/.bin into my path and for that I edited the .bash_profile and added the below line PATH=$PATH:$HOME/.bin/ and than I logged out/in. Now when I do echo $PATH I get ...
0
votes
3answers
775 views

How to make bash aliases available as linux commands?

I have many bash aliases on a remote location. But when I try to run those from my local linux box, I get the 'command not found' error. e.g. $ ssh root@remote 'status' bash: status: command not ...
0
votes
0answers
141 views

Will my weekly cron job work?

I'm just getting back into bash scripting and I want my cron job to run every 15 minutes between 9.15 and 10 PM. I've checked the script works, but I don't know if it's the right command: ...
3
votes
1answer
536 views

Run script on login with ssh

I have a feeling this is quite easy to do but every solution found on google has to do with adding a script to be run whenever someone logs into the machine. What I am looking for is a way to run a ...
1
vote
3answers
1k views

windows CLI looking like ubuntu terminal [closed]

How can I make my windows 7 command line interface to look like the terminal in Ubuntu ?
1
vote
2answers
250 views

Edit the command line path for an executable on OSX [duplicate]

Possible Duplicate: What are PATH and other environment variables, and how can I set or use them? I have the default package of Ruby installed that shipped with the OS, which is an older ...
1
vote
1answer
30 views

Console hotkeys

In text editors i like to use hotkeys: ctrl+arrow, ctrl+shift+arrow, ctrl+shift+(end|home). Is any way to do this in console? Im using /bin/bash, I know it was many other shells, but I know about ...
1
vote
1answer
36 views

Command to get to bottom of tree

Is there a Linux command that will return the file path of the bottom most dir. I've tried the following commands: find ...
1
vote
0answers
40 views

Making M-u, M-l, and M-c apply to whole words in readline

This is what I've come up with so far: "\C-\eU": upcase-word "\C-\eL": downcase-word "\C-\eC": capitalize-word "\eu": "\C-f\eb\C-\eU" "\el": "\C-f\eb\C-\eL" "\ec": "\C-f\eb\C-\eC" Is there some ...
1
vote
1answer
40 views

Why is which not matching the effect I get?

I cannot explain the following behavior: [centos4x64 ~] /usr/local/bin/gmake --version GNU Make 3.82 Built for x86_64-unknown-linux-gnu Copyright (C) 2010 Free Software Foundation, Inc. License ...
0
votes
4answers
136 views

how to access homedir by root user

I want to access root user's home directory /root/. However following commands dont lead me to the root directory. sudo -s cd ~ It leads to the home dir of regular user. How to access /root ...
1
vote
1answer
931 views

colouring output of ls according to file extension

I am working on some C++ files all of which are in a single folder. When I do ls both the .cpp and the .h files show up in the same colour. Is there a way to tell the bash shell that I want to ...
2
votes
1answer
279 views

Weird file truncation issue in CIFS mount

With reference to: http://stackoverflow.com/questions/12211629/php-file-put-contents-not-truncating-file-in-cifs-mount We have a Seagate BlackArmor NAS device, which is mounted on our Ubuntu 10.04 ...
4
votes
3answers
8k views

How do I change my default shell to bash if I don't have access to chsh nor /etc/passwd?

I'm working on a university remote Linux account, and the default shell is sadly csh without tab completion. How can I change my account's default shell to bash? chsh is not available.
2
votes
5answers
803 views

How to mv dot files without including the parent directory on linux/mac? [duplicate]

Possible Duplicate: Can I keep . and .. out of .* expansion? I know about mv * ~/whatever mv .* ~/whatever but that tries to move . and .., which just caused me a bunch of pain. Is there ...
1
vote
1answer
4k views

Howto switch / chage user id witin a bash script to execute commands in the same script?

Is there a way to switch user identity within a script (executed as root as part of an installation process) to execute some commands without calling an external script, then return to root to run ...
2
votes
2answers
205 views

How do I count the bytes outputted by another program in Bash/Linux?

Say I have a program that writes to a bunch of places on the filesystem. It runs from a single executable. I want to determine, at any point in its run (it runs for a long time), how many bytes it has ...
3
votes
1answer
133 views

Why does cd print when run in command substitution?

If I use the 'cd' BASH built-in in a command substitution, it prints extra stuff to stdout, but only when piped to, eg., less. $ echo `cd .` # The output is a single newline, appended by echo. $ ...
2
votes
2answers
338 views

concatenate files including path in header - path contains spaces

I have to concatenate a number of files in a directory structure which contains spaces in the folder names looking like this: ./CH 0000100014/A10/11XT/11xt#001.csv find . -name "*.csv" -type f ...
2
votes
1answer
38 views

How do I install an icon with an underscore in its name with xgd-menu?

The image file is here, named it 'An_Icon.png' and saved it to ~/Desktop . I used the following commands to install it to my menus: xdg-desktop-icon install --novendor ...
2
votes
1answer
399 views

Bash filename tab completion

I have noticed sometimes that tab completion is helpfully filtered in bash. I am a java programmer and often use the java and javac commands in the terminal for quick or remote tasks. Say I have the ...
2
votes
1answer
573 views

How to change the color of particular file type in bash shell in linux?

My problem is that there are several file types in one directory and i don't want to create different directories for each file type. I have .c files , .cpp files , and .pl files. Is there any ...
3
votes
1answer
159 views

Linux terminal - frozen update of input but can execute commands?

How do I restart a shell session from within SSH when it looks something like this: anton@ubuntu:~$ c: command not found anton@ubuntu:~$ lib ...
2
votes
3answers
1k views

how to run screenfetch as a command?

I have the latest executable screenfetch-dev in /Users/gav/scripts/ folder. I can execute it fine by running /Users/gav/scripts/screenfetch-dev But how do I make it a command, so I can just type ...
1
vote
2answers
265 views

Mac - every command outputs 'Process completed'

(2009 MacBook Pro running Snow Leopard — OS X 10.6.8) I believe this is related to installing MacPorts today — although the other thing I did before I noticed any symptoms was install a trial of ...
1
vote
2answers
627 views

Prefix time to each line of bash command output

I am running the top command to see details about specific processes. The output is piped to grep like so: top -n 1 | grep jre The output is usually around 4 lines, and I would like to prefix the ...
3
votes
1answer
59 views

Checking pids under all users and re-launching the processes after reboot

Is there a way to check all pids of all users under /home directory, and to run these processes again after a reboot or shutdown? For example, if user1 was running a psybnc and user2 was running an ...
0
votes
2answers
311 views

how to escape the ' in ssh?

I need to escape the ' in this command for ssh exec grep IPADDR /etc/sysconfig/network-scripts/ifcfg-eth0 |awk -F= '{print $2}' How do I escape that? I currentl y have this which does not work ...
1
vote
2answers
213 views

how to escape this so it runs of ssh exec

I have the following bash which works export READ=$(cat /opt/TOKEN.txt);echo "initial_token: $READ" >> cassandra.yaml I need to escape this so it runs over ssh properly so I tried the ...
1
vote
1answer
133 views

Delete specific line from hosts

I want to delete specific line from hosts file in my home dir: ~$ echo "193.10.1.1 localhost" >> hosts ~$ echo "127.0.0.1 localhost" >> hosts ~$ cat hosts 193.10.1.1 localhost 127.0.0.1 ...
0
votes
1answer
1k views

linux shell installing packages automaticc

I want to install packages automatically by running a script I can write yum install php but I want it to install another package once installation of the php package is completed Is there any ...
3
votes
1answer
803 views

zsh alias with default argument, but also overridable

I currently have a zsh alias setup like so. alias e="subl" This lets me e somedir to open up a directory in SublimeText. or e . to open up the current directory. However, I would like to be able ...
2
votes
1answer
170 views

IP GeoLocator. Need included script to take source of IPs from txt document

Below is a shell script I would really like to be able to feed a txt document of IP addresses to determine countries accessing my website. Inside the text document, lets call it "IPlist.txt" might ...