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

learn more… | top users | synonyms

0
votes
1answer
265 views

Cronjob does not work

I tried to set up a cronjob on my server. Actually this command should execute a java programm every hour. But somehow this didn't worked. I googled and tried to set up a test-script that should run ...
4
votes
3answers
1k views

cp -u is illegal on mac. What are the alternatives?

I have a MacbookPro Lion, and I have tried to archive my files that is tried to copy and overwrite if the source is newer than the destination. I tried the following command cp -u source destination ...
1
vote
4answers
2k views

Batch process ffmpeg?

Given an AVI encapsulated video with WMA2 audio and MP4 video how do I pass-through the video, convert the audio to MP3; then re-encapsulate the entire file into an AVI? ffmpeg -i "foo bar.avi" ...
13
votes
1answer
559 views

Why do `bind` and `.inputrc` behave differently?

I'm trying to do the right thing and put my key bindings into ~/.inputrc. However, it turns out that I have to change bind '"\e\C-j":"\e[1~quiet \e[4~\n"' into "\e\C-j": "\eOHquiet \eOF\n" Now ...
0
votes
3answers
2k views

How can I determine if a port is open on my server? If it's closed, how can I open it?

I just set up ElasticSearch on my server, but I cannot seem to connect to it remotely (default is port 9200). I can connect to it via localhost, but I cannot connect to it remotely when I specify the ...
2
votes
2answers
372 views

Screen run command, detach and get output

I am trying write a script which connects and runs command on /dev/ttyUSB0 after that gets the output. screen -d -m 'SCREEN COMMAND' -L /dev/ttyUSB0 But this does not create an output file. How ...
5
votes
1answer
180 views

Explaining the -W flag for rm

What does the -W flag for rm do? According to its man page, the flag attempts to "undelete the named files." And currently, "this option can only be used to recover files covered by whiteouts." What ...
0
votes
1answer
507 views

Custom terminal prompt overwrites on itself and generally behaves improperly on OS X Terminal.app

I have the following prompt set in my bash_profile: export PS1='\[\e[1;94m\h:\W \u\e[1;93m\$\e[0m \]' # default = '\h:\W \u\$ ' Unfortunately, under certain conditions I encounter problems: At a ...
2
votes
2answers
333 views

Running executable bash script with slash or without

I have bash script test.sh which does nothing special: #!/bin/bash echo Hello! If I run it like this . test.sh, it works. kopparberg:dev marek$ . test.sh Hello! If I run it like this ./test.sh, ...
1
vote
3answers
1k views

How can I get the unique items in a bash list?

If I have a list in bash L="11 22 11 33 22 44" Is there a clean way to get to "11 22 33 44" ?
3
votes
2answers
2k views

Diff two files side by side, new lines on left column for no match

This has been getting the good half of my day and I am sure such a solution must exist (if not, then I am programming one), but alas, here is the question. I have two files, hpc.sorted.modules.txt ...
1
vote
2answers
509 views

Fix Mac OS X bash

