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

learn more… | top users | synonyms

0
votes
1answer
370 views

Unable to run test.sh file through project.php inside /var/www/

test.sh's path is /var/www/proj/test.sh, and project.php is inside /var/www/ and my test.sh uses and creates some .txt files. when i execute test.sh through terminal it works fine, but when I run ...
0
votes
1answer
277 views

Having Trouble Sending Arguments To Mintty/Cygwin

Simply put, I would like to have a shortcut on Windows which can open up a terminal window just like clicking the Cygwin shortcut normally does, but in a different location from the default. The ...
-2
votes
3answers
815 views

How to run apache server if it not already running

I wonder if it is possible to check whether or not apache2 is running. If it is not running I want to execute it using shellscript Currently I have added a function which I named run_apache which ...
2
votes
1answer
145 views

Suppress (or quiet) the output of bash: “Hit any key to close this window…”

Typically when I invoke an GUI application in vim, I get a command prompt that awaits for my response: shell returned 1 Hit any key to close this window... How can I not make this prompt to show ...
0
votes
1answer
818 views

gVim does not source .bashrc, .bash_profile, or .profile from non-interactive non-login shell

I have the following on my .vimrc set shell=C:/cygwin/bin/bash set shellcmdflag=-c set shellxquote=\" So the shell I am using is non-interactive and non-login. I thought that non-login shells ...
0
votes
1answer
215 views

How close to death is my Linux hard drive [duplicate]

I want to test my hard disk that is on opensuse 12.2 - update see some results below I have installed S.M.A.R.T. How would you start the tests? note: can I run a single test that runs all the ...
7
votes
2answers
10k views

bash - Sending simulated keystrokes

I've recently been trying to write a script that can be used to automate my c++ program in bash. If you know AutoIt, I can simply show you an example of what I am trying to do: send("1{enter}") or ...
8
votes
3answers
19k views

On Linux, how can I find all files that contain a string and delete them?

I want to delete all files that contain the string foo. How can I do this using bash in Linux?
0
votes
2answers
528 views

Script to auto execute creation of ssh tunnel

I'm a CS student, and still learning a lot of these things, and so please bear with me if I don't have a full grasp on what I'm trying here. I'm on a Mac, connecting to a linux machine. I can set up ...
5
votes
1answer
478 views

TMUX: Configure length of titles

I have tmux configured to show my current working directory for each window (it gets this from bash) The problem is, sometimes the directory names get too long and it takes up a lot of space. In ...
0
votes
0answers
22 views

Loop through folder with higher space usage in shell? [duplicate]

I would like to create an script where give me a report of which folders have the higher usage space and keep doing that until there's no folder anymore. Today I do this manually, with: sudo du -h ...
0
votes
1answer
934 views

how do I preserve export PATH?

How can I make ssh admin@nas command work if command is in /opt/bin? On my QNAP NAS File /root/.ssh/rc: echo "old path is $PATH" export PATH=/opt/bin:/opt/sbin:$PATH echo "new path is $PATH" on my ...
1
vote
2answers
93 views

Newlines while saving variable to file - bash

I have mulitiple ip adresses in a variable. ActiveIPs= 192.168.0.1 192.168.0.2 192.168.0.3 I want to save them to a file like this 192.168.0.1 192.168.0.2 192.168.0.3 how do i do this?
0
votes
1answer
74 views

How to make an alias and work in sh for all users (not in bash)?

My question maybe is silly, but how can I make an alias so as to work in sh for all users? I know that I can put an alias, let say this one: alias ls='ls -l' in /etc/bash.bashrc so as to work in ...
0
votes
0answers
12 views

Bash history lost [duplicate]

My bash history in cygwin is lost between two consecutive shells. Here are the outputs of some commands that might help to understand the issue: set -o | grep history history on $ grep -i ...
1
vote
1answer
49 views

How to print a bash history command and append it to a file?

You can print a command with: !2500:p But how do I append that command to a file? I thought: !2500:p >> .bashrc But that just prints everything including the ">> .bashrc" to stdout.
4
votes
4answers
11k views

No bashrc file in my home directory

Here is what I noted down from my lecture: Find file .bashrc in your home directory do vi .bashrc When you put an application folder somewhere, make sure that its address is in the path variable. ...
5
votes
2answers
2k views

