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

learn more… | top users | synonyms

2
votes
2answers
30 views

One-line code in bashrc to edit pdf

I would like to have a one-line code in bashrc, for removing the first page of a pdf. The command to be typed in the bash prompt could of the form: cut name.pdf This command should remove the ...
2
votes
1answer
52 views

Timer running under bash script in dialog window

The following bash script is an example on how to use the dialog command. This script runs a progress bar (and displays the process upgrade). What is missing in the dialog is a time clock - that ...
0
votes
1answer
16 views

Light way to read big bz2 compressed files

bzcat *.log | sed # etc works but since the files are few gb big, it takes time to complete. Is there a way to do it in a faster way ? I tried echo *.log | xargs -P 4 bzcat | sed # etc but the ...
0
votes
1answer
34 views

Bash scripts are not working but on mac terminal those commands in scripts works

I'm stuck with a wired problem.My bash scripts are not working now.It worked previously.I don't know why.Interestingly the commands on the script work when I enter it directly on the terminal. This a ...
0
votes
2answers
162 views

Shell script to SFTP file to remote server

This is probably a question asked before, but I can't find a good question/answer. I need to write a shell script that will be called by PHP program (exec function) to move all *.pdf files to a remote ...
1
vote
0answers
38 views

How to change BASH “editing-mode vi” shortcuts?

I'm trying to change my bash vi mode keys to enter and exit insert mode, I would like to set these shortcuts: Ctrl-\ : Enter moviment mode Alt-\ : Enter insert mode how can I do that? I'm trying ...
2
votes
2answers
67 views

Recursively fixing image file extensions in Linux

I have a bunch of image files from misnamed scans/faxes I need to fix for our Linux users. It turns out we have a bunch of scans that are PNG files that are labled as *.jpg visa versa. Under Windows ...
0
votes
0answers
38 views

Bypass the $Recycle Bin in CygWin?

I'm using a CygWin session to find a large number of directories at a certain level in the file system tree in a loop, compress each directory into 1 archive, then delete the directory This ...
0
votes
3answers
90 views

How to copy multiple files and move them to multiple folders using terminal for Mac

I have a folder on my Mac's desktop called Bthepics that has 9 images that I want to copy and move to about 500 folders at once. These 500 folders are located in a folder on my Mac's desktop called ...
0
votes
3answers
55 views

Why is this echo command not working?

I want to overwrite /etc/postfix/master.cf with my own content. I'm using echo "<content>" > /etc/postfix/master.cf to try and accomplish this. But when I do: echo "# # Postfix master ...
1
vote
2answers
41 views

Run a command in another cygwin window and not exit

From current cygwin shell, I want to run a command(say, pwd) in another cygwin window, I use: cygstart /bin/bash pwd It did spawn a new cygwin window but close immediately. I want the window is ...
0
votes
2answers
73 views

How to execute multiple multiline mysql queries with a shell script?

I want to run multiple MySQL queries from a shell script. I'm using the following code: mysql -u <redacted> -p<redacted> servermail << EOF CREATE TABLE `virtual_domains` ( `id` ...
0
votes
0answers
28 views

Trap a program that has no command line output

I am using the CrashPlan backup tool to backup my home file server. I use an ssh tunnel to interact with the GUI on the remote machine (as detailed here). Currently, I have an alias in my zshrc that ...
0
votes
1answer
74 views

How to recover Kali linux password using LILO?

I forgot my Kali password and I tried getting into LILO single user mode but it still asks for root password (which I forgot). As a secondary measure I just ran init=/bin/bash The command runs but ...
0
votes
1answer
46 views

Using GNU screen to create a split screen environment from command line

Could someone please point me towards the syntax for using GNU screen from the command line. On a previous cluster, I managed to create a bash script that would create X number of tiled shells, each ...
0
votes
0answers
37 views

How can I get “ldd” on Mac OS X?

"ldd" is a Unix/Linux utility that allows you to determine "dylib" references within an executable file, typically created by gcc or g++. There is an Apple equivalent called "otool" that uses a -L ...
0
votes
1answer
56 views

What file does OSX Mavericks look at to setup environmental variables for terminal

I changed something on my Mac and when I start terminal by simply clicking on the icon, none of the PATH variables are loaded to tell terminal where basic (or any commands) are. I have edited the ...
0
votes
2answers
37 views

how to clone a directory list to another directory

I am trying clone a directory and it's subdirectories into another directory. I have hundreds of music directories with sub-directories that I want to convert from flac to ogg. I want all the music ...
0
votes
1answer
39 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
41 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
50 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
59 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
44 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
68 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
29 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
36 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
24 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
61 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
71 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
61 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
60 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
28 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
115 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
600 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
58 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
63 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
31 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
60 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
73 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
51 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
160 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
26 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 ...
1
vote
1answer
24 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
43 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
55 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
91 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 ...