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

learn more… | top users | synonyms

0
votes
1answer
33 views

I'm trying to mirror dns queries generated by TCPDUMP filter and replay them with dig or any other utility

I'm not a very experienced script writer at all. I did find some useful hints in generating an stdout from tcpdump that generates a live feed if you will which is what I want, the problem is handling ...
0
votes
1answer
38 views

Why is “java” a valid command in terminal (bash) if it is not in my path?

On OSX, in the terminal, using the command: echo $PATH Gives me the following output: ...
1
vote
3answers
49 views

How to use grep on a variable or string?

I'm writing a bash script and I need to check if a file name has a number at the end (after a period) and if so get it, but I can't figure out how to use regex on a variable or string. I was able to ...
0
votes
0answers
52 views

iTerm/OSX Terminal: Change text margin from edge of window

Currently, I use iTerm on OS X. My terminal looks something along these lines: I came across this picture of a terminal setup on GitHub, and I wanted to imitate it: Specifically, I wanted to ...
1
vote
2answers
43 views

Run a script post login linux

I would like to run a script after a linux user logs in to do some additional security checks. The user should first login normally using their password, but then be checked with my script, and then ...
0
votes
1answer
66 views

Ubuntu equivalent command to Windows tasklist command

I have a couple lines in PHP to check if a specific process is currently running on my server. If the process is running, I include a script that is used in to interact with said process. Below is the ...
1
vote
0answers
25 views

Can't resume editor running as root

For years, when I have been working over an SSH connection, I will run sudo vi ... to edit a config file. If I need to do something on the command-line, I'll hit Ctrl+Z to suspend the editor, do ...
0
votes
0answers
28 views

Daily crontab with hg, git and svn

Hello I have made a script that updates some repos from git merc and svn, then updates a git repo. The script works manually but doesn't work in crontab, here is the script: #!/bin/bash cd ...
0
votes
1answer
32 views

.bash_history does not exist

Working in AWS I created an instance of Ubuntu 14.04 and noticed the history was not preserved between login sessions. Further investigation showed the .bash_history file did not exist. Why was a ...
0
votes
0answers
23 views

git-svn creates directories but doesn't check out content

I am migrating an SVN repository to Git using git-svn combined with some light bash scripts on Ubuntu 14.04. Locally. git-svn has worked fine so far (on Unix), but recently, it sort of gets stuck ...
0
votes
2answers
59 views

Move and rename files based on their parent's directory

I have a collection of directories that all contain a particular file that is named the same in all the directories. dir1/dirA/file.txt dir1/dirB/file.txt dir1/dirC/file.txt .... dir4/dirX/file.txt ...
0
votes
1answer
65 views

MSYS2 home folder: show ~

I've just installed MSYS2, and to have it use my Windows user folder as $HOME, I put this in /etc/bash.bashrc: HOME=$USERPROFILE And that works fine when I just run cd, except the prompt doesn't ...
0
votes
2answers
60 views

How can I colour-code files and directories in my shell environment?

I've seen many screencasts online in which the files and directories are colour-coded differently for ease-of-use. I'd like to achieve the same on in my bash terminal, on OS X 10.9 and using iTerm2. ...
0
votes
2answers
58 views

How to delete half of the files in a directory?

A directory has files with names ending 001 to 100. How can you delete 2,4,6,8...100. And can that be written as a script. As soon as the directory becomes week old, this has to run. And after a month ...
0
votes
1answer
27 views

bash auto-complete separates strings

Let's say I'd like to cd to the directory containing all albums by the artist "The Ghost of a Saber Tooth Tiger" so I start typing cd ~/Music/The\ Ghost and hit [TAB] [TAB]. At this point bash ...
0
votes
1answer
35 views

Creating a debian package or bash script?

I have started down the path of virtualizing my desktop to ease development...I am currently running VirtualBox with Debian running as a staging server...I am about to start the process of building a ...
1
vote
2answers
36 views

Script to join columns

I have two files: The output of yum list installed which is now yum_installed and yum list updates now as yum_updates What I need is to basically join the two files somehow but ONLY based on the ...
2
votes
4answers
111 views