How to persist bash history?

I don't know if this is expected, but my history is not saved across sessions. This is to say, if I close the window, then when I open it again, the history is empty. How can I persist it across ...
0
votes
2answers
431 views

Why does my ssh session terminate immediately?

I have a debian machine, where I have difficulties to log into via ssh. Executing commands on the server over ssh is no problem -- just I get no prompt, but the connection is terminated again: > ...
2
votes
2answers
75 views

How do I investigate commands being run when changing directories?

I see “awk”, “find”, “sed”, and “which” momentarily appear in my Terminal window's title when changing directories.  (And not all of these always appear and there could be some I'm missing; I imagine ...
2
votes
1answer
136 views

Difference between / and // directories in bash OSX

I was working in the bash terminal on my system (OSX 10.8.3 / bash version 3.2.48(1)-release (x86_64-apple-darwin12)) and I accidentally typed "cd //" instead of "cd /" to get back to the root ...
2
votes
1answer
335 views

copied chroot jail directory cant be chrooted

I am developing a package so when users login through ssh they are forwarded to a chroot jail. The jail directory is created via makejail program on building process. But when the jail package copy ...
1
vote
1answer
161 views

bash tab-completion list below prompt

Whenever I use tab-completion, the list of possibilities is displayed and the prompt is duplicated below (| indicates the final cursor position): $ vim ~/.<TAB> ./ ../ .bashrc .vimrc $ ...
0
votes
3answers
2k views

How do you install Bash or Bash utilities on Windows? [duplicate]

How can I install Bash for Windows so that I can use its utilities, such as grep, vim, and gcc with minimal amount of work in editing the environment variables to include them all. I'd like to do this ...
2
votes
1answer
164 views

Opening a Terminal for the current bash script, if it wasn't started in one

How can I get a script to re-launch itself in a Terminal window if it wasn't started in one? Based on this question, I've tried, in a file called testterm marked executable: #! /bin/sh if [ -t 0 ]; ...
0
votes
1answer
74 views

Colorize ls-output by filetype [duplicate]

Every once in a while I have to list some files (~20-50) in Bash on Linux || Mac. These files are from four different file types. ls nand2tetris/myChips/ And16.**hdl** And16.**cmp** ...
1
vote
1answer
374 views

Cron job not abiding by the nice command

I got a script that backs up minecraft worlds, when ran by command (nice -19 ./backup.sh) it doesn't lag what so ever, server load stays low. When I try to do nice -19 ./backup.sh in a cronjob, it ...
4
votes
4answers
5k views

How to use Cmd's tab autocomplete effectively?

I've used the Bash shell on Linux for years and I'm very fast with it. By frequently appealing for autocomplete by hitting the tab key, I'm able to write long commands in few keystrokes. Recently at ...
2
votes
1answer
800 views

Linux: How to eval the contents of STDOUT?

Consider you have a file with some sort of terminal command. How might each line be executed? Can you pipe the output of more into an eval? %> more ./foo.txt Edit: After some help/guidance ...
0
votes
1answer
37 views

Opening a Terminal window with the current directory set to a specific directory

I want to set up a keyboard shortcut in Shortcuts that opens a Terminal window already cd'd to the desktop. I've tried Terminal ~/Desktop Terminal cd ~/Desktop But these don't work. Terminal ...
0
votes
2answers
70 views

Create from bash an image from a Windows / Linux partition

I want to make an image with existing Linux tools from the bash console. Can somebody tell me how to accomplish this task? Let's assume /dev/sda including its master boot records need to be backed ...
4
votes
1answer
890 views

How can I get zsh to display international characters properly?

I just started using zsh, and love it. However, I've stumbled upon an annoyance when it comes to international characters: ➜ ~ touch åäö.txt ➜ ~ ls ...
0
votes
2answers
98 views

Deleting all word occurences with sed preserving linefeed

I'm trying to delete a word's all occurences in a text file with sed. I have this file f1: alma a fa alatt nyari piros alma and I'd like to delete all occurences of "alma". I use the ...
0
votes
1answer
236 views

Citrix-XenApp Error (SSL-Server 61) with FF on OpenSuse 12.2: how to bypass?

