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

learn more… | top users | synonyms (1)

3
votes
2answers
125 views

adding zero to specific location of file names

I have a directory consists of several files. Files name are as follows; 0102920.05o 0203920.05o 0304920.05o .... I need to add "0" for all files after the first 4 numbers like; 01020920.05o ...
6
votes
5answers
1k views

Get one element of path string using bash

I have an ASCII file containing filepaths which I read by running: while read p; do echo $p; done < filelist.txt The file contains filepaths with the following pattern: ./first/example1/path ...
4
votes
1answer
46 views

Why doesn't cp detect '\ ' (backslash+space)?

I was trying to write a shell script to copy files. Here is what I have done. workingDirectory=$(pwd | sed "s/ /\\ /g") Now echo $workingDirectory shows /home/user/Documents/Learning and ...
1
vote
2answers
59 views

/bin/sh, /bin/bash and /bin/dash all broken, how can I install them again

Removed all /bin/sh, /bin/bash and /bin/dash. I cannot install them because dpkg and apt-get need a shell to install and there is no shell available. I'm still logged in and my Ubuntu is still ...
0
votes
1answer
61 views

How do I automatically run a shell script at start up? [duplicate]

Situation: Whenever I boot up my Raspberry PI, I have to enter a few lines of commands to enable an interface. The commands: sudo modprobe batman-adv sudo batctl if add wlan0 sudo ifconfig wlan0 up ...
5
votes
1answer
147 views

Modify the “alert” alias in ~/.bashrc

System: Lubuntu 14.04 LTS I want to know if it's possible to modify the alert alias provided in ~/.bashrc in a particular way. This is the original alert: # Add an "alert" alias for long running ...
3
votes
1answer
57 views

Executing tftp command without entering tftp command line

I want to execute the tftp command without entering into the "tftp command line". I have tried the below commands: tftp xx.xx.xx.xx -c put file1 file2 tftp xx.xx.xx.xx -m binary -c file1 file2 ...
0
votes
1answer
58 views

How to schedule ClamAv to perform a daily scan

I want to schedule a daily scan in my Home directory using ClamAv. Can anybody explain me how to perform such task using a bash script? I don't need to scan mails, just Home directory and maybe other ...
1
vote
1answer
25 views

Who is using an included file?

With 'fuser' I can see which process is using the file. However any included file does not show with 'fuser'. mainfile #! /bin/bash source subfile SomethingInSubFile sleep 60 exit 0 subfile ...
3
votes
1answer
56 views

bash and sh output is different?

I have code to print the simple multiplication table of a given number. When I run it with sh it gives me perfect output, but when I use bash it gives a slightly different output. Can you explain why ...
1
vote
1answer
29 views

shell script error not able to find [closed]

I have this code and i am not able to point out the error. It is simple program to print table of the number given by user. Here is the code: #a function to calculate the table call() { #to check if ...
3
votes
2answers
30 views

Catch user input with alias

So I recently showed my friend the wall command. Now he keeps using it to talk and I regret showing him. I want to make an alias call wall to keep him from using it and to also prank him. I did ...
0
votes
1answer
60 views

Is it possible to provide “if” and “else” syntaxis in Ubuntu terminal? [duplicate]

I was asked to create command which generates one word in terminal, if internet connection is absense, and another one, if it present. For doing that it seems that I need "if" and "else" syntaxis. Is ...
3
votes
2answers
145 views

One liner to convert small text string to PDF

I've been trying to find a way to create a simple PDF page from the terminal that contains only one string, for example, "Prelude". Some background: I use pdfunite to join music charts together into ...
0
votes
2answers
76 views

Problem installing .sh file

I have this file Mathematica_10.0.0_LINUX.sh that I need to install in my Ubuntu 12.04 LTS. I have already, successfully, run chmod +x Mathematica_10.0.0_LINUX.sh. However, when I run sudo ...
0
votes
0answers
31 views

How to run a Script by Autostart? [duplicate]

