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

learn more… | top users | synonyms

1
vote
1answer
141 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
427 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
109 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
315 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
124 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
205 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
503 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
671 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
404 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
272 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
423 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
289 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
630 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
566 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
268 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
354 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
494 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
85 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
220 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
301 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?
2
votes
2answers
253 views

Detect if the display is valid in Linux

Is there a way to detect if the display is valid in a controlled way? For example if I set $DISPLAY=anydisplay or $DISPLAY=0.0, is there a way to check if anydisplay or 0.0 is a valid display which I ...
2
votes
1answer
4k views

Permission denied using Rsync as root

All topics that I've come across involved rsync over ssh or rsync using a user with restricted access. I'm getting permission denied (13) errors as root. Here are my config files: /etc/rsyncd.conf: ...
1
vote
1answer
41 views

Why doesn't stdin from a file work in case of scp?

I'm trying to input a password to scp automatically from a file called passwd with a command scp folder/ user@server.com:./ < passwd but it's not working. I know we can use password-less SSH as ...
1
vote
1answer
190 views

Stuck in a while-loop in GNU/SU (seismic unix)

I'm new to programming. I have this loop (it's part of a data processing script) and I have it all good until this section cause I can't figure out why it stay looping in the second 'while' Take a ...
1
vote
1answer
132 views

Piping svn diff produces ESC characters (OS X 10.7.5)

Why is it that when I pipe svn diff output to, say less, I get a bunch of ESC characters? $ svn diff | less Index: test/unit/tour_guide_tip_test.rb ...
3
votes
2answers
2k views

ls command different output in shell script

I have a strange behavior on my linux box and i want your advice. I want to capture the output of this command ls -log /some/directory Running command from command line the result is OK: ...
4
votes
1answer
291 views

How can I remove all files from a directory that have a certain filename length?

I have a tmp directory full of various files that a program has created and not cleaned up properly. Each of these files has a filename that's simply 6 random characters. In addition to these, there ...
2
votes
2answers
5k views

View all files in a website's directory?

Is it possible to list all files and directories in a given website directory from the Linux shell? Something similar to: ls -l some_directory but instead of some_directory, it would be ls -l ...
2
votes
1answer
494 views

Running commands and shell scripts in Ubuntu

I'm trying to run a shell script in Ubuntu to flash my Firefox OS phone. I've downloaded and unzipped the new version. I've launched the shell and navigated to the directory where the .sh file is. ...
4
votes
2answers
937 views

How make a compressed tar when there are too many filenames for the shell to expand on a single line?

Normally I would just do something like: tar -czf archive.tar.gz *.csv But when there are too many files in the directory for the shell to expand on a single line this doesn't work. In these cases ...
3
votes
1answer
1k views

How to get list of all child process spawned by a script

Context: Users provide me their custom scripts to run. These scripts can be of any sort like scripts to start multiple GUI programs, backend services. I have no control over how the scripts are ...
0
votes
1answer
88 views

sublime text 2 command create link but the command is empty

I want to create the link about sublime text2 which is placed in applications. If I paste the /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl in bash, the sublime text 2 will open. ...
2
votes
3answers
173 views

How can I add a comment for each flag, on separate lines, in a bash script?

I want to write bash scripts that are as self-documentary as possible. I had an idea that when I execute software with lots of flags, I wanted to split the command into multiple lines, and add a ...
-1
votes
2answers
198 views

what's meaning of the following linux script

sudo apt-get update sudo apt-get install python-software-properties python g++ make sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install nodejs sudo ...
1
vote
0answers
94 views

iWork Keynote: Automate video export with custom settings for multiple files

I have a couple of Apple iWork Keynote presentations and exporting it to Quicktime with my customized settings from within Keynote is straightforward. But here's my problem: How do I manage to ...
4
votes
2answers
89 views

Sort files with grep

I have a few hundreds of output files, of which some contain error messages. Lets say I want to automatically put all files containing the string "ERROR_1" in a "subfolder_1", and the rest in a second ...
2
votes
2answers
221 views

What is the command line shortcut to comment out the current line

I am looking for the command line shortcut to comment out the current line in the terminal. For example, I might enter git commit -am "a comm and then realize I don't actually want to commit yet. I'd ...
2
votes
1answer
151 views

How do I stop my bash shell from asking to install a package?

When I mis-type a command, the shell tries to find a package that provides it. How do I disable this feature? Example: [dave@dave cpp]$ sl bash: sl: command not found... Install package 'sl' to ...
0
votes
2answers
200 views

linux - add a line just before ending line

I want to write a linux script(set_compiler.sh) that will add a line just before the ending line. The file zazzercode.gwt.xml is as below : 1 <?xml version="1.0" encoding="UTF-8"?> 2 ...
2
votes
3answers
198 views

Is `test` a builtin or program

Is test a shell builtin or actual program? bruce@Bruce:~$ type -a test test is a shell builtin test is /usr/bin/test bruce@Bruce:~$ bruce@Bruce:~$ file /usr/bin/test /usr/bin/test: ELF 64-bit LSB ...
4
votes
1answer
2k views

Bash, how to globally fix ^H and ^? backspace problems

I'd like to fix this frequent problem where the shell on a remote server thinks my terminal's backspace key is ^? and sometimes it thinks it is ^H, and happens to be incorrect and outputs the wrong ...
2
votes
3answers
172 views

What does really mean null string?

I'm sure most of us know that when we want that some regex matches with a string at the begin of the line we must use "^" ... But, I'm trying to understand what really means "empty string at the ...
16
votes
3answers
18k views

How to enter login information for a website from the linux command line

My internet connection is provided by the university. It is protected to a username/password combination. This means when I start up my computer, I have to start a web browser and open an arbitrary ...
7
votes
1answer
2k views

Shell script to find all types of files in a directory with their count

I want to write a shell script or alias to find the number of different types of files in a directory. For example, sample output of script should be: *.h 20 *.c 40 *.cpp 10 Makefile 3
2
votes
1answer
206 views

How can I enable command line history on a remote Ubuntu terminal session?

When logging into a remote Ubuntu session using ssh, my command line history, which I'd usually access on my local terminal with the cursor keys is replaced with ^]]A ^]]B characters etc. How can I ...
0
votes
2answers
545 views

SFTP - Recursively fetch new files

I have a remove file system structure like this: + /measure + / 2013-09 + / 2013-09-04 + / fooinstrument + result03343445845.csv + ...
1
vote
2answers
304 views

rm -r: exclude certain subdirectories

The problem I have a directory structure, e. g. something like this (here trailing slashes represent folders): ./A ./B/A/A ./B/A/B ./B/B/ ./B/C ./C/ And I need to recursively remove everything ...