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

learn more… | top users | synonyms

0
votes
0answers
1 views

find /data/oozie-admi/ -type d -ctime +1 | xargs rm -rf [0] command deleted /data/oozie-admi/ folder

/data/oozie-admi/ folder containd multiple directories. find /data/oozie-admi/ -type d -ctime +1 | xargs rm -rf [0] command deleted /data/oozie-admi/ folder . Need to find out scenarioes in which the ...
0
votes
0answers
17 views

Python script to create users and upload ssh keys to remote server from a local machine

This is what I am trying to do. I have a user list csv file containing: user1, SSHkeys/user1.pub user2, SSHKey/user2.pub Store them respectively into $username and $SSHKey Another server list csv ...
1
vote
2answers
28 views

Can `ls` be set to only list the first X files/directories?

I'm trying to make a command which only displays the first 30 files when the ls command is invoked. I found this method... ls | head -30 ... but it ends up spitting out the files in one long list, ...
0
votes
2answers
29 views

Command “find” -exec replacing string

I'm trying to find JPG files in a folder tree to execute the command "" to transform it to PDF. The problem is that the code I am running leaves the file in the same directory and I want to move it ...
0
votes
0answers
15 views

Bash Terminal colors for filetypes

Bash terminal seems to not have colors for certain types of files, such as docx, pdf... Is it possible to add colors for these in the output of ls, or no?
1
vote
2answers
17 views

Nmap runs slower as root than normal user

I am working on a bash script to enable automatic detection and remote control of my company's proprietary data recorders. The recorders run a custom version of linux and are essentially powerful pis ...
0
votes
0answers
17 views

How to close a GUI window from BASH

I can open a GUI window from BASH with the following command: gnome-open /media/UPDATES How do I close it from BASH? (There is no "gnome-close" command.)
0
votes
3answers
36 views

Find files then tar with wildcard

I have a series of files called: 2014111test.log 2014111test.log.stuff 2014111test.log.flibble 2014115test.log 2014115test.log.stuff 2014115test.log.flibble I want to find all the log files over a ...
1
vote
3answers
48 views

Find files and total their size

I'd like to find a series of files and then get a total of their disk usage. Something like this: $ find . -name 'flibble*' -ctime +90 -exec du -sh {} \; 2.1G ./flibble_116.log 2.1G ...
0
votes
1answer
13 views

Type file content, pipe some actions and put result back

Is there way to do something like thas: cat somefile.txt | sort | uniq > somefile.txt I.e. I want to list entire file, then pipe some actions to its content and finally put result back to source ...
1
vote
1answer
24 views

How to Extract Multiple substrings from Log FIle

I am trying to extract the timestamp and the number string in the URL called in an apache logfile that looks like this: 123.456.78.90 - - [16/Dec/2014:06:27:30 +0100] "GET ...
0
votes
1answer
18 views

Up arrow in gnome terminal to review command line history ignores commands with leading whitespace. Is there a workaround?

When writing python code (using gvim) I often keep complex command line commands for test cases saved in my docstrings. A common time-wasting error I make is copying the entire line from the python ...
2
votes
1answer
39 views

Renaming multiple directories

If have a directory structure that stores records based on their date of recording. Originally there was one directory that contained a subdirectory for every single day like this basedir ...
0
votes
1answer
30 views

conemu multiple bash cygwin ssh

I just want to know how to have multiple tabs logged in to a server via ssh to for example ssh user1@1.1.1.1 for a tab named server1 (to some particular folder location) and ssh user2@2.2.2.2 for a ...
1
vote
1answer
16 views

Get user logged into a given tty

I'm writing a bash script that disconnects idle sessions but writes to the tty a few seconds before terminating it to make sure it really is not being used. The format for write is write user [tty]. ...
0
votes
1answer
27 views

What does `-n` option in sed do?

This is the man page entry for -n: -n suppress automatic printing of pattern space I notice that when not using -n for certain operations, each line is printed to stdout (and the requested ...
1
vote
1answer
23 views

Grep fails to find sequence after assign to variable

I run: awk -F ',' '{print $2}' data.dat | sort | uniq | tr '\n' ',' | grep "*)>nS4XkrlH @XUL" and the sequence is located in results. Then I run b=`awk -F ',' '{print $2}' data.dat | sort | ...
2
votes
2answers
195 views

Why does the 'vi' command open 'vim' editor?

I am using Ubuntu 12.04. Not that I am complaining as I like my vim and prefer its many features. However, I’m curious as to why it does it. It is not aliased in .bashrc or .bash_profile. I am not ...
0
votes
0answers
24 views

RVM wants me to edit PATH in .bash_profile - I fear it is a mess

I am trying to get an Omega sub-theme running on my local machine (OSX 10.10) with Acquia Desktop Dev. Trying to run isolated ruby in sub-theme directory. When I use rvm list I get: Warning! PATH is ...
0
votes
3answers
55 views

Bash: executing concatenated variables

I have a Linux bash script, to the effect of: COMMAND_TO_EXECUTE="foo "$1" --option1 --option2 "$2 exec $COMMAND_TO_EXECUTE Problem: the script fails Debugging clue, If I echo ...
1
vote
1answer
27 views

shell script file (.sh) - dynamic command

I'm trying to build a dynamic command to execute in an .sh file, however, when I do it, it seems that somehow it adds \r characters so command is not correctly executed. Notice that I'm running this ...
1
vote
1answer
23 views

Linux bash, command replace

How can I erase the - from clipboard? I have a script: #!/bin/bash xclip -o | replace - "" | xclip Bat this doesn't work So replace \- "" take no effect ]$ uname -a Linux localhost.localdomain ...
0
votes
1answer
16 views

Launch a bash sub-shell and expect a command

From a shell script, how can I launch a bash sub-shell for the user & wait for the user to type exit at the bash sub-shell prompt? I tried bash -c expect -c 'expect "exit" {send "Exiting\n"}'; ...
0
votes
0answers
27 views

Shell command shortcut using input filename as output filename

Hi could someone help me with a little command shortcut please? Im trying to run an ffmpeg command and was wondering if there was a shorter way to type it, Ive been reading up on parameter expansion ...
0
votes
0answers
11 views

Defining git commands on windows

I have a script that I use to add some functionality to git. For this particular case I cannot do it with an alias. The name of the script is git-cim. In linux if I place this script in my path and ...
0
votes
1answer
22 views

Is it possible to check for blips in internet using SSH tunnels?

So basically at work we're losing internet connectivity for just a few seconds at a time, which is enough to kill our SSH tunnels, kill our VoIP calls, etc. I have a cronjob set up with my own script ...
1
vote
2answers
17 views

Is there a way to pass arguments via pipe on bash?

Is there any way to pass arguments via pipe on bash? something like: echo value1 value2 | mkdir -p ./$1/$2 The line above would create the directories ./value1/value2 If this is not possible I ...
1
vote
2answers
12 views

Add directory only once to any variable

I started this question by looking at Add directory to $PATH if it's not already there. In my case, I wanted to do the same to LD_LIBRARY_PATH also. How to do that without writing a script for ...
0
votes
0answers
20 views

Is it possible to modify .bash_logout?

I am trying to modify .bash_logout to append the shell history to a txt file. I am also trying to figure to make some restrictions on that file. I have tried a bunch of commands while searching about ...
1
vote
3answers
37 views

Bash script to find all folders containing a specific file and copy a new file to those folders

I'm trying to write a script that will loop through all subfolders of a directory to search for a specific file and then copy a new file to those folders that contain that file. This is what I have ...
0
votes
0answers
12 views

ddclient updating to public IP instead of private IP

This is the antithesis to question 389125 I have private services (apache, ssh, synergys for example) accessible on a desktop on the local network. This is not with centralised login (ldap/AD for ...
0
votes
2answers
28 views

Bash rename music tracks

I have a folder with around 80 music tracks. I would like to rename them from "Artist - Title" to "01. Artist - Title" all the way through 80. I can't quite figure out how to do this, so could ...
0
votes
0answers
15 views

file RELATIVE_PATH must be passed a full path to the file

Everytime I want to build smth using: cmake -DCMAKE_INSTALL_PREFIX" I'm getting errors like this: CMake Error at /usr/share/cmake-2.8/Modules/CMakePackageConfigHelpers.cmake:177 (file): ...
0
votes
0answers
11 views

In-browser bash

I'm thinking over possible improvement of bash console. As for me, I'm not very happy with terminal shortcuts, which conflict with OS hotkeys. These days I work much with IPython, which has ability ...
0
votes
1answer
37 views

Jenkins SSH Windows node bash error

I have Jenkins server for continuous integration and I want to add another node. Node is Win 7 station which runs Bitvise SSH server. On that Win 7 station is installed Cygwin 32 AND 64 bit (for ...
0
votes
1answer
16 views

Bash: immediately disown job after it is started (Bash inbuilt equivalent of Z Shell's &!)

Is there a Bash equivalent of Z Shell's &! (or &|), i.e., immediately disown a job after it is started? I looked in Bash Reference Manual and searched in Google but can't seem to find anything ...
0
votes
1answer
28 views

OSX bash command line countdown timer

I found here on superuser the following nice countdown script that I could include in my .bash_profile: function countdown(){ date1=$((`date +%s` + $1)); while [ "$date1" -ne `date +%s` ...
1
vote
2answers
29 views

Having trouble replacing a specific hyphen in directories that follow a specific format in Bash

I have a list of directories using the format: 2014-12-03 13-03 2014-09-03 12-07 etc. I need to change them to: 2014-12-03 13:03 2014-09-03 12:07 … I’m trying to do this with for d in *\ ...
0
votes
0answers
12 views

How to check a range of zipped files

I am looking for any ideas how to check for particular entry in given range of time in logs. If I am checking logs just from one day, I can do the following: more /var/logs/log.08.12.log | grep ...
0
votes
1answer
13 views

Move spam emails from directory - bash script

I am trying to write bash script wich can cleanup my whoole server from spam emails that already are present in my client's folders. I would need this script to do, Check recursively directory ...
0
votes
2answers
32 views

Copy only *.h files with subfolders structure bash

I need to write a script to copy only *.h files with saving the folder structure: now it looks like this: cd "${SRCROOT}" echo 'Copying Cocos Headers into Framework..' cd .. for H in `find ...
58
votes
4answers
5k views

Why would you `cat /dev/null > /var/log/messages`?

On this bash scripting example page the author presents this script: # Cleanup # Run as root, of course. cd /var/log cat /dev/null > messages cat /dev/null > wtmp echo "Log files cleaned up." ...
0
votes
0answers
20 views

Pulling a repo on Raspberry PI boot?

I'm getting stuck on this : I try to make a git pull on a repo on Raspberry boot. What I've done so far : In /etc/rc.local : su pi -c bash /home/pi/boot.sh My boot.sh script : #!/bin/sh set -e ...
0
votes
1answer
15 views

Bash on android [closed]

I have a rooted sony z2 smartphone and I'm able to run sh scripts, I also have busybox installed but I'm unable to work out how to run bash scripts, I've tried ls -l /bin/bash from terminal and get ...
0
votes
1answer
37 views

Where does bash get its hostname data to set HOSTNAME and how can I change it permanently?

I know that you can do something like this: export HOSTNAME=xyz echo $HOSTNAME And you will see the changes made. However, where does bash read from on startup to set this environment variable? I ...
1
vote
1answer
26 views

Linux unzip: don't prompt user

I need to unzip a file in my nodejs script: var exec = require('child_process').exec; var execOptions = { timeout: 15000 }; exec('bash unzip.sh', execOptions, function (error) { ... }); In ...
1
vote
1answer
23 views

How to delete unwanted directory paths in zipped file?

Using bash on OS X 10.10 I'm zipping a folder and saving it elsewhere using this: _now=$(date +"%Y-%m-%d-%H-%M-%S") pushd /Users/me/Documents/local-backups/writing zip -r ...
0
votes
1answer
17 views

Looking for bash command to recursively find and copy only files from one dir hierarchy to another

Is it possible to run a command using bash that will replace all the files in one directory structure with all the files in another. For example, if I have these two directory structures: dest dest/A ...
0
votes
1answer
23 views

Long commands typed in bash overwrite the same line

Since We updated Bash to 4.3.27 when I type a long command, if it reach the end of terminal window, instead of continuing in a new line, it overwrites over the same line using a ">" at the beginning ...
0
votes
1answer
35 views

Look up SSID my Wi-Fi interface is associated to, based on interface's IP address

How can I use bash to get the SSID name of the Wi-Fi network my Wi-Fi interface is associated to, when I know the Wi-Fi interface's IP address? I get a list of IP addresses by using the ifconfig ...