good day dear Superuser, I am trying to utilize Citrix XenApp to remotely access my work userid and applications from home. I can login and see my virtual desktop/applications, but when I try to run ...
0
votes
1answer
103 views

cat command outputs the whole directory when used in a bash script

I have a scirpt like this: #!/bash/bin file=`cat /proc/net/arp` echo $file And when I run the script it outputs the whole folder where the script is like this: IP address HW type Flags HW address ...
0
votes
0answers
282 views

Name of Rake task in ps output?

pid = `ps -ef | grep -v grep | grep rake | awk '{print $2}'` This is a bunch of ruby code that executes piped linux commands. While I usually just use ps aux, just because, I noticed that the rake ...
1
vote
3answers
666 views

How to truncate the streaming output of a redirect?

I have a process that outputs a line for every progress update (sidenote: it does clear/replace the line, no pure newline break). I want to save the latest line of that process to an output file or ...
1
vote
1answer
59 views

Load a page without loading a cached page

Here is the situation I have. I have a page that is generated using a bash script (basically echo and some other command >> a html file). I have a link to this page. If I "clear private data" or never ...
1
vote
0answers
213 views

Can't seem to connect to Win 7 share with smbclient 3.5.5 on Haiku

I did the registry mods mentioned here but cannot seem to connect. I say seem to, because there's no error message. smbclient \\\\WIN7MACHINE\\ -U myusername smbclient \\\\WIN7MACHINE\\ -U% ...
-1
votes
2answers
173 views

Replace all numbers following a specific string with another number using sed or awk

I have tried several things but got no luck. I have an input file that has a lot of fields like this one weight=0.123456 mixed with other fields. I want to multiply all such weights by a factor, say ...
1
vote
1answer
446 views

grep with colored output returns several empty lines

I have strange issue with grep (2.12-2, debian testing). In some situations when I do something like this: grep -rni '."spacer">.' . grep return me several empty lines: If I add --color=none ...
1
vote
1answer
782 views

What determines the process name in ps aux?

I'm trying to track down this script called ./launch.sh, that on my machine is currently in an infinite loop in which it calls a Java program, immediately crashes, then sleeps for 3 seconds. ps aux ...
4
votes
2answers
1k views

Bash: find directory group owner

I am sure this is easy but i cant find it. I am writing a bash script where i want to add a known user to a group. The group name is determined by the directory, which is sent through as a variable ...
3
votes
2answers
945 views

Program to check/look up UTF-8/Unicode characters in string on command line?

I've just realized I have a file on my system; it lists normally: $ ls -la TΕSТER.txt -rw-r--r-- 1 user user 8 2013-04-11 18:07 TΕSТER.txt $ cat TΕSТER.txt testing ... yet, it crashes a piece of ...
2
votes
1answer
174 views

ESC and Caps Lock get swapped to original mapping after loading bashrc twice

I followed xmodmap way of swapping ESC and Caps lock in this link. It works well when I load .bashrc with . ~/.bashrc for the first time. However, if I edit different part of my .bashrc and reload it ...
1
vote
1answer
35 views

How to change all occurrences of one character in a group of filenames with another?

I have some OS X files, some of which have hyphens in their filenames. I want to change all occurrences of hyphens to underscores. How can I do this from the command line on OS X? So, if I have ...
2
votes
3answers
679 views

Mail me when someone runs sudo

I have added the below lines to /etc/sudoers.d/my_sudoers Defaults mail_always Defaults mailto="email@domain.com" I get an email every time sudo is run How can i modify this so I only ...
1
vote
1answer
259 views

Inconsistent results using cut on output of ls

I am struggling to understand why I get different output from the same command run on a single file in Terminal (Mac OS X 10.6.8) and run on more than one file. As I want to run the command in a bash ...
1
vote
0answers
616 views

bash autocompletion is slow, freezing my desktop

sometimes when working with a custom kernel, pressing tab in the bash autocompletes at a horrible pace. It freezes the whole desktop. Then comes back after awhile. This is the only quirk that I've ...
1
vote
3answers
187 views

bash: repeatedly executed script in .bash_profile blocks login

I have a bash script (let's call it script.sh) which looks like this while true; do if [ $someFile -eq = "1" ] then # make laptop LED blink here fi done So when some file has some value ...