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

learn more… | top users | synonyms

0
votes
1answer
141 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
668 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
154 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
71 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
304 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
3k 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 ...
1
vote
1answer
620 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
69 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
490 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
95 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
187 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
91 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
214 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
479 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
57 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
184 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
143 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
360 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
665 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 ...
3
votes
2answers
989 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
681 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
125 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
34 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
458 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
175 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
502 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
157 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 ...
1
vote
5answers
3k views

Linux/Bash, how to schedule commands in a FIFO queue?

I want the ability to schedule commands to be run in a FIFO queue. I DON'T want them to be run at a specified time in the future as would be the case with the "at" command. I want them to start ...
2
votes
2answers
792 views

Why can I only suspend using Ctrl-Z in screen under Cygwin?

I'm using Cygwin with ConEmu in Windows 7. I can't suspend programs in bash using Ctrl-Z unless I'm using screen. I've seen suggestions to use mintty, and that works, but I'm not sure why it makes a ...
4
votes
3answers
4k views

Copy and chmod/chown at the same time

I have a log file owned by root that I want to copy into a directory owned by another user for him to analyse it (it must be uncompressed first). Currently I'd have to # cp log.xz ...
2
votes
2answers
368 views

Exclude files in a for loop

I want to delete the /lib directory inside apk files. I managed to do this with: for DIR in ~/ABC ~/ABD do cd $DIR for APK in * do if test -f "$APK" then zip -d $APK ...
1
vote
1answer
324 views

Save login and password in secure location accessible from bash script

could anyone please list some options to save a set of credentials somewhere on a server where a bash file could access them? The script needs the credentials to log in to a server and collect data. ...
0
votes
2answers
3k views

Rename a question mark (?) in filenames

With rename it is possible to bulk change filenames. I managed to get rid of all + with this command and replace them with underscores: rename 's/\+/_/g' * I could change normal letters like a to ...
0
votes
1answer
124 views

How to configure secureCRT to remove content display after quit from vim

Open a ssh or telnet connection in secureCRT 6.0 or 7.0, when "vim xxx.txt", after quit vim by ":q", the content of xxx.txt will still be visible in screen. But in putty, the same operation, content ...
1
vote
3answers
94 views

Determine location of an alias in Unix (or Mac)

I have a Mac at work and my coworker set up an alias for me so that when I type git-tf at the command prompt it runs /opt/git-tf-2.0.1/git-tf. However I'm not sure how he did this. My $PATH variable ...
1
vote
1answer
126 views

Windows SymLink Questions: How do I tell if a file is symlinked /

I'm not exactely sure how to phrase my questions, I'll describe what I'm doing, perhaps my misconceptions will show. I'm on windows 7. I symlinked files that I'm working on in a project to a sandbox ...
1
vote
1answer
739 views

How to Grep up to a certain character or String

I need to extract log data from many terrabytes worth of log files. The thing is, the data I need starts and ends with patterns I can identify, but the code between can be anything between 10 and 100+ ...
1
vote
3answers
304 views

bash: run command multiple times with list of values

I need to run a command several times, each time with a new value: grep VALUE0 myfile.txt grep VALUE1 myfile.txt grep VALUE2 myfile.txt Because the grep command is "crafted" ad hoc (not always the ...
2
votes
2answers
131 views

How to look at the past directory history the shell was in?

Sometimes I like to look back in the command history to figure out what I was doing. Sometimes it would help to know what the cwd was for each command. So, I'm wondering if there's some way to track ...
0
votes
1answer
417 views

Command line in OSX breaks when I edit bash_profile

Please help me, I am learning how to add sublime to command line from this link and when I created .bash_profile file, in the first line I typed export PATH= and saved it. My command line is broken. ...
0
votes
1answer
103 views

OS X - Adopt “command not found” behavior from Ubuntu

There is a question about overriding the default command not found behavior on Ubuntu. It is Here. I tried adding the following to ~/.bash_profile, /etc/bashrc and /etc/profile, but no luck: function ...
0
votes
1answer
159 views

how to compare negative floating points in bash

We tested our script and it fails on negative floating points comparison in bash. What are we doing wrong ? $F1=10000000000 $F2=300 FLP=$(bc <<< "scale=5; ($F2 - $F1)/$F2 * 100") if [ $FLP ...
0
votes
3answers
76 views

how to remove a file in /etc when rc.sysinit is executing?

I want to remove a file when rc.sysinit is executing I've written something like following : yes | rm /etc/anImportantFileWhichBelongsToSystem I guess the parent user for executing rc.sysinit is ...
2
votes
2answers
156 views

Can I highlight my user name in top/bash?

I often use top under bash. I would like to highlight (in color, bold or other form) my user name, so that I can more easily find it in top. (Sometimes it's difficult with many users running lots of ...
1
vote
0answers
151 views

bash add array to plist

I'm making a installable package via Cydia that will write com.intelliborn.intelliscreenx to this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" ...
0
votes
2answers
87 views

Changing directories in Bash shell with large file names

I have to navigate through a series of directories containing software installers. I've written a small bash function that gets me to the main folder that contains all of the builds, but the file ...
0
votes
1answer
65 views

Is it possible to make the environment ignore $http_proxy env variable for certain urls?

In Firefox, I can set a proxy for all URLs except certain domains. Is it possible to do the same with the http_proxy environmental variable? That is, could I set another variable to exclude certain ...
0
votes
1answer
190 views

Ubuntu issues with $BASH_VERSION and new user

I'm logging into my new Ubuntu VPS via SSH from a terminal in Ubuntu desktop. I have created a new user adam, which I've added to the sudo group, so I don't have to log in as root all the time. When I ...
0
votes
3answers
115 views

Grep for This and NOT That in a File?

How can I grep for files in a directory structure that have this text addDesignControlChangeNotification but are missing this text removeDesignControlChangeNotification Thanks! Note: I mean the ...