When I start my Terminal I get this error. I have no clue how to fix that and where it comes from. Last login: Fri Nov 30 21:46:06 on ttys000 -bash: export: `/usr/local/bin': not a valid identifier
7
votes
3answers
292 views

vim can not execute unix command with :! due to shell changing

Our company uses red hat linux system and allocate everyone an account in /home. Unfortunately, our system is using tsch, which is not favorable for me. Moreover, as I do not have the super user ...
3
votes
1answer
293 views

Accessing a persistent ssh tunnel

How do I pass commands (shell) to a persistent SSH tunnel rather than open a connection for every instance? I have a Python scraper running on a client server which passes URL variables and shell ...
1
vote
3answers
85 views

When does $PATH get consulted in shell usage?

Sometimes, I have to specify a full path, because $PATH is seemingly not consulted: #### I have `virtualenv` and it's on my path #### $ virtualenv --version # `virtualenv` ...
1
vote
1answer
405 views

How to save environment variable on my Ubuntu Linux system

I am using Maven to the build process of my Java project. To launch the mvn command in any position within the shell I am using the following command to declare the environment variable in this way: ...
2
votes
2answers
304 views

bash and arithmetic comparison: double quotes or not?

when comparing two integers in bash, do we have to put double quotes ? In the official document http://tldp.org/LDP/abs/html/comparison-ops.html I can read that double quotes should appear every ...
0
votes
2answers
135 views

How to get ~/foo from /home/user1/foo?

The Bash prompt supports the \w escape sequence, documented as \w the current working directory, with $HOME abbreviated with a tilde (uses the value of the PROMPT_DIRTRIM variable) Is ...
1
vote
1answer
256 views

Bash path glob matching dotfiles and parent in pwd

The command $ chmod -R 700 ./.* searches and tries to chmod files and directories above the pwd. Why? Expected results: Consider pwd is /home/user, I would expect the first . in ./.* to be ...
1
vote
3answers
621 views

Create multiple files and name them from command line

I need to create 300 blank files and put them in a folder on my server then name them from a list in a txt file, I have SSH access, so is it possible to do this using command line?
1
vote
4answers
6k views

Why doesn't my symbolic link work?

I'm trying to better understand symbolic links... and not having very much luck. This is my actual shell output with username/host changed: username@host:~$ mkdir actual username@host:~$ mkdir proper ...
0
votes
2answers
779 views

Change bash_profile path order

To use the right PHP version on my command line I want to change the $PATH of my command line profile. For now, the command line uses the standard system php file located in /usr/bin/. I want to use ...
1
vote
2answers
53 views

wget : how to get a directory to a specify directory

The command I am using is: wget -r -nH ftp://some.domain.com/home/work/test/* -P ./my The output directory becomes: ./my/home/work/test/* How can I make it to just ./my/*?
0
votes
2answers
314 views

Unix list absolute file name

Given an arbitrary single argument representing a file (or directory, device, etc), how do I get the absolute path of the argument? I've seen many answers to this question involving ...
4
votes
1answer
268 views

Select multiple files in long path (filename completion in brace expansion?)

Sometimes I want to run a command, as arguments to this command I want to supply multiple files that are located in a folder deep in the file system hierarchy, eg: command /this/is/a/long/path/foobar ...
-1
votes
2answers
270 views

Copy files above 500kB from one directory to another in Ubuntu

hope you can help me, I'm looking for a command to let me copy all files above 500kB in my directory one to directory 2.. Basically I have a lot of Images in directory1 and would like to copy all ...
1
vote
1answer
645 views

Symlink path can be followed manually, but `cd` returns Permission denied

I am trying to access the directory /usr/software/test/agnostic. There are several symlinks involved in this path. As you can see by the below transcript, I am unable to cd directly to the path, but I ...
1
vote
2answers
107 views

System-level bash/zsh alias blacklist

Is there a blacklist feature/functionality in bash/zsh to prevent specified commands and such from being overridden with an alias? Specifically - is there something that can be set system-level in a ...
1
vote
2answers
82 views

Bash window title not restored after exit

I have a problem with the window title in the Terminal window on OS X: Start Terminal. Window title is "bash" Type "ssh external" to connect to an external server. Window title is "user@external:~" ...
3
votes
1answer
620 views

.bashrc function is not working on Cygwin

I recently installed last version of Cygwin. Right now I'm just configuring some alias and functions to use. Cygwin is reading the .bashrc file correctly, because some alias are working, I just have a ...
2
votes
2answers
559 views

Why there is difference between output of linux command du and ls?

I have a file in linux machine whose size is 3404494030 upon doing "ls -l". When I do "ls -lh" it shows 3.2 GB which is correct when converted from bytes to Gigabytes. But when I do "du -h" for the ...
2
votes
2answers
911 views

Can't rename a file the name of which starts with a hyphen

I'm trying to rename a file with a hyphen at the beginning of its name and both this: mv -example-file-name example-file-name and this: mv '-example-file-name' example-file-name result in: mv: ...
2
votes
5answers
8k views

Running scripts from another directory

Quite often, the script I want to execute is not located in my current working directory and I don't really want to leave it. Is it a good practice to run scripts (BASH, Perl etc.) from another ...
1
vote
2answers
887 views

Debian wheezy keyboard shortcut for both opening and closing a terminal

I recently installed tilda and I would like to open it and close with the same keyboard shortcut. I wrote little something in bash that closes tilda if it is open and opens tilda when there is no such ...
0
votes
1answer
423 views

Mac OS X 10.6 executable not found without full path

I just installed Apache via MacPorts. It seems that my Mac was absolutely confused about which version of the Apache executables to run. After moving the Apache executables that ship with the Mac to ...
1
vote
3answers
934 views

Running rdesktop through a SSH tunnel in one command

I am running ssh server -L 3392:192.168.1.138:3389 in one terminal window, then running rdesktop 127.0.0.1:3392 in another to connect to a Windows machine through an SSH tunnel. How can I merge this ...
0
votes
2answers
703 views

How can i use the `eject` command on a computer i have SSH'd into?

So if i do eject on my machine, it works exactly as expected, however, if i ssh into the machine next to me, and do the same thing, it does not work... my computer: eject: using default device ...
1
vote
1answer
280 views

Bash Script to Back Up Backs Up Itself

I have the following bash script that creates a tar.gz of my filesystem on a Kubuntu PC. The problem is, that it also tries to backup the tar.gz backup file, even though I am storing the backup in ...
0
votes
3answers
87 views

How can I set the '~' in my shell

Normally, ~ in my shell maps to /home/myuserid. How can I make it map to another directory?
3
votes
3answers
2k views

Terminal pager: How to display a list in columns?

I'm sure it's very simple, but I can't remember how to tell a terminal pager (more/less/pg/most) to display a long list in columns. Since my input is just a list of short elements, displaying it the ...
4
votes
5answers
303 views

How do I pipe a list of numbers straight from the shell into a command?

How do I pipe a list of numbers straight from the shell into a command? For exampe something like this [1,2,3,4] | sort would give 1 2 3 4 EDIT: In response to the answers kindly posted so ...
1
vote
1answer
513 views

Vim clobbering scrollback buffer outside of screen

If I'm not in a screen session, then when exiting Vim I get a bash prompt below the remnants of the VIM window. A side effect of this is that my scrollback buffer is clobbered, especially if I have ...
1
vote
1answer
333 views

/usr/bin/mail equivalant for | sendmail -t

been searching for few hours, and came to no solution. Is there an equal expression for the bash command myfile | sendmail -t where my information needed for sending mails is stored in the ...
1
vote
1answer
68 views

How to put a Number in to a plist with bash

I'm trying to update my com.apple.background.plist. It works but the "ChangeTime" needs to be a Number/Integer in order to work. I tried to place a -int into the code but it gives an error. ...
1
vote
1answer
713 views

sshpass installation

I want to use passwordless SSH for logging in. I used sshpass to achieve this. The problem is when I am trying to install sshpass through sudo apt-get install sshpass. It asks for password. After I ...
1
vote
1answer
408 views

How to use Pipe Viewer (pv) for measuring compression progress?

I've been trying to track the progress of the data in a pipe, specifically in a large init script for a minecraft server. How would I go about using pv to get an accurate readout of progress? I've ...
10
votes
2answers
22k views

Linux Bash Script, Single Command But Multiple Lines?

I have the following script I wrote by searching Google, and it backs up my Linux system to an archive: #!/bin/bash # init DATE=$(date +20%y%m%d) tar -cvpzf ...
0
votes
0answers
268 views

Force apt-get update to return success

I'm working with a system that invokes apt-get update from a Ruby Capistrano recipe. Capistrano cares (apparently) about the return code of the shell commands it executes. apt-get update is running ...
0
votes
1answer
634 views

Syntax Color Highlighting for Bash in Mac Terminal

I am programming some bash scripts in Terminal with VIM, on OSX 10.8, but there is no syntax-highlighting for bash. How can I enable it?
2
votes
4answers
981 views

How do you remove all occurrences of values in one list from another list?

I have a list of symbols such as... wer sfe efo How do I remove all instances of these (unique) symbols from another list of (non-unique) symbols? So in the following list, the lines starting ...