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

learn more… | top users | synonyms

0
votes
4answers
294 views

bash - directories ending in . and whitespace cannot be removed

On my external hard drive are two directories, Fun. and Complex_, where that _ is a whitespace. I cannot empty from my trash or remove them with rm -rf and I want to. Neither show up in Finder on ...
0
votes
1answer
241 views

Find files containing text in the name and move saving permissions to another folder

I've got asterisk srecords in mp3 format with naming like 13-07-31__09-32_205_988007007757.mp3 in /etc/asterisk/record I need to select files, containing, for example *_205_* and move them to folder ...
1
vote
3answers
425 views

Ignore NTUSER.DAT files when ls on Git Bash?

I use Git Bash as my terminal on Windows. When I ls in my Home directory, I see some NTUSER.DAT entries, which I assume are system files. They don't appear when I run dir in the default Windows ...
0
votes
1answer
876 views

useradd denies home directory creation Ubuntu 13.04

I'm trying to set up a git user, but am getting the error useradd: cannot create directory /srv/data/git when running this command sudo useradd \ --create-home ...
3
votes
2answers
150 views

useful or useless use of cat in input

In my mysql restore script I use a mysqldump file previously created for input. This filename is provided on the command line as an argument and may or may not be gzipped. I want to use the file as ...
0
votes
1answer
150 views

Can you repeat last command with flags in bash?

Is there a way to repeat your last command with additional flags? Example: Say I do this: rm myFavouriteDirectory I will get a reply: rm: myFavouriteDirectory/: is a directory Obviously what I ...
1
vote
4answers
567 views

Clear terminal output of last command only

Rather than scroll past hundreds of lines of output to see the previous command history, can the output of the last command be cleared? E.g. after executing ls, clear its output because you don't ...
0
votes
1answer
336 views

“history position out of range” when calling history from bash script

I want to make a simple script to delete a line from bash_history, based on user input of the line number. echo -n "Delete History Line Number: " read num history -d $num The error is "history ...
3
votes
2answers
525 views

Dowloading all Urls accessible under a given domain with wget without saving the actual pages?

Hi trying to determine all the valid urls under a given domain without having the mirror the site locally. People generally want to download all the pages but I just want to get a list of the direct ...
3
votes
1answer
4k views

Bash: Reverse DNS Lookup of Active IP Addresses

I have a one-line command that lists the top 10 most active IP addresses from a web server access log: cat access.log | awk '{print $1}' | sort | uniq -c | sort -n | tail -n10 A sample result set ...
2
votes
2answers
366 views

Vim is not using Bash's aliases

I am trying to set up Vim so that I can compile C code directly from the editor itself: .vimrc: let $BASH_ENV = "$HOME/.bashrc" autocmd FileType c map <F6> :!gcc -o "%:p:r.out" "%:." ...
1
vote
1answer
162 views

Bash conditional redirection when testing/debugging

What is the best way to conditionally do a redirection in Bash for testing and debugging purposes? In my scripts I add a debug option to show what would have happened effectively doing a test run ...
2
votes
0answers
76 views

SoX fails to concatenate *some* newly generated aiff files

I have a Python script that is using Mac OS X's built in speech synthesis API to create aiff files of some processed text via PyObjC/AppKit. Everything is working fine, but I can't get the aiff files ...
7
votes
1answer
11k views

How can I get the scp command to overwrite the destination folder

I am using the scp command to copy some files to a remote pc, as you do with scp :) I note that the default behaviour of an scp copy for files is to overwrite any existing files. Now I want to copy a ...
3
votes
1answer
183 views

How to clone IO from one terminal to an other

I am connected directly (tty1) and through ssh (pts/0) to my linux box. who pi tty1 2013-09-23 11:33 pi pts/0 2013-09-23 12:17 (192.168.1.26) I'd like to redirect all ...
1
vote
0answers
48 views

Script to port specifc data from doc1 (notepad++) to specific place(s) in doc2

I really appreciate your help with a windows script or regex function that ports specific data from doc1 (xml in notepad++) to specific place(s) in doc2 (notepad++). I'm running win8. Thank you in ...
2
votes
1answer
192 views

