Bash is the shell used in Ubuntu's command-line interface.

learn more… | top users | synonyms (1)

1
vote
2answers
35 views

How can I use conditional constructs in a bash case statement?

I need to check the return codes of two sub-scripts launched from within a wrapper script, using the Bash shell. If either subscript fails they will produce a negative integer as a return code. If a ...
0
votes
0answers
9 views

Create Package To Install Programs

Is there a way in Ubuntu to create a package or a script that when double clicked will install packages such as Lamp & Joomla? Not sure if Ubuntu already has a pre-configured package to do this, ...
1
vote
0answers
24 views

SSH session doesn't export functions

I have a bunch of functions stored in ~/.bash_functions, which is sourced by ~/.bashrc on shell startup. The file exports all the functions like so: # Find functions in this script based on a grep ...
2
votes
2answers
596 views

pdsh works well standalone, but doesn't work in script

I am trying to install hadoop via script on my small cluster [introduced in the book: Apache Hadoop Yarn]. I have set up ssh connect without password, and pdsh&pdcp are all fine if I use it alone. ...
2
votes
2answers
4k views

What does “.bashrc or prepend the Anaconda install location” mean?

I installed Anaconda from root, after completion of installation this message was displayed on terminal screen: Python 2.7.8 :: Continuum Analytics, Inc. creating default environment... installation ...
-2
votes
0answers
26 views

Help with text files in terminal

I have a text file with 3 columns: the first column has a number, in the second column I need to put a number, and I want it to automatically multiply the number in the first col with the number in ...
0
votes
0answers
9 views

architecture scanning

I am working on a toolkit for the company i work for, the problem is, one of the tools in this 'kit' needs to have the ability to recognize architectures, i already got 32 and 64 bits working but i ...
1
vote
1answer
12 views

Matlab related Sh file command not found

I'm trying to launch a program (ExploreDTI) which uses Matlab Runtime R2014a (8.3). I have a MainExploreDTI file (Executable (application/x-executable)) and a run_MainExploreDTI.sh sh-file. In ...
7
votes
4answers
523 views

Detect if a tool is already in execution but ONLY for current user

Until now I used pidof -o %PPID -x "my-tool" To detect the pid of an eventually running instance of my-tool. This is the short version of my-tool file, an executable bash script #!/bin/bash if ...
27
votes
7answers
27k views

Script to display all terminal colors

Throughout the internet I have seen many people with scripts that prints out a bunch of stuff in all the colors defined in ~/.Xdefaults. However when I try to use these, I always get error: Bad ...
7
votes
3answers
274 views

copy/move multiple files using cp/mv without using regular expressions

Suppose I have a folder containing some files and some folders(files can be of any type). And I want to move/copy some of those files and folders using mv/cp command. Is there any way, such that I ...
4
votes
2answers
765 views

I permanently changed my PATH variable by mistake, and I am unable to login now. How to change my PATH variable to default?

I used sudo -H gedit /etc/environment command on terminal to permanently change my PATH variable. To correct it, I pressed Ctrl+Alt+F1, and used export PATH command but the access was denied. Many of ...
2
votes
2answers
35 views

Run .sh with Desktop entry without closing terminal [duplicate]

Here is my desktop entry to run "PRGM.sh" [Desktop Entry] Encoding=UTF-8 Name=PRGM Comment=Launch PRGM Exec=gksu /home/markku/PRGM.sh Icon=utilities-terminal Type=Application Terminal=true The ...
12
votes
3answers
2k views

What does [co] mean in the “rm -rf filename[co]” command?

Let's say I have two files in /tmp: root@ubuntu:~# touch /tmp/hello.{pyc,py} root@ubuntu:~# ls /tmp/ hello.py hello.pyc Now, lets run rm -rf command with [co] option root@ubuntu:~# rm -rf /tmp/...
0
votes
1answer
19 views

Makefile problem

I was trying to make make command for a code in the remote computer.I found there is a problem and refuse to complete compiling. I need to get the logic of thinking on how to know the problem and ...
1
vote
1answer
15 views

How to change Windows line-ending to Unix version [duplicate]

We have 10 PC with some version of Ubuntu and only remote access. While doing some upgrades to custom software I did not notice that the line endings in some scripts were Windows version (CR+LF) and ...
8
votes
1answer
196 views

