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

learn more… | top users | synonyms

0
votes
2answers
35 views

Bash command for replacing all non-printable characters?

I have a bash script that checks database for changes and emails me these changes. Works nice, until it tries to send something non-printable, which 'breaks' the mail. Is there any handy way how to ...
0
votes
1answer
41 views

How to move unopen files to another folder

I´m beginner in Linux and I want to build a script in bash to check which files are open in a folder and move any other files - those that are not open to another folder.
0
votes
0answers
36 views

SSH remote chroot without root

I have a dual boot system consisting of two Debian OSes. I've installed one of them in a root of the partition and installed the other Debian using debootstrap; the installation partition is called ...
0
votes
1answer
54 views

Start PuTTy session in remote host over network

I have 5 hosts - A, B, C, D and E. A and B are windows hosts. C, D and E are Linux machines running ssh server on port 22. I've copied plink.exe (putty command line backend client) in host B. When I ...
0
votes
0answers
12 views

openssl print numeric value of the key?

Given a file contains the public key, I need to get the numeric value of the modulus and the e. But I can only get something like this: $ openssl rsa -in key -pubin -text Modulus (2050 bit): ...
2
votes
1answer
53 views

Probing a port for RDP

I use an ssh tunnel to RDP into my home computer ("home"). Occasionally, the tunneling software running on home crashes and the RDP port stops getting tunneled. I've attempted to resolve this by ...
0
votes
1answer
19 views

readline - deleting word under cursor