How hex command becomes rm -rf ~ / &?

How does the following malicious command become rm -rf ~ / & when compiled? char esp[] __attribute__ ((section(“.text”))) /* e.s.p release */ = “\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68″ ...
1
vote
2answers
364 views

Linux/SSH - get EC2 instance to read local .bashrc file

I have a custom .bashrc file with color codes locally on my Linux machine running Ubuntu 12.04 for both my user and root. I connect to Amazon EC2 instances daily running the same distro and would ...
0
votes
1answer
397 views

Logrotate append to existing file and truncate original

Is it possible with logrotate to take the content of a log and add it to an existing file? Like so: 1. Put the content of /var/log/vnc.log after the content of /archive/logs/vnc.log 2. Truncate ...
3
votes
0answers
264 views

bash column command confused by ANSI color escapes

I have a bash script I got from Gary Bernhardt's dotfiles that prints a nice colorized listing of the recent git commits. It uses the column command to line the output up into columns. On my mac, it ...
2
votes
1answer
204 views

How to properly restore settings when running a script using “source”?

I'm writing a script that needs to be executed using source, because its task is to modify the environment. During the script, I want to use set -e so that any error stops the script. The script looks ...
1
vote
1answer
115 views

list screen window number bash

I was wondering if there is a way to get which window number of screen that is active? As in: screen -X get-window-number I have found no way to list screen windows to output, only the actual screens. ...
6
votes
2answers
655 views

How do I make my script ask for a password, like sudo?

I am writing a script which would be potentially dangerous if run in the wrong way. As a safety feature, I want the script to require the user to re-enter their password first, much as sudo does. So ...
2
votes
1answer
221 views

How to get a bash prompt in a ssh tunnel with rsa keys?

After setting client and server with the public keys and allowing PubKeyAuthentication yes, I issue the following command and get a shell that waits indefinitely. mad@amd:~> ssh -T ...
2
votes
1answer
169 views

How can I attach a cygwin script to a keystroke?

I have a script that needs be launch through Cygwin with the following execution /usr/bin/bash -lic "/home/userdude/scripts/scrypty.sh param1 param2" How would I go about setting up a keyboard ...
3
votes
1answer
706 views

Open multiple terminals in a for loop in bash

Recently i changed to lxde on Ubuntu. And after switching it changed my x-terminal-emulator to lxterm. My script was doing the following: Go through a for loop and open a new terminal window and ...
1
vote
1answer
557 views

Split window programmatically with iTerm?

on my development workstation I often have to start the same commands every morning. zeus start, zeus server (booting rails via zeus), redis-server, and like 3 others. I know a lot of people would ...
1
vote
1answer
134 views

SNMPGET/WALK Timeout on Printer

I have an HP LaserJet CP5225n printer that I am using to test SNMP on our network. I'm new to SNMP so I am having trouble figuring out what's going on here. I'm just trying to return the Device name ...
2
votes
1answer
412 views

Delete all file except some in bash, without cd to the directory?

I need to make a daily cleanup in a download directory. I have saw this question and tested the answer rm !("test 1"|"test 4") It work great, but require to have cd to the directory before. Since ...
1
vote
2answers
106 views

Filtering input with sed (regex)

I'm having an issue with sed not returning what I expect when using a regex pattern to clean up some output from a mysql query. mysql -uroot -p -e 'SELECT `path` FROM db.media_gallery' | sed -n -r ...
3
votes
2answers
305 views

restrict rsync (or bash script) to a directory

After a bad accident with rsync deleting wrong files due to wrong destination parameter, I want to restrict rsync (or the bash script running it) to be able to delete/modify files only under a certain ...
1
vote
1answer
120 views

Changing chmod flags back

I'm fairly new to the whole UNIX / command shell sort of stuff, so I apologize for any ignorance for something I am not aware of. And by new, I mean extremely new. I was confused by how to change a ...
0
votes
1answer
191 views

head hangs or doesn't terminate on Linux

I'm using, (uname -a says) Linux ip-x-x-x-x 2.6.21.7-2.fc8xen-ec2-v1.0 #1 SMP Tue Sep 1 10:25:30 EDT 2009 x86_64 GNU/Linux. I've got a script, foo.sh with 100 lines of code and when I run head ...
1
vote
1answer
493 views