How to display modified time of a file?

I'd like a method to find and print the modified time of a file, for use within a bash script. I have come up with: ls -l $filename | cut -d ' ' -f '6-8' Which outputs: Jul 26 15:05 Though I'd ...
1
vote
3answers
194 views

How to use AND and NOT both in single grep command

I'm creating one of shell script, In which, I need to filter process except own grep process. If I use : echo "step1" psout=`ps -aux | grep 'deluged'| grep '58846'` echo "step2" echo $psout ......
0
votes
0answers
19 views

Problem with startproc command

I have a problem with startproc command Even though the package sysvinit-utils is installed I get an error : Starting DLS Daemon ./dls: line 131: startproc: command not found failed Here is the ...
148
votes
8answers
238k views

How can I decode a base64 string from the command line?

I would like to write a bash script to decode a base64 string. For example I type decode QWxhZGRpbjpvcGVuIHNlc2FtZQ== and it prints Aladdin:open sesame and returns to the prompt. So far I have tried ...
0
votes
1answer
14 views

Unable to create alias having pipe

I want to make an alias tree with find ./ -type d -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' as its value. so to avoid mistakes due to ' inside whole line I converted them to \' by which I can ...
0
votes
2answers
16 views

customized shell script can not be run

I have wrote a shell script, show the script myscript.sh #!/bin/bash ssh -t proxy@PROXY -p 22022 "ssh me@REMOATE_MACHINE -p 22022" And I put the script to /opt/scripts/myscript.sh, and chmod u+x ...
0
votes
2answers
29 views

Scripting Problems - Unexpected End of File using IF/THEN

Finally made the move into Linux and decided the best way of learning the ropes was to try my hand at scripting. Trying to make a basic (started really basic and keeps growing) script that ...
19
votes
2answers
14k views

Using “while read…” in a linux script

Could somebody please explain how the following code works? echo '1 2 3 4 5 6' | while read a b c do echo $c $b $a done Specifically, I'd like to know why the output of this loop is 3 4 5 6 2 1, ...
0
votes
0answers
6 views

Unable to configure Ubuntu kiosk mode 12.04

Setting Up Ubuntu as a Kiosk Web Appliance How-to Ubuntu Kiosk How to set up an Ubuntu Kiosk Ubuntu Web Kiosk in 10 Easy Steps I saw the websites above but I am unable configure kiosk mode. I ...
0
votes
0answers
33 views

Change bash shell to look like the one on heroku demo

I am in love with the bash shell look and feel show in the intro video of heroku. Anyone has got an idea how I can implement this kind of bash look :
0
votes
2answers
44 views

spawn command not found on ubuntu 14.04

I'm using Ubuntu 14.04 and I want to block SSH login country wise using GeoIP ( From https://www.axllent.org/docs/view/ssh-geoip/), Please find output of command: $ spawn spawn: command not found ...
35
votes
7answers
74k views

How to run an alias in a shell script?

I have an executable file mpiexec, whose full path is ~/petsc-3.2-p6/petsc-arch/bin/mpiexec. Since I want to execute this command in different directories (without having to retype the entire path), ...
2
votes
1answer
74 views

Bash History: Default size should be 500 but getting 1000

As this question suggest that bash keeps last 500 entries in history. But following command suggest otherwise, $ echo $HISTSIZE 1000 I have never changed bash history settings or config files other ...
1
vote
1answer
22 views

C Shell variants and Bourne Shell variants [duplicate]

What is the difference between: C Shell variants and Bourne Shell variants? I must install a scientific software, during the installation I must write ./configure >& config.out & ## C ...
0
votes
0answers
11 views

How to check if another ubuntu machine already has remote connection happening?

What is a good way to check (preferably through bash script) from an ubuntu machine A, if ubuntu machine B is already remotely connected from ubuntu machine C? This is assuming that these machines ...
0
votes
1answer
29 views

.bash_profile not working

I'm trying to set AVARIABLE in my bash_profile: echo export "AVARIABLE=example" >> ~/.bash_profile then source ~/.bash_profile After that, AVARIABLE should be working, but... bash: ...
0
votes
1answer
21 views

how to remove pdf studio from ubuntu 14.04

Recently I installed PDF Studio 11, Trial(Evaluation) Version. As far as I remember, I downloaded it from their website, and the file "PDFStudio_v11_0_2_linux.sh" is at /home/.../Downloads. In ...
0
votes
1answer
21 views

Adding a different PATH [duplicate]

I'm in trouble adding a different PATH. When I add it like that : export PATH=$PATH:/opt/file/base/bin/linux-x86_64 It works fine for the current terminal. But when I close it and open again, it ...
4
votes
4answers
200 views

Capturing only a section of a command output

If I were to type a certain command, it would give me a long output in the terminal. I only need a few characters of this output. How do I, in a bash script, save only certain characters from a ...
10
votes
2answers
45k views

How to make terminal autocomplete when there are several files/directory?

If I have several directories, like: afoo abar sometimes my terminal will refuse autocomplete when I press tab (e.g. "cd a" then tab), and print the list of directories instead. Sometimes it even ...
11
votes
4answers
3k views

What is the differences between &> and 2>&1

There are two forms of redirection the standard output and standard error into standard output. But which one is better? and why the &> is considered the perfect? I can't find what is the ...
3
votes
1answer
18 views

How to use the update function in 'rhash'

I'm having trouble using 'rhash' to update an existing file containing md5 checksums on Ubuntu server 14.04. Here is my script: #!/bin/bash sudo rhash -r -u --md5 /checksum/these/files --output=/...
0
votes
1answer
16 views

trouble installing RVM

I am trying to Install RVM but facing error. I am using following code to install RVM sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev gpg --keyserver hkp://keys....
2
votes
0answers
26 views

scroll lock modifier for arrow keys

Most laptops these days have the pgup/pgdn/home/end keys as fn overlays of the arrow keys. It has always been a minor annoyance that the fn key is on the other side of the keyboard, making one-handed ...
2
votes
2answers
104 views

Why I could not create a folder named '/' using terminal?

I tried creating a folder with name '/' using the mkdir command. But it returned a message saying: mkdir: cannot create directory ‘/’: File exists I tried quoting the the name '/', and adding ...
5
votes
3answers
301 views

change text-color of my output on command prompt?

Suppose i've a php file and i want to change text-colour of my output for a console based application... <?php $prompt = "What Is Your Name: "; echo $prompt; $answer = "You Entered: " . rtrim( ...
3
votes
1answer
1k views

How to extract/inject ID3 tags via bash?

I have a huge collection of MP3 files that have ID3 metadata. Is it possible to extract existing tags and images to plain text (e.g. JSON, XML)? Can I inject from plain text to MP3 file? How can I do ...
0
votes
2answers
236 views

Trying to add timestamp to image but keep getting error unknown image property “%[exif:DateTimeOriginal]”

I want to put timestamps on all images in a directory based on the date created/modified. I've seen a bunch of methods like this and this, but they all use the code %[exif:DateTimeOriginal] which ...
1
vote
3answers
45 views

Finding installed packages and the version [duplicate]

I'm very new to ubuntu and I'm trying to find a command that tells what packages and the versions are installed on my "sandbox" I'm looking to bundle this as a output file
2
votes
1answer
845 views

How to use rsyslog?

I've been scouring forums for a few hours and cannot find a concrete explanation on how to use rsyslog. I really just need the basics. I have a log file logFile.log and I want to forward the logs to ...
0
votes
1answer
34 views

sort a lot of file in directory

I have a problem in bash . I have a lot of file(.mp4) nearly 140 that i want to create directory with similar name with that files but the bash show me this file is exist ! how can do it ?
0
votes
0answers
13 views

how to add GLIBC_2.14 and GFORTRAN_1.4 to a remote computer

since I am still beginner in Linux so, I need more explanation for the following; I tried to run -bash-4.1$ ./gtest by the remote computer but it give me the following message. and I need a help to ...
9
votes
4answers
622 views

Create a progress bar in bash

How can I create an progress bar with bash? This is my script: #!/bin/bash pass='number1 number12 number13 number14 number15 number16' chk='number14' for i in $pass ; do if [ "$i" == "$chk" ]; ...
0
votes
0answers
12 views

ISAKMP invalid with VPN connection

I need to create a VPN connection to office.sth.com In the end the var/log/sys/log reads: Jul 20 19:48:02 linux NetworkManager[3364]: <info> [1469036882.5641] audit: op="connection-...