E.g. Alt-d deletes word until next word boundary. There's also a shortcut to delete until previous word boundary IIRC, but I'd like to delete word UNDER cursor (i.e. to current word left boundary and ...
0
votes
1answer
32 views

Get the Group name which has GID=0

I wanted to write a shell script in which it needs to give the group name whose GID=0.I used awk command like this, awk -F ':' {$3==0} /etc/group | cut -d ':' -f1 It works fine in redhat,aix.But ...
0
votes
3answers
40 views

Is there an automatic way to add group read permissions to “nohup.out” when “nohup” is run?

I run my Java code from bash script using a command like this: exec nohup "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" com.myClass "$@" & Which creates the output file nohup.out and this ...
0
votes
2answers
82 views

bash shell error: “no such file or directory”

I am trying to install Virtualenv wrapper on Ubuntu 14.04. But whenever I start a terminal, I get the error saying bash: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh: No such file or ...
7
votes
8answers
679 views

Remove linux file named with set of shell responsive characters

I've created a file named \;:$"\' to test a software of mine. I ended up with an error, because I cannot delete the file property. I'm trying to find a precise character combination to remove it via ...
1
vote
3answers
51 views

Looping until background process is done (with `jobs`) doesn't work in script

I'm trying to loop until a background process (launched earlier in the script) is complete. An easily reproducible test case is: ping -c 10 localhost &>/dev/null & On the command line, I ...
0
votes
1answer
67 views

No such file or directory when executing an existing file

I have norrowed the error down to this from a larger script and I'm getting the error "No such file or directory" when I try to execute a file which exist and I have the correct permissions for. ...
0
votes
2answers
31 views

Append text to lines between two patterns every time they appear in a file

This will be a rather hard one, i guess. I have to fiddle around with inline documentation that is extracted into html files to be used as online documentation, but these parts of the files should be ...
0
votes
0answers
189 views

Unable to get vmware shared folders working in Ubuntu 14.10 Guest

i Installed Ubuntu 14.10 64Bit in VMWare Workstation 10.0.5 within windows 8.1 Enterprise. I installed vmware tools by running the vmware-install.pl script in terminal.But I am Getting an error ...
0
votes
1answer
26 views

Linux Bash: Moving/Copying files/directories by timestamp

This is the command I am using: find absolute-path -name "*" -amin -120 -exec cp -f absolute-destination {} \; I’m trying to copy a lot of directories from a directory to another directory, but ...
-1
votes
2answers
45 views

Apply command to every line in bash terminal

I've accidentally discovered the lolcat package today. The first thing that I though about is: it would be fantastic if i could pipe everything that comes from stdout to the terminal through lolcat ...
1
vote
1answer
125 views

Remote SSH Commands - bash bind warning: line editing not enabled

I am using bash 4.3.11(1) and have the following history plugin installed (via .bash_it): # enter a few characters and press UpArrow/DownArrow # to search backwards/forwards through the history bind ...
2
votes
1answer
144 views

What is the scope of “exported” in Unix shell variables?

I have set some environment variables in the following way: MY_VAR='helloworld' export MY_VAR Then I have switched to another user via su SOME_OTHER_USER I echo the MY_VAR variable.. and I see ...
0
votes
0answers
48 views

Can’t cd, ls, chown/mod or rm directory — Unknown error: 211 in Mac OS X

Never seen something like this in all my years. This is happening in Mac OS X: $ ls -lO@ea dr-xr-xr-x 2 root wheel - 1B Mar 20 23:10 Music/ $sudo cd Music/ cd:13: unknown error: ...
3
votes
1answer
33 views

What's the best command to discover an application's PID?

Just now, I encountered a bug in Google Chrome. For whatever reason, my Chrome tab, which was open to StackOverflow, created an infinite loop of "Are you sure you want to leave this page?" prompts. ...
1
vote
3answers
128 views

BASH script - execute command in variable

I am doing a bash script to backup my database daily(on Mac OS X) and I want to save the newest 7 backup directories. Here is the problematic fragment of my script(for listing everything but the ...
1
vote
1answer
53 views

How to correct malfunctioning Terminal in Mac OS X?

I am using Mac OS X 10.10.2 (Yosemite)—not a server version of the OS—and standard “Terminal” commands like ls, sudo, cp, mv, rm are no longer recognized in my Mac “Terminal.” I face this problem ...
0
votes
0answers
26 views

how to find packages in subdir with a particular dependency

From the root of new SLES media how is it possible to find all packages with a particular package dependency? That is, there are many RPMs in various sub-directories of root. How may I find all ...
0
votes
3answers
29 views

How do I move files from many child directories into my root directory?

I'm using bash on Mac 10.9.5. I have PDF files in many directories, all one level from the root ... Dir_1/abc.PDF Dir_2/def.PDF Dir_3/ghi.PDF Dir_3/jkl.PDF ... How do I write a shell command to ...
-1
votes
1answer
31 views

for loop in if else conditions in bash [closed]

I'm trying to script the following task. I have a file in which node name and ips are updated, I have to make each file of those nodes which are not in our required directory and those are in updated ...
1
vote
1answer
27 views

Difference between : and := with variables in bash files

I came across a bash file which has something like this MYVAR := SomeVal I know after reading some tutorials you set values as such MYVAR = SomeVal What is the difference between the above two ? ...
0
votes
1answer
62 views

Non-interactive ssh sessions don't have PATH set on some systems

I set my environment in .profile. My .profile is idempotent and .bash_profile, .bashrc, .kshrc and .zshrc all source .profile. That way I always get the same environment regardless on what ...
2
votes
3answers
122 views

Apparent .bash_profile and .profile conflict in Mac OS X

I have an issue where, when I load up new terminal windows, I have to source the ~/.profile to get my PHP path working correctly. In essence of my issue is getting terminal to use MAMP PHP and MySQL ...
0
votes
1answer
159 views

Download multiple files from ftp server with bash script

I have 2 or 3 FTP Servers where our hoster puts database backups each day. Since he only keeps one, I was orded to write a bash script for downloading alle database backups every day so we have more ...
0
votes
0answers
27 views

static ip address disappeared in the middle of running iperf

The following is done on iperf client side. I set the static ip address for eth0 by modifying /etc/network/interfaces, and activate the change by doing ifup eth0. Then I start iperf -c $server_ip -t ...
0
votes
1answer
47 views

Python debugger not stopping at breakpoints

I'm in a linux based development environment where I don't have superuser permissions. My basic issue is that the breakpoints I set in emacs through pdb never work. The debugger never halts at those ...
0
votes
3answers
89 views

Print previous 20 lines of text from a certain point of a text file

Currently: I'm new to scripting, teaching myself as i go along and this is my first script I'm developing. What my script is trying to do is look at specified file, scan the file to find the word ...
0
votes
1answer
14 views

What is KNOPPIX shell's start-up file?

I'm trying to install virtualenvwrapper and I got to change the settings of my shell's start-up file (like .bashrc, .zhrc, .profile, etc) to write this: export WORKON_HOME=$HOME/.virtualenvs export ...
1
vote
0answers
26 views

How to show git branch in Emacs shell

How can I show the current git branch as part of the Emacs shell prompt? For example, I have this in my ~/.bash_profile (I'm on Mac OSX 10.9 Terminal): parse_git_branch() { git branch 2> ...
0
votes
1answer
33 views

zsh completion for all executables in path

I have written a script which itself takes as an argument any arbitrary executable in my $PATH. Is there a way to create a zsh (or bash) completion function such that I would be able to type myFunc ...
1
vote
0answers
30 views

Can I have server and client on the same machine and run network bandwidth test using iperf?

I have two ethernet ports (eth0 and eth1) on my system. I've tested the bandwidth with two systems and got ~940Mbit/s. If I use one of the ports as server and the other as client, I always go through ...
0
votes
1answer
62 views

Percent sign in bash is not typeable

I have a strange problem: I cannot type or copy the percent sign in my bash... I tried to read ~/.bashrc, /etc/profile (and stuff in /etc/profile.d). I also tried sudo bash, but still not possible to ...
2
votes
1answer
79 views

How can I check if a file is newer that the target file in a shell script

How can I check if a file is newer that the target file? In a shell script, intended to run on a Mac, I want to do something like this: #!/bin/bash if [ $SourceFile dateisgreater $TargetFile ] then ...
1
vote
2answers
20 views

How do I output this line to a remote file?

I'm using a bash shell and trying to figure out the right way to write the following: ssh mysuer@remotehost 'echo "update user set url = \'localhost\' where url = \'mydomain.com\';" >> ...
0
votes
3answers
64 views

Multiline && combinator operator for command chaining in batch file

I see that this operator is used in windows (and might be Linux?) to chain/combine multiple commands in one line. Commands are executed one after another, as long as preceding complete successfully ...
0
votes
1answer
30 views

How is the “builtin” bash command defined?

I noticed that command like cd .. is actually converted to builtin cd .. and then executed. But how is builtin defined? which builtin doesn't show anything and it's not in /bin, /usr/bin etc. Is it ...
1
vote
0answers
44 views

Cygwin and Cygwin64 missing prompt in terminal

I tried to install and reinstall cygwin and cygwin64. I also tried different mirror sites. Instead of seeing a line like user@PC~ $, I see a blank screen with a blinking cursor. The properties of ...
1
vote
1answer
51 views

Duplicate a remote session in terminal in Linux (Ubuntu)

How do I duplicate a remote session in the Linux (Ubuntu) terminal? For example, if I have an SSH session open, how can I duplicate this session in the terminal?
0
votes
1answer
50 views

Resolved: Enumerating every other array element in loop

I have a dynamic array with key-pair values and I’d like to enumerate every other value. In this case, just the names in the array. Since I’m not using bash v4, I have been able to use seq to step ...
0
votes
1answer
99 views

Test USB 3.0 Device Speed

I've looked up hdparm, but all examples are for testing disks. Not sure if it can be used to test external usb devices (specifically usb flash stick). I'm using the following code right now: dd ...
0
votes
1answer
63 views

Mac OS X seems to be unable to find directory that certainly exists

For some reason Mac OS X cannot find a directory I just made. Any idea why? sh-3.2# mkdir /Users/Administrator/Documents/drive/ sh-3.2# mount -w -t "hfs+" /dev/disk1s2 ...
1
vote
1answer
56 views

Bash: better way to output to both console and output file than tee?

What I need to display is a log refreshing periodically. It's a block of about 10 lines of text. I'm using |tee and it works right now. However, the performance is less satisfying. It waits a while ...
0
votes
2answers
70 views

Adding subtitles for multiple mkv files by MKVmerge using terminal

I'm trying to adding subtitles for multiple mkv files. I use this script for doing this : for file in *.mkv; do "/Applications/Mkvtoolnix-7.0.0.app/Contents/MacOS/mkvmerge" -o "${file%\.*}(1).mkv" ...
1
vote
1answer
23 views

Advanced Wget usage

I have a list of about 200 servers which contain links to individual files, for this question, let's just pretend they're .txt files. I need to download every file, however some servers only have the ...