FreeBSD csh style history auto completion in bash

I am looking for a way to make it so that my ubuntu bash shell has the same kind of history completion as you get with csh in FreeBSD. The behavior is that on the command line if i start to type ...
1
vote
1answer
1k views

Ubuntu 10.04 using ssh without entering my password

I know questions like this have been asked before, and I have read them all (that I found). The problem I have is that we have an embedded linux device that we can log into for debug purposes by ...
1
vote
1answer
647 views

Bash script fails from Windows 7 task scheduler

In order to use rsync I created a Bash script. It runs fine from the Cygwin 32-bit shell in Win 7 but fails when run from the Win 7 Task Scheduler. My Task Scheduler script is a simple: ...
1
vote
1answer
3k views

Check to see if NGINX is installed on UBUNTU

Is there any or command to check whether NGINX is already installed on UBUNTU Linux using a bash command/script? I was trying something like this echo "BEGINNING INSTALLATION OF NGINX WEB SERVER" ...
0
votes
1answer
396 views

Command-line scp doesn't use case-insensitive autocomplete

Auto-completing filenames (by pressing TAB after first characters of the filenames have been written) is case-sensitive both on my Ubuntu 13.04 box and on my Debian Squeeze box, when I use scp. I ...
0
votes
1answer
266 views

Bash Script can't find command while command can be executed in my bash

I have a Python script that i want to restart if it crashes. So i created a Bash starter script that starts and restarts the Python script in /usr/local/bin/starter Here's the starter script: ...
4
votes
1answer
414 views

Vim process stops after executing an external command

I've been using vim recently to program in C. I have created shortcuts for compiling and running the programs from within vim itself, but recently vim's process has been stopping after executing the ...
1
vote
2answers
275 views

Stdout and stderror in CentOS

I am exec command: yum info mcrypt | grep -i error > /dev/null yum info mcrypt | grep -i error 2> /dev/null But i see: Error: No matching Packages to list How I can hide this messasge ...
3
votes
1answer
595 views

Using sed to enable .htaccess files in Apache config

I am trying to automate the provisioning of an Ubuntu Vagrant box with a Bash script. All is well, but I am having difficulty with configuring Apache to allow overrides from .htaccess files. In my ...
0
votes
4answers
533 views

$PATH is not updated

It seems all about this was already discussed, but I can't resolve my problem. I have all necessary strings in /etc/paths /usr/bin /bin /usr/sbin /sbin /usr/local/bin in ~/.bash_profile export ...
0
votes
3answers
264 views

How to locate where is this mentioned in bash

I removed rvm but now every time I do ls I get this message: -bash: /usr/local/rvm/scripts/initialize: No such file or directory It looks like it's still calling it from somewhere but can't seem to ...
2
votes
1answer
339 views

Programs detecting pipe on its output to disable coloration

Some programs have a colored output (such as grep or emerge on my gentoo system), but if their output is piped, into less for example or into a file, the colored output is disabled. Yet, I know less ...
0
votes
2answers
471 views

linux- env variables getting reset after closing the console

The env variables I set are getting reset to the previous values after closing the current instance of the bash console. How to set or unset those variables without getting them reset everytime? I am ...
1
vote
2answers
83 views

Forked Processes and Shared variables

I have a bash script with two forked functions all writing to a log. When both have finished, I'd like to delete this log. The problem I'm having though, is that processFinishCount is never greater ...
0
votes
2answers
4k views

Bash processes - reattach process started in background

Is there a way to reattach to a specific terminal a process that was started from terminal with &? For instance, I started Kate by: kate & and now I want to reattach the process to a given ...
1
vote
0answers
214 views

“Script” command in Bash on Mac OSX

quick question regarding the "script" command in Bash on a Mac OSX 10.8.4 system. In any other bash environment on Fedora, CentOS, etc; when I use the script command it just begins recording with no ...
2
votes
1answer
286 views

How to do replace using sed only in one section of file

File looks like this: [section1] a=something [section_name2] a=something [section3] a=something How do I replace a=someother only in section_name2?