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

learn more… | top users | synonyms

1
vote
3answers
292 views

Two simultaneous commands, then sequential commands?

So in Linux, I want to run a script 4 times, then do stuff to the output. I can do: script 1 > output1.txt script 2 > output2.txt script 3 > output3.txt script 4 > output4.txt cat ...
1
vote
1answer
356 views

resizing a terminal within tmux doesn't seem to work

I'm new to tmux, and I'm having trouble finding a solution to resizing my actual terminal (I haven't learned quite enough about panes and windows yet). I'm running tmux1.6, and bash as my shell, on ...
2
votes
3answers
275 views

Permanently set `find` regextype

GNU find allows the use of different regex formats via the -regextype option, but as far as I can tell I have to type out -regextype <whatever> every single time which is onerous. If one wants ...
1
vote
2answers
4k views

How to run a program and get its PID in the background

I have a Minecraft server startup script that looks like this: #!/bin/bash cd "$(dirname "$0")" exec java -Xmx4096M -Xms4096M -jar minecraft_server.jar How do I get java process's PID while being ...
1
vote
1answer
216 views

many doubts related to the ldconfig command?

I am pretty new in Linux and I have some doubt related to this operation that I have found into a bash script on which I am working: ldconfig -v >> /dev/null 2>&1 Reading on the man ...
1
vote
2answers
296 views

some doubts about chown command in linux?

I am pretty new in Linux and I have a doubt related to the use of the chown command use. If I have something like this: chown -R root:root /usr/share/MyApplicationDirectory What exactly mean? I ...
0
votes
1answer
607 views

How to configure in crontab with condition statement for checks

We like to monitor the NAS storage mounted on a Linux box. We only like to be notified via mail when the usage exceeds a certain number, say 80. We have only seen in Linux books where most of them ...
-1
votes
1answer
323 views

How to allow user to input file names in bash script

I've got this script I called it "r1": for f in "$@" do fpath=`dirname "$f"` file=`basename "$f"` arc=$fpath"/"$file".rar" rar a -v1024000 -r -m0 -ep1 -o- "$arc" "$f" done It works well but I am ...
1
vote
1answer
175 views

Bash preexecute

I'm trying to write bash command wrapper, which will be patch bash current command on the fly. But i'm faced with the problem. As i'm not a good Shell user, i can't write right expression of variable ...
0
votes
1answer
2k views

Linux Mint something wrong with my .bashrc

The path of my .basrc file is /home/vamsi/.bashrc It is weird that my file has nothing but the path I set. I think I am using a file at the wrong location or that I have lost my .bashrc file as ...
1
vote
1answer
222 views

A screen virtual LED on linux

We have some LEDs on our machine to indicate the status of Caps Lock, Num Lock etc. Now I need a virtual LED in Linux to notify something. For example, I wrote a script to monitor a website. When ...
1
vote
1answer
4k views

Error: cut: the delimiter must be a single character in linux

I am trying to cut the first and the second column from studata.txt and the second column from studata1.txt. studata.txt: 1 a 10 2 b 20 3 c 30 studata1.txt: i si co oi me zi Here is my bash ...
2
votes
1answer
3k views

How would I `wget` files and then save them by date downloaded rather than filename?

My goal: To download 131 JPEGs and save them in a file name format that is relative to the date/time format rather than their file name. I have already tried things that involve changing the files' ...
1
vote
1answer
599 views

Bash Script for Rar command

I need a script to rar my files usage will be like this r1 archivename fileordirtocompress with following attributes rar a -m0 -v1024000 -r How whould this bash script look like? #!/bin/bash ...
4
votes
1answer
406 views

'rename' on files with apostrophes

I'm trying to batch rename some files using the rename utility (specifically the perl version, i.e. prename). Unfortunately, the file names contain apostrophes, and it's messing things up. I'm not ...
0
votes
2answers
3k views

How to concat String, File Contents, and String in bash script?

I have a file which contains only one line $> cat file.txt apple,orange,cat,dog I need to append two String to it and assign it to a variable, one in front and another in the end, so that it ...
0
votes
1answer
89 views

How to execute a script 20 at a time with different variables at a time in parallel?

I am trying to run 20 files at a time, using warc.sh or a better way to put it is 20 instances of warc.sh at a time with directory contents as the input. I am also trying to watch the PIDs in case bad ...
1
vote
0answers
57 views

Msys cd .. command takes me to home directory instead of parent

I'm using Msys on Windows 7 with what I believe to be a Bash shell. I want to navigate the following directory structure: Drive (M:) +--- Coding +--- CPP +--- projects +--- ...
1
vote
1answer
220 views

How do I get `set show-all-if-ambiguous on` in my .inputrc to play nice with the Python interpreter?

I noticed that after I added the set show-all-if-ambiguous on line to my ~/.inputrc, whenever I pressed tab to indent a block, it would show me the bash Display all ... possibilities? (y or n) prompt, ...
2
votes
1answer
691 views

Setting up a shared remote git repository without root privileges (solved) using ssh keys to manage per user access?

I'll first explain my setup. I'm working on a non-self managed system on which I have an account without root/elevated privileges. On this system I want to share multiple git repositories to different ...
0
votes
3answers
1k views

How to keep variable preserve while running script through ssh

I am trying to run while loop with read through ssh: #!/bin/bash ssh root@10.10.10.10 "cat /var/log/syncer/rm_filesystem.log | while read path; do stat -c \"%Y %n\" "$path" >> ...
0
votes
3answers
59 views

Matching a sequence of symbols in bash

I would like to list all Fortran 90 files in bash without files ending in _tst.f90. My best try so far is ls -l ../src/*[!_tst].f90 According to Bash reference on pattern matching [!_tst] takes ...
0
votes
2answers
3k views

Sending Mail on Linux via Bash/Command line

I'm currently trying to send mails via bash script on Linux. I searched the internet and found this code: echo "This is my body" | mail -s"this is my header" thisis@my.mail I don't get any ...
0
votes
1answer
118 views

gnu-screen does not clear all its contents upon leaving it

I am using screen in bash under CentOS. After leaving a screen with Alt-a d, I am back in bash as expected. But there are remnants of the screen output left, in particular the status line (don't know ...
0
votes
4answers
60 views

Possible to display all files in the current dir with a filename that does not start with an even digit followed by any alphabetic letter?

I am attempting to answer this problem for a COSC class that focuses on Linux/Unix. I am using Linux with bash shell. I am new to Linux as of September. My instructor has this question in this ...
1
vote
1answer
595 views

Append text with dynamic value in a text file by echo command in bash

I want to append some text in a file through a shell script. I have the following script bash -c 'echo -e "\nserver.id=$1" >> file.properties' saved in the file script.sh This is how I run ...
1
vote
1answer
420 views

What is the easiest way to turn a list of music files into a playlist

I recently switched from windows to linux and the player I was using in windows stored the rating for flac files inside an id3v2 files which clementine, my preferred linux media player, cannot read. ...
3
votes
1answer
1k views

Unknown system name showing up in terminal

Ive been working on some command line stuff with an external developer through team viewer for work, to interact with th CL i use terminal on OSX, when working with the developer i was always watching ...
0
votes
2answers
358 views

Copy file names to another folder

I need to copy file names from one folder to another. File contents are never changed. No files are overwritten, moved or copied. It's only about file names. I have a folder A with files named: ...
0
votes
2answers
1k views

Backup all plesk MySQL Databases to individual files

Hy, Because I'm new to shell scripting I need a hand. I currently backup all mydatabases to a single file, thing that makes the restore preaty hard. The second problem that my MySQL password dosen't ...
1
vote
5answers
2k views

Bash script that starts a process for 4 seconds, then kills it doesn't work

I have a script that starts firefox for 4 seconds, then kills it. Firefox will automatically log into a captive portal, so I only need it to be open for 4 seconds, as soon as the wifi connects. I am ...
1
vote
1answer
3k views

Why does subshell not inherit exported variable (PS1)?

I am using startx to start the graphical environment. I have a very simple .xinitrc which I will add things to as I set up the environment, but for now it is as follows: catwm & # Just a basic ...
0
votes
1answer
351 views

UNIX script to LPAD update query in cat file

I want script which will open the text file data and write update query to those file and save in SQL file which will get executed through cron. I have prepared command but its writing the update ...
1
vote
4answers
639 views

Problems when loop over a series of ssh-ed commands

I have a series of server machines which I want to run the same command on. Each command takes hours and (even though I am running the commands using nohup and setting them to run in the background) ...
2
votes
2answers
70 views

List folders in Linux which can only be seen if accessed

Maybe it is a amateur question but here it goes: At the university we have a folder /vol. This folder is absolutely empty until you "cd" into a directory which exist there. E.g. "cd ...
0
votes
1answer
185 views

How to transform a csv to combine matching rows?

I have a CSV file with some transaction data. Let's say date, volume, price and direction (sell/buy). Additionally there is a ID for each transaction and on each closing transaction (the newer one) ...
1
vote
2answers
46 views

Subdirectories in prompt?

I'm working on making my prompt as useful as possible. Right now, it contains the date, time, and directory, along with a colored divider line so I can easily see where each batch of input starts. I ...
1
vote
1answer
573 views

ffmpeg - join / merge on top of each other

I'm trying to join together two videos on top of each other. I already did these two ffmpeg commands: ffmpeg -i 2_Out_of_Control.VOB -aspect 16:9 \ -vf ...
2
votes
2answers
376 views

Why did my bash prompt turn to gibberish after I accidentally ran `cat` on a .coverage file?

I had just installed coverage and run it a few times when I noticed a .coverage file hanging around in my repo, which is -- according to the file utility -- a 8086 relocatable (Microsoft) file. And ...
1
vote
4answers
3k views

Linux: Run command on a batch of files, with matching output files

A simple task: given a directory of files and a command that takes one file as input and produces one file as output, I want to process all the files in a directory at once and output them with ...
0
votes
2answers
147 views

What does the * mean next to a filename in the ouput of the command ll? [duplicate]

I have a doubt related the output of ll command. When, in my shell, I execute the ll command I obtain this output: -rwxrwxr-x 1 andrea andrea 104215 ott 15 15:56 atmosfs* Why I have the * next to ...
6
votes
4answers
2k 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 ...
1
vote
1answer
30 views

How to configure bash to prompt history?

With fish-shell, if I type a few words of a ran command, I will get a prompt of the whole command line. Then I just use Right Arrow key to complete the whole line. But on other things, fish-shell ...
0
votes
3answers
160 views

What is the terminal I use in OS X Terminal?

I go to OS X Terminal, sometime people just give me the command grep , ls, some people called it is shell script , some people call it unix shell. I also got a term bash shell, Bash command. So, I ...
0
votes
1answer
447 views

How can a bash script run several others scripts?

I try to make a bash script to run multiple scripts located in different directories. I tried to do something like #!/bin/bash path1="/path/to/folder1" path2="/path/to/folder2" ...
1
vote
1answer
127 views

Using the secondary IP in a bash script

I have a Primary IP set for all the system related tasks. Sometimes I have to use my system to carry out different tests and most of the time I have to deal with bash/shell scripts. I want the ...
1
vote
3answers
2k views

SSH session hangs when trying to open a shell

Since this morning I cannot login normally on my server using SSH anymore. Typically, when typing this: ssh foo@bar.org The shell hangs and does not acquire shell. The last line of verbose with ...
0
votes
2answers
280 views

create file in directory without x permission set on directory : How?

From this page, http://content.hccfl.edu/pollock/aunix1/filepermissions.htm, I understand that I need the +w bit set in a directory to create a new file and +x bit to cd into it/access its inode. So ...
1
vote
1answer
80 views

If you're using stdout-stdin already, could you somehow use a higher file descriptor?

Can the following be done without creating a temp.pem? openssl pkcs12 -passin pass:notasecret -in $DATASTORE_PRIVATE_KEY_FILE -nocerts -nodes -out temp.pem cat myfile | openssl sha -sha256 -sign ...
1
vote
3answers
68 views

String replacement in filenames in linux

I have a tonne of files called File30_i.txt for i=1, 2, 3, 4, 5... Is there an easy way to quickly rename then File20_i.txt for example?