This is for a VPS running on ubuntu-14.04 64bit. NOT for a Ubuntu PC! i would like to know, how can i run a script on start (i know about the etc/init.d - but i dont know how to make my script look ...
-4
votes
3answers
114 views

How do I list files which have a “s” as first and a “l” as last char with a shell-command?

I'm trying to list files that start with "s" and with "l". The command I'm trying is ls -l *sfa*
1
vote
0answers
22 views

Using checklist in Bash file

I want to create a bash script that do the following: Create a project folder based on Project -- Name this is OK. Create some folders based on user choices --This is the main question Here is my ...
0
votes
1answer
50 views

In which system file does 'export' command make changes?

I installed java-8 using a PPA. After that I gave a command: export JAVA_HOME=/usr/lib/jvm/java-8-oracle I had heard somewhere that this command does temporary changes. But after many logouts and ...
-1
votes
1answer
46 views

Python: create variables using loop [closed]

how can I create a dictionary variables and every variable has an identical number using a loop in python if it is possible? for example: counter=0 for line in {1..5}: counter +=1 ...
3
votes
1answer
83 views

How to run an interactive script before xserver shutdown?

Every time I shutdown or restart my laptop (Ubuntu 14.04), I would like to run a script that checks, whether I pushed my newest code to my remote git repository. If I forgot it, then it opens a ...
1
vote
1answer
149 views

Maven environment variable not working on other terminal

When I run echo $PATH and echo $JAVA_HOME command as a normal user, I get jdk path variables set. But when I run as a root user, the variables are not set there. I copied maven binary folder to /opt ...
1
vote
3answers
87 views

split txt file in half based on pattern

I have a text file which looks like this: train/a/abbey/00000001.jpg 0 ... train/a/abbey/00000999.jpg 0 train/a/abbey/00001000.jpg 0 train/a/airport_terminal/00000001.jpg 1 ...
1
vote
1answer
52 views

Mirror photo directories and reduce file size

I backup our family photos to my home Ubuntu 14.04 server, to a Samba directory at /srv/photos. I want to be able to view them by visiting a web page, to browse through them, and have created a php ...
-1
votes
1answer
67 views

calling bash command in python

i called bash command in python in subprocess.call, and the return should be a number for example 3, and in the output, it gives the number as output, but it doesn't put it in the variables for ...
1
vote
1answer
42 views

Hourly and daily crons are not running

I've noticed that hourly and daily crons are not running, I moved them to crontab, and everything is fine: #!/bin/bash now=$(date) echo 'It is '$now The command line: # run-parts --test ...
10
votes
3answers
1k views

ZSH removed, cannot relogin

So I have install zsh and I didnt like it. so I did apt-get remove zsh From that point I cannot relogin, i click my user.. and then it just go back to the login screen. I can only login with the ...
0
votes
0answers
22 views

bash terminal colors for directories/executables not working

I have colors on terminal but not for filetypes. I have a pretty heavy bash profile and rc: .bashrc- source ~/.git-completion.bash force_color_prompt=yes MYPW='mypw'4.8 Parallel Computing . ...
3
votes
1answer
62 views

Definitive and immediate way to export a path

Assume I want to export a path, let's say FOOBAR and make the changes not only effective immediately and everywhere but also permanent. My goal is to have a list of commands that can be entered ...
6
votes
3answers
313 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
21 views

Performance Alerts

Is it possible & how do I, in Ubuntu to setup a performance monitor / event at a certain performance. I want setup a monitor that calls a .SH script on a couple of things the first and major one ...
0
votes
1answer
42 views

Some confusion about nohup

Situation1 command find / -name "*.conf" Ctrl+Z to pause the process Situation2 --- hello.sh --- #!/bin/bash /bin/sleep 5000 command ./hello.sh & Situation3 command ...
0
votes
1answer
68 views

Get wireless access points name or ssid which do not prompt for password using shell script in ubuntu

I just want to get wireless access points name or ssid list which do not prompt to enter password using shell script in ubuntu. Or I can say that I want to get ssid or wireless access point name list ...
1
vote
1answer
18 views

bash execute permissions fail

This works bash ifconfig This fails bash ifconfig /sbin/ifconfig: /sbin/ifconfig: cannot execute binary file It's not /sbin, as I've tried copying ifconfig (or any other binary) to a different ...
0
votes
0answers
10 views

Bash debugging symbols for 4.3-7ubuntu1.5

I want to install debugging symbols for bash 4.3-7ubuntu1.5 on Ubuntu 14.04.3 LTS. I tried to follow steps described in this blog - http://linux-debugger-bits.blogspot.co.uk/2014/04/bash-symbols.html ...
1
vote
4answers
161 views

Rename a file to parent directory's name in terminal

I have to deal with a large number of files nested inside of directories (one file per directory), resembling something like this: fred/result.txt john/result.txt mary/result.txt ... I am currently ...
1
vote
1answer
38 views

How to delete folders every N minutes from comand line

I am am trying to run the below command to delete tmp folders greater than 3 minutes using the below: find /tmp/tmp* -mmin +3 -exec rm -rf {} \; The above command fails. Why? find /tmp/tmp* ...
0
votes
0answers
21 views

Skip mv directory or file, if it is during copying

I wrote script in bash, to move every hour files and dirs (uploaded to FTP by other users) to another directory, where nobody can modify or delete them (some kind of backup). I must edit this ...
4
votes
4answers
109 views

Toggle Bash redirection with a variable

MUTE='&> /dev/null' echo "text" $MUTE Is there a way to make that work keeping the redirection inside the variable?
0
votes
1answer
69 views

open ssh connection in background [duplicate]

I've looked at a lot of similar questions about this but haven't found anything to solve my issue. I would like to be able to open an ssh connection to my university's server and keep the connection ...
0
votes
0answers
21 views

Script for changing certain folder icons

I'd like to know if there is a way to change folder icons system-wide using bash script so I can do the same on any machine at any time. Let's say I store all my custom icons in Dropbox where I have a ...
25
votes
6answers
2k views

Request root privilege from within a script

I have a script which can run as sudo script.sh or pkexec script.sh It would be much nicer from the user point of view if the script asked for the password from the user when just running it by name ...
11
votes
2answers
489 views

What does the double slash mean in `${f// /_}`?

I'm learning Bash, and I want to replace space characters with other "non blank" characters. I'm using a for loop: for f in *\ *; do mv "$f" "${f// /_}"; done My question is, why are the double ...
0
votes
1answer
81 views

A pipe command doesn't work

I tried executing this pipe command and it didn't work. find /home/siddath/enron -name "*" -print | \ parallel python email_parser.py {} > from_to.txt No command ' parallel' found, did you mean: ...
0
votes
1answer
204 views

How to start and kill tcpdump within a script?

Why can't I interrupt (i.e. kill -2, not kill -9) tcpdump as shown in this script? The script runs, but tcpdump does not terminate and continues to run at the command line, even after printing some ...
-1
votes
1answer
74 views

force to use Python 3 [duplicate]

i want to port Python Scripts to python 3. How can i force Ubuntu to use python 3 instead of python 2 which is installed, as well. Due to the size of the project, i'd prefer not to write something ...
1
vote
1answer
54 views

What does this bash escape sequence mean?

I've searched for a way to change terminal title and found this bash command: echo -ne "\033]0;NEW_TITLE\007" It works as it have to, but i'm now interested in what this "magic symbols" mean and ...
1
vote
3answers
105 views

gsettings set org.gnome.desktop.background not working

I am trying to download a daily picture and set it as my background image with: #!/bin/bash # clear cache PICS="/home/pvlkmrv/Pictures" rm -f ${PICS}/wall.jpg rm -f ${PICS}/photo-of-the-day # ...
1
vote
1answer
27 views

How to have brackets completion in the terminal?

I want my terminal to automatically close my brackets, quotation marks, etc. For example, I want to type ( and I want it to complete to (|) where | represents the mouse cursor. Is there a way to ...
0
votes
0answers
51 views

Why is my crontab not running my bash script?

I have a bash script which I want to run every 5 minutes with cron, but for some kind of reason it's not running? I've followed some guides, but no luck this is my crontab -e: SHELL=/bin/bash 0,5 * ...