Detecting known computer on public network in BASH

Anybody know of a way through BASH (specifically OSX terminal, but I'd prefer a BASH only solution without OSX' in built functionality) to detect a known computer on a public network (that I am also ...
1
vote
4answers
501 views

Shell script: ssh to remote machine, then exit: 'exit' does not work

I have a shell script of the following type: #!/bin/bash ssh mylogin@myremotemachine.com echo "Hi" exit I run it locally to do something on a remote server (represented by 'echo "Hi"'). However, ...
1
vote
5answers
53 views

Turn comma-separate rows into 1 column

I have a list of users basically from /etc/group, Id like to basically format that line into one column, I just need the users. So if a field looks like this: bob,john,jane,sam,joyce Then I'd like ...
0
votes
1answer
61 views

mac how to run a command in a different tab/window of a terminal

In Windows, I can run any program from the command prompt by typing c:> start startup.sh and windows will run the startup.sh in a different command prompt(terminal) window. How can I do the ...
1
vote
1answer
36 views

What's the relationship between ssh console and bash?

This is somewhat a Grandma question, but nevertheless, I can't really figure it out. It's the following: I log in to a remote machine via ssh. There (for example!) I try to set LD_LIBRARY_PATH ...
0
votes
1answer
30 views

“echo” prints the options in crontab

I'm running Rasbian 3.12.26+ on a Pi model B. Here is what my cron entry looks like: * * * * * sleep 11; { echo -en "\e[1;4;33m"; date; echo -en "\e[0m"; curl -k "http://sampleurl.com/update.php"; ...
0
votes
0answers
56 views

Script for temporarily disabling internet connection

I want to block internet connection to me for about 8 hours or so on my Linux machine. I have no will power, so simple call for ifconfig down ifconfig up or similar commands doesn't apply to me, ...
1
vote
2answers
70 views

Match a list of users against /etc/passwd

I have a simple one-column list of users. It comes from the lastlog command. I need to be able to tell if these accounts are disabled and I do not have root access. I can only view with more and ...
0
votes
2answers
50 views

cmd cannot execute file inside of /cygdrive/c/

I am running a Ruby on Rails application - inside the app there is a Ruby Gem I've loaded which determines the location of an executable file called pngcrush. The way it does this is that it runs the ...
1
vote
2answers
148 views

How to stop a running jar file in a bash script after 5 minutes and start the next one?

I have to run a jar file with different parameters like this: #!/bin/bash cd /Users/hawkarhama/Desktop/RUN echo $(java -jar IPM.jar 0 20 3 sign.txt) echo $(java -jar IPM.jar 1 20 3 sign.txt) echo ...
0
votes
1answer
25 views

piping pid to kill on ctrl-c

So I have a Grunt task running this command: java -jar build/lib/plovr.jar serve ./someroot' + configurationFile + ' & grunt watch:sass Problem is, for some reason the java process keeps ...
0
votes
1answer
21 views

Surpress execution trace for echo command?

I'm running shell scripts from Jenkins, which kicks off shell scripts with the shebang options #!/bin/sh -ex. According to Bash Shebang for dummies?, -x, "causes the shell to print an execution ...
0
votes
1answer
41 views

How can I ring the audio bell within a bash script running under gnu screen?

In a konsole terminal window outside of screen running a bash shell with TERM set to konsole-256color if I type: echo -n $'\a' or echo -n $'\eg' or ./ringbell where contents of ./ringbell is ...
2
votes
2answers
54 views

How to find files by type and show it's respective path

I'm trying to list all JPG files inside a directory tree to create a report of JPG files inside this tree without search inside every directory one by one. The command I'm using is this one: ls ...
0
votes
1answer
78 views

expect + how to verify if dir exists and if not how to create it

I write expect script that login to remote machine and run there some scripts But I need also to verify the following Verify if directory /var/cti/adm/APP exists If APP not exists under adm ...
0
votes
1answer
47 views

using git pull after ssh in script

I use public and private key to ssh to a remote server without password. After that, I need to perform "git pull" command. But I don't know how to pass the password into it. Trying the following ...
0
votes
1answer
25 views

Script for finding new files in a directory, and execute a command

I have a directory with several, or even hundreds of xml files in it. I want to execute a script when a new file is found. the only MAJOR problem is I can't use inotifywait or something like that. Due ...
0
votes
2answers
26 views

linux: how to show permission of files (like ls -l) does on files returned by the find command

I am doing a find command to show me the files of a specific extension, like: find $directory -type f -name "*.vm" however I would like to be able to see the file permissions as well (like ls -l ...
1
vote
1answer
171 views

“date” command in bash, the results are displayed in Japanese language

I have the same problem on two of my Linux boxes (xubuntu, debian). When I use the "date" command in bash, the results are displayed in Japanese language. 2014年 9月 2日 火曜日 02:48:48 UTC I am located ...
0
votes
1answer
27 views

In Mac how do I signal end of file (EOF) on the shell

IN windows, I press F6 function key to introduce the CTRL + Z character that signals the end of file. c:\> copy con filename copies the command line input to the given filename. At the end, ...
0
votes
2answers
51 views

Why does `rm -rf`` silently fail?

[EDIT] Please don't waste your time reading my question below. It turns out my colleague is an idiot.. :) On my server I'm trying to remove a folder and all its subfolders with the usual rm -rf ...
0
votes
2answers
36 views

what does this sort command mean? cat temp.txt | sort -t$'\t'

In the man page of sort, -t is used to specify a field-separator. However, I don't know what the -t$'\t' form means?
1
vote
2answers
46 views

Compare two files and output the differences

I am aware of diff and using loops but I just cant seem to really get what I need with diff. I'm basically looking to compare two files (file2.txt and file2.txt) and just get the output of what is ...
0
votes
2answers
73 views

How do i get the playing song details(title - artist- album.. etc) in ubuntu

When i play a song in ubuntu whether from banshee or spotify or any other music player, the song shows up in the sound indicator menu. How can i get the details of the playing song from the ...
0
votes
2answers
27 views

option not alt on a Mac

According to this bash syntax tutorial , I should be able to move back left one word if I hit Alt + b. On a mac, the option key is the alt key (or at least it's supposed to be). when I press option b ...
0
votes
0answers
40 views

Remove grep's line number output in Redhat 5.9

I havent used RH 5.9 until now. I started with 6 but we have some 5.9 servers. The syntax with 5.9 is a bit different with some things. grep for example will output a number line before the actual ...
0
votes
0answers
70 views

Get all inactive users on system with 'lastlog' on Redhat 5.9

I need a script that will basically give me the listing of usernames that have been inactive on a system for 90+ days. I use the lastlog command but it seems a bit tricky to try to grep out the time. ...
0
votes
1answer
24 views

OS X Bash 4 terminal exits

I have the latest OS X running the standard terminal app, with bash 4.0 via homebrew However, if I run a script that contains an exit command, it's expected it would exit the script. Instead the ...
0
votes
1answer
21 views

bash alias using pipline fails to run

I want to sent test.tjs to pipline, first convert to js file, then run in node So, I tried in .bashrc file: alias tame="tamejs -o $1.js $1; node $1.js" alias tame="tamejs -o $1.js $1 && ...
6
votes
1answer
96 views

Is there a windows command-line alternative to unix's expect? [closed]

The bash/unix/linux tool expect can be used to automate/script console/tty programs in posix. An example is in http://stackoverflow.com/questions/4780893/ I've read there are bindings for ...
0
votes
3answers
46 views

Linux Bash — how to know which directory I really am in with symlinks?

suppose I have a symlink chain A -> B -> C when I type pwd, it could show me in A, B, or C depending how I get here. How do I show the physical directory address, i.e. not represented by any ...
1
vote
1answer
33 views

Using a value from a file and updating it using a Linux script:

I have an automatic build script for my build server that builds Android applications. As part of this building process, I need to increment two parameters in one of the Android application files ...
0
votes
2answers
31 views

Setting java path in bashrc and cshrc

My system java's version is 1.6, for running Eclipse I need jre 1.7. I've already downloaded and unpacked the archive of java 1.7, but I cant change the default path from /usr/bin/java to my unpacked ...