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

learn more… | top users | synonyms (1)

7
votes
3answers
267 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 ...
3
votes
2answers
369 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 ...
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 ...
2
votes
2answers
34 views

Run .sh with Desktop entry without closing terminal

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
18 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 ...
7
votes
4answers
489 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 ...
1
vote
1answer
14 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
186 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
181 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
16 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
237k 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
5 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
30 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
40 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
73 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
2k 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
15 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
101 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
300 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
44 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
843 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
615 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
11 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-...
2
votes
1answer
29 views

Cancel and restart a certain Routine (python-script)

I have a question regarding a programm I run. Every once in a while, I need to restart a certain program. For that case, I usually run: screen ./run.sh arg1 arg2 "arg3" (screen, since I don't know ...
4
votes
4answers
3k views

Can't run Bash script

I am trying to run a simple Bash script called deploy-site.sh (by http://klau.si/dev). I made the necessary edits to run it locally (change of WORKDIR, etc). I also followed the instructions here. ...
10
votes
9answers
38k views

Filenames with spaces breaking for loop, find command

I have a script which searches all files in multiple subfolders and archives to tar. My script is for FILE in `find . -type f -name '*.*'` do if [[ ! -f archive.tar ]]; then tar -cpf archive....
3
votes
1answer
46 views

Ubuntu 16.04 Imagemagick convert jpg webp

I was wondering about the following; I use the following command to find .jpg files in (sub)directorys and convert (mogrify) them to .webp files. find . -name '*.jpg' -execdir mogrify -format webp {...
4
votes
1answer
35 views

Comment, Uncomment, change setting based on string, add line from terminal

I have to edit some files to uncomment a line, change a value on that line or uncomment a line. I am trying to do this through a bash script. I am trying to edit /etc/ssh/sshd_config and change ...
0
votes
2answers
27 views

Run Executable After login [duplicate]

So I have an executable (output of gcc compiling a C program), that I would like to run after login so it is the first thing a user sees upon login. It is a graphical menu that displays system ...
0
votes
1answer
27 views

How to start a gnome-terminal without loading profile (like bash --noprofile --norc)

Can I start a gnome-terminal without loading profile? (just like bash --noprofile --norc) Sometime I made mistake in writing .bashrc and find no way (except ssh from another machine) to access that ....
22
votes
2answers
19k views

Split a large file into smaller files and then integrate them to get the original file

How do I split a 7GB (movie) file into smaller files of (say) 1GB, and then (in another Ubuntu computer) integrate them to get the original file (using just bash commands)?