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

learn more… | top users | synonyms

0
votes
2answers
27 views

Convert all files in directory using FFMPEG

I'm trying to write a script to convert all the files in a directory to m4v, whilst trying to keep similar (if not the same) quality and compress the file to reduce the overall size. I've pieced ...
1
vote
1answer
12 views

Grep with string comparison: return only lines “higher than” a timestamp

I have an email log file which records when an email went out, and who to. This gets logrotated and so there are a mixture of zipped and unzipped log files going back a week or so. I'm currently ...
0
votes
1answer
296 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
10 views

Scrolling in tmux over SSH (PuTTY) [duplicate]

I'm SSH'ing into my RaspPi (Raspbian) with PuTTY and I want to user tmux in order not to worry about a connection ending while I'm installing something. My Problem is, that when I call tmux from a ...
1
vote
1answer
13 views

Installing GNU Parallel on Cygwin

Is this possible? I have googled and searched at length and found no answer to this question. How can I install GNU Parallel on Cygwin? I wish to run a command similar to this : Link Thanks.
31
votes
3answers
3k views

Can history files be unified in bash?

I routinely run multiple screen sessions on my Linux desktops and servers. A problem with this is that when I grep through my command history, I find I issued a command in a different session, and ...
0
votes
1answer
30 views

Look word inside file in directory

I am new at Bash. I have a directory tags with a lot of .txt files with similar names like this [coral/home/tags]$ ls: file1.txt file2.txt file3.txt file4.txt Each .txt file contains information ...
1
vote
0answers
13 views

Stop automatic comments in my crontab

I have added the bellow cron jobs in my crontab : 0 5 * * * /bin/systemctl restart gb_subagent.service 28 13 * * * /home/comment.sh &>/tmp/errorcron.log 29 13 * * * bash ...
1
vote
1answer
39 views

Interactive menu (autocomplete) in bash with dialog(1)

So we can use dialog --menu ... to make a menu. And we can quick select the option by first letter of the tag. I want dialog to register keystrokes and perform the autocomplete. E.g. we have 3 ...
2
votes
1answer
21 views

Print line for word found in file in directory

Hello i am using this line find ./ -iname *txt | xargs grep "ququ" -sl>holis.txt To find "ququ" text in a txt file and then write the file name that does contain such word in the txt file, ...
3
votes
2answers
61 views

Linux's write command issue

I'm trying to send a message to myself through write command because I want some scripts running in the background and being able to echo things to the terminal where I am. So, I get always the same ...
42
votes
10answers
29k views

Unix: ls, how to sort first directories then files etc

I would like to use ls command to first show direcotries and then files. I tried ls -la | sort -k 1 But I got a wrong order.
0
votes
2answers
40 views

Bash scripting parted for GPT

Using Bash & Python scripts in Ubuntu 12.04, we are delivering a disk image to customers as a file (generated by dd). Once dd’d to the new disk, we resize the partition to fit the disk. Now that ...
0
votes
2answers
17 views

Mac OS .bash_profile errors

I'm running Mavericks 10.9.5 and I have tried to install Metasploit from this guide. It was until the Install Homebew I used echo PATH=/usr/local/bin:/usr/local/sbin:$PATH >> ~/.bash_profile ...
1
vote
1answer
22 views

How To Quickly Switch Paths (in Bash)

Sometimes, usually when installing packages with brew, I want to disable/remove certain parts of my path, and then later restore them. I haven't been able to find an easy way to do this, and while I ...
11
votes
4answers
1k views

bash: colorized man page

Where do I have to take a look at in the system to colorize the man pages? The man pages are viewed with less, so I tried adding the following lines to my .bashrc to change the colors: (Which works ...
2
votes
2answers
371 views

gnome-terminal - color palette

I'm trying to assign color palette on my gnome-terminal but it doesn't change at all... any clue? Screenshot > http://i.imgur.com/MXXhoOo.jpg Aditional info: Fedora 18 64bits (shiny new) GNOME ...
1
vote
3answers
206 views

VIM/Screen background color is inverted for non-text characters

I'm trying to use a vim while inside a screen session. For some reason, the background color for the parts of the screen without text are displaying as dark while the parts with text are displaying as ...
1
vote
1answer
12 views

How to confirm apt-get confirmation during mysql-server installation

I am trying to write bash script that will install mysql-server-5.6 I want to ask user for password and then I will use it during installation mysql-server and some other configuration. But my script ...
24
votes
1answer
4k views

How can I get bash to perform tab-completion for my aliases?

I have a bunch of bash completion scripts set up (mostly using bash-it and some manually setup). I also have a bunch of aliases setup for common tasks like gco for git checkout. Right now I can ...
0
votes
2answers
578 views

Pseudo- Sudo on Cygwin/bash

I need sudo to work, well not sudo itself but a way of allowing the sudo commands to work as described here. This would be great however the sudo lines have extra arguments, like : sudo -u user bash ...
1
vote
1answer
19 views

Multiple input files and output files in awk

I have a folder full of text files named 000.txt to 181.txt. How can I process all of them (on the command line) with the same awk script (program.awk) and send them to their respective output files ...
4
votes
1answer
131 views

Mounting a directory from the host in boot2docker for Windows

I'm running docker 1.6 and boot2docker on a Windows 8.1 box. When I use the Boot2Docker Start shortcut, it takes me to a cygwin bash prompt where I can run docker commands natively. I'm having ...
0
votes
1answer
13 views

Do filtergraphs copy audio streams by default in FFMpeg?

I 've got the following command in FFMpeg: ffmpeg -i file_input.mp4 -filter_complex split=2[i1][i2];[i1]scale=trunc(oh*a/2)*2:480[o1];[i2]scale=trunc(oh*a/2)*2:640[o2] -map [o1] -map 0:a -pix_fmt ...
0
votes
2answers
20 views

Which .bashrc file to edit

On my raspberry pi (running raspbian), I'd like to edit the .bashrc file so that various actions can be performed at every login. However, I have found two .bashrc file on the system: one is located ...
2
votes
1answer
11 views

How do I encode a hyphen in a Bash terminal's open command?

I'm trying to write a small script that launches Beyond Compare when I do an svn diff. I got it working up until so far: open -a /Applications/Beyond\ Compare.app "$6" "$7" To get the full ...
0
votes
1answer
10 views

Alias to shortcut from home folder not working

As per this question on How to set up a shortcut to a directory in Mac OS X Terminal? I've added the following alias: alias MeteorApps=‘cd ~/Documents/Github/MeteorApps’ By adding it to the bash ...
5
votes
3answers
6k views

How to create symbolic links to all files (class of files) in a directory?

I would like to create symbolic links (ln -s) to all files (or a class of files, e.g. ending with .bar) in a certain directory. Say I'm in the cwd and type ls ../source/*.bar gives me foo.bar ...
6
votes
4answers
1k views

How to check if cygwin mintty/bash is run as administrator?

Problem Statement: What is the most elegant and robust way to test if Cygwin mintty bash session is "Run as adminstrator"? Why, specifically? I have typically several mintty terminals open when using ...
0
votes
2answers
17 views

Can bash `locate` command generate numbered results / aliases?

I want to avoid having to type or copy-paste a full path. Ideally, I would like to see and be able to do something like this: $locate test.txt 1 /dir1/test.txt 2 /dir2/test.txt $ vi !1
0
votes
0answers
10 views

How to get Fish shell and NVM both installed with Homebrew to work together?

I am trying to manage my packages for OSX using Homebrew as much a I can. I have installed both the Fish Shell and NVM using Homebrew but cannot get Fish to recognize my NVM installation. NVM ...
2
votes
1answer
25 views

Gnome Terminal tab completion placing text in odd areas

Using tab completion in gnome-terminal appears to be placing text in odd areas, such as to the left (on top of my prompt) or above, sometimes. Here is an example of what happens when it places it over ...
2
votes
4answers
85 views

What is a backslash colon doing in this chown command?

What is the \: doing in the command below? sudo chown nobody\: folder/ Is it some kind of mistake?
5
votes
6answers
7k views

Is it possible to gunzip multiple files to a specific directory without deleting the original gz files?

I know this can be done for single files, e.g. gunzip -c my.gz > somedir/my Can it be done for multiple files? [UPDATE] I have a directory with a large number of .gz files (not .tar.gz), and I ...
72
votes
7answers
70k views

How do I add text to the beginning of a file in Bash?

Hi I want to prepend text to a file. For example I want to add tasks to the beginning of a todo.txt file. I am aware of echo 'task goes here' >> todo.txt but that adds the line to the end of ...
0
votes
0answers
6 views

Distinguish TAB and ENTER from C-i and C-m in .inputrc

The history: I'm remapping most of the basic commands to move, delete, search history for all my command-line based applications (Bash, Python, SQLite, etc) by modifying the .inputrc file in my home ...
0
votes
1answer
24 views

After creating .bash_profile…Terminal not working

I created a new .bash_profile file and entered the following: export PATH="usr/local/bin:usr/local/sbin:usr/local/mysql/bin:$PATH" I then deleted .profile. Because from what I learn't it causes ...
0
votes
1answer
30 views

in linux using bash how can I split a text file based on percentage

I have a problem where I need to split files based on some arbitrary percentage. If I have 100 lines I need to have the file split by a 70 % / 30 %. The split program in linux does not give me the ...
2
votes
1answer
20 views

grep -l output filenames with spaces

I want to loop over files with for f in `grep -rsl "foo" . `: do sed -i -- "s/foo/bar/g" $f; done; But since filenames contain spaces, a filename is split whenever a space is found. How can I ...
0
votes
2answers
26 views

How to copy file using awk based on time creation to some directory

I trying to copy a file to directory using awk filter based on time creation file #!/bin/bash dir=/home/resaputra23/pyexample/python2/* des=/home/resaputra23/pyexample/backup/ file1= stat $dir | awk ...
3
votes
5answers
10k 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 ...
10
votes
8answers
11k views

How do I queue multiple files for copying on a Mac?

When I copy multiple files on a Mac, the system tries to copy them all at the same time. The problem is two-fold. First of all, when you select multiple files and copy them, they all go into one ...
0
votes
0answers
13 views

Mac OS X: Shell command for Accessibility -> Sound -> Play stereo as mono? [duplicate]

The question is in the title. I need a quick way to turn the feature on and off every now and then. Is there a bash command for it?
6
votes
2answers
2k views

Bash autocomplete like zsh

I'm using bash, but I'd like to have zsh style autocomplete (you hit tab and it tabs through the possibilities), rather than what bash seems to do, which is display a list of possibilities but not ...
2
votes
1answer
12 views

Wrapping `time` (and similar keywords) in call from another script

I have a Bash script (let's call it clock) which should work as a wrapper similar to the time keyword in Bash, e.g. clock ls should do something and then run ls. Here is an example of this script: ...
0
votes
0answers
15 views

bash completion in msysgit by single or double tab

Single tab used to make bash complete current line, and double tab shown all possible variants. For example, if I have files (or git branches, or whatever is suitable in current context) "abc", "abd" ...
7
votes
4answers
329 views

Running `exec` with a Bash built-in

I defined a shell function (let's call it clock), which I want to use as a wrapper to another command, similar to the time function, e.g. clock ls -R. My shell function performs some tasks and then ...
0
votes
3answers
37 views

Create a new Mac Terminal command to copy folder

How can I create a new terminal command that copies a folder (this will always be the same folder) and it's contents to either the current directory (if no path is supplied) or to the path supplied. ...
8
votes
7answers
21k views

Sudo - is there a command to check if I have sudo and/or how much time is left?

(Originally posted on Stack Overflow. They suggested I try here instead. Here's the original post: ...
14
votes
10answers
29k views

Filesystem full: how to find the biggest directories or biggest file? [duplicate]

Under Linux, I'm looking for a command to list the biggest file and/or the biggest directories under a directory.