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

learn more… | top users | synonyms (1)

3
votes
3answers
195 views

How to rename all files in folders with pattern

I have a bunch of files like: bla.super.lol.S01E03.omg.bbq.mp4 bla.super.lol.S01E04.omg.bbq.mp4 bla.super.lol.s03e12.omg.bbq.mp4 I need to rename them all like: s01e03.mp4 s01e04.mp4 s03e12.mp4 ...
0
votes
1answer
837 views

How to resize a crypt-luks partition that takes all hard drive?

I want to shrink the partition to be able to install a windows OS, but i installed ubuntu 15.04 with encryption of the logical volume, gparted doesn't support crypt-luks so what do i do?
0
votes
0answers
24 views

Link broken but when “ls” is used on link in terminal the content is displayed

I noticed an interesting fact today. I have a link on my Desktop pointing to windows partition (dual boot Ubuntu 14.04 & Win8.1). Because this partition is not automatically mounted the link is ...
0
votes
2answers
27 views

Can we install a package through a shell script?

I'm trying to write a shell script so that when I reinstall my Ubuntu again. I could just run script and retain all the packages. And I'm planning to pass password in form of argument. My question ...
1
vote
2answers
24 views

Saving work automatically when battery is low

I am a writer and of course I sometimes lose my work if the battery goes dead. I am looking for suggestions for ways to save when the battery gets to 5% or 1%. Maybe a bash command written to save ...
0
votes
2answers
339 views

Shell script options with parsing arguments

I have the shell script CONTROLLER_IP="" if [ "$#" -eq 1 ] then CONTROLLER_IP=$1 else echo "Usage : create_endpoint.sh --controller-ip <Controller IP>" exit 1 fi but its executing ...
0
votes
1answer
38 views

What command is the most effective for listing processes? [on hold]

I've seen lots of developers use ps -ef to list processes and kill them (such as in ENCOM, devs of OS-12). However, there is also htop. A friend told me that it is only a wrapper around ps and ...
1
vote
2answers
37 views

Execute a command stored into a $variable

I made a script where I wrote: COMMAND="/usr/bin/exiftool $PATH_NAME" .... code .... $COMMAND The variable $PATH_NAME is assigned dynamically inside a while loop. The command works fine until it ...
25
votes
7answers
80k views

Not able to execute a .sh file: /bin/bash^M: bad interpreter

I wanted to execute a shell script: -rwxr-x--x 1 root root 17234 Jun 6 18:31 create_mgw_3shelf_6xIPNI1P.sh I tried to do a standard procedure, but I am got this error: ...
-5
votes
0answers
35 views

can someone explain this bin.sh shell script for me? [on hold]

Can someone please explain this shell script that was detected from my honeypot? #!/bin/bash busybox rm -rf /tmp/* busybox rm -rf /usr/bin/strings busybox rm -rf /usr/bin/ps busybox wget ...
8
votes
3answers
7k views

Why pssh command is not working?

I have pssh package installed in my Ubuntu 11.10 x64 system. And I can run the program via calling parallel-ssh However, pssh gives me $ pssh No command 'pssh' found, did you mean: Command 'bssh' ...
2
votes
2answers
291 views

Command line IF not working as expected

I'm relatively new to the terminal programming. I'm trying to run an IF condition within a FOR loop. (The command is to be run by a cronjob) for i in {1..5}; do echo $i; if [ $i>3 ]; then echo $i; ...
0
votes
1answer
22 views

rsync can't exclude directories

I run this cmd to backup my folders: $ rsync -av --exclude {/mnt/dati/Film/, /mnt/dati/Scout/} --delete /mnt/dati/ /media/cirelli/HD1TB/backup/dati sending incremental file list And rsync answer ...
1
vote
1answer
26 views

Gnu date input formats

I am trying to get my head around the date input formats used in date -d "something" Specifically I am trying to understand the use of the "Day of week items". The manual page for date refers you ...
0
votes
0answers
18 views

Apache startup script keeps lock file open

I am writing a bash script for a backup task. Among other things (file system freeze, database lock, snapshots,...) it involves shutting down Apache and restarting it after the Backup. Since that ...
0
votes
2answers
44 views

New Terminal bash file error

Upon opening a new terminal in Ubuntu, I get this error. I tried opening the bashrc file but It seems to be empty. bash: /home/rma/prac/devel/setup.bash: No such file or directory bash: ...
0
votes
2answers
31 views

Custom commands with options [on hold]

How to create custom shell script/command with flags/options ? $ command -t 2 -h "File"
0
votes
1answer
19 views

Syntax error near unexpected token `newline' while installing Predictionio

I'm new to Prediction.io and when I try to install it following the instruction at this page I get the following error: bash: -c: line 0: syntax error near unexpected token `newline' bash: -c: line ...
0
votes
0answers
22 views

Bash script issues [on hold]

In Bash shell, when the database name is changed the resulting trace file and other related locations would change but the alias for tracefile location does not change upon change of database name... ...
18
votes
7answers
28k views

How to run scripts without typing the full path?

I'd like to know if there is a way to run program/shell script without typing full path: /opt/idea/bin/idea.sh
1
vote
1answer
21 views

Aliasing gedit to suppress terminal output

I am SSH'd into an embedded board (Jetson TK1 running Ubuntu 14.04). I use the -X option so I can use gedit to edit text files. When executed from a terminal, gedit spews a bunch of garbage on the ...
0
votes
2answers
28 views

crontab doesn't seem to work and makes different schedule in cron.d!

sudo crontab -e lets me edit the crontab, and I put in this: # Hourly backup 0 * * * * rsnapshot hourly # Daily backup 0 2 * * * rsnapshot daily # Weekly backup 0 4 * * 6 rsnapshot weekly And it ...
8
votes
1answer
10k views

Bash auto_completion with Xubuntu and xrdp from windows

I'm using Xubuntu and connecting over RemoteDesktop with Windows 7. Everything works fine, but the auto_completion in my bash doesn't work. I checked the .bashrc file in my home directory and also ...
25
votes
9answers
35k views

How to list all the files in a tree (a directory and its subdirs)?

For a task of mine I need to list all the files in a tree (a directory, all its subdirs, all subdirs of those, etc.). I'd prefer to see them in Nautilus or Krusader, but a command-line solution is ...
1
vote
1answer
142 views

Note Taking Using Command Line History

Is executing a line, beginning with a hash-tag, like #something, in a terminal, dangerous? Something like: usr@machine:~$ #something Or in a multi-line manner: usr@machine:~$ <<something ...
2
votes
1answer
42 views

How to use sed with file path variables AND regex callbacks AND arithmetic expressions

I'm having a hell of a time getting the proper syntax using sed with variables containing a file path, a regex callback and an arithmatic expression. I don't know how to properly escape things. I ...
0
votes
0answers
20 views

Need help with Bucket Brigade Script [on hold]

I want to write two scripts, brig and passer. The brig fire n command starts a fire with a n size. The brig status command displays the status of the fire. The brig quit command just exits the fire ...
3
votes
1answer
454 views

How can I draw selection rectangle on screen for my script?

I am trying to make a simple screencasting bash script. I want to get screen selection coordinates by drawing a red rectangle with mouse. I can use xdotools to get coordinates but how can I draw ...
0
votes
1answer
26 views

what does -alt |more command do in ubuntu

can some one explain what does -alt | more command do in UNIX with what is the function of alt,-, | and more.
1
vote
0answers
27 views

Non-printing characters showing up in terminal prompt

Without color my prompt looks like this: [0] [dimo414@dimo414:/tmp] $ echo $PS1 | sed 's/\x1b/\\e/g' \n[0] [dimo414@dimo414:/tmp]\n\$ I add some color and \[...\] delimit it: [0] ...
9
votes
3answers
9k views

How set command in background,close terminal and get it back to fg?

I'm trying to find out how to run a command in the background and then bring it to the foreground later. I'm fed up of tutorials and answers where people state that it's simple, just append & to ...
0
votes
2answers
42 views

How to write a recuring bash script

I created a program that requires a sequence of command line instructions to scrape new information and update the databases. Is there a way to automate this process so I don't have to type all this ...
3
votes
3answers
48 views

how do i make shell ask for confimation for rm -rf command (even sudo)?

I want to make the command shell to prompt me for confirmation before execution of certain commands like dd , rm -rf etc.
-1
votes
1answer
66 views

force to use Python 3

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 ...
0
votes
1answer
11 views

Protect root-owned script against tampering and run unattended w/ sudoers' NOPASSWD

Using /etc/sudoers I gave a non-root user (anyuser below) permission to sudo-execute a root-owned script (test-script below) with the NOPASSWD: tag set. The script's permission octal value is 0550. ...
0
votes
2answers
33 views

“mv” apparently deleted my script!

My command was: mv count_entries.py ~/journal_tools/ Now the file is missing from both ~ and /journal_tools/... If it matters, I was logged in as a user without administrative rights, and ~ is a ...
1
vote
2answers
38 views

Bash script help, check permission 755 on all files in a folder

I'm attempting to create a bash script where I check if all the files of a specific folder (/tmp) have the permission 755. I also need it to delete all the files that don't have permission value 755. ...
0
votes
1answer
29 views

Openvpn - Terminal blocked after starting connection

i have a little Problem with openvpn. I want to establish a VPN connect with open vpn, then get a file from an FTP Server and than close the connection. The VPN and the FTP are working fine. But if ...
20
votes
4answers
1k views

Reading lines from a text file and creating a text file for each name on each line

Let's say I have a text file like: john george james stewert with every name on a separate line. I want to read the lines of this text file and create a text file for each name, like: john.txt, ...
2
votes
1answer
30 views

How to run a parameter as an alias in a shell script?

I have an alias alias ll='ls -lF'; I created a bash script temp.sh: #!/bin/bash # Allow aliases to work in bash NON-interactive mode! shopt -s expand_aliases # .. and load them source ...
0
votes
0answers
19 views

Batch file to read file contents and iterate

I am trying to write a batch file/shell script that reads the contents of a file, matches those contents with a directory structure and invokes an executable file. Let's say there is a sequence.txt ...
6
votes
5answers
2k views

Shell tab-completion for service command broken as root

On most of our servers, tab completion of service names after typing in the service command no longer works, as root. It works just fine as non-root. This is on Ubuntu 12.04. I'm not sure how to ...
0
votes
1answer
8k views

when building u-boot /bin/bash: arm-none-linux-gnueabi-gcc: command not found

I am currently running Ubuntu 12.0.4 on a 64 bit machine. I have an AM335X development board. Along with the kit came the compressed kernel (linux 3,2), rootfs, u-boot, and ARM cross compiler ...
2
votes
2answers
163 views

sed to execute a command as replacement with substitution pattern as argument

I am trying to replace time in a log file by: cat mlog.log | sed -e "s/^[0-9\.]*/\$(date -d @&)/" Why it always first execute $(date -d $&) but not doing replacement at first and then ...
2
votes
1answer
20 views

echo create command, what's it doing?

I've been trying to figure out what this line does for a few hours. I have to automate the step using ansible and can't find anything on the create command. Any help is appreciated. echo -e "create ...
228
votes
12answers
363k views

How to get bash or ssh into a running container in background mode?

I want to ssh or bash into a running docker container. Please, see example: $ sudo docker run -d webserver webserver is clean image from ubuntu:14.04 $ sudo docker ps CONTAINER ID IMAGE ...
0
votes
0answers
18 views

Escaping in Bash [duplicate]

I want to do a POST with curl for a DNS entry, but the quoting/escaping drives me crazy. I tried the following in Bash (which I want to transfer to a Bash script once it works): curl -k -u $USER -X ...
0
votes
1answer
73 views

How to validate a user's password, with a shell script? [duplicate]

I'm making a bash script for the Ubuntu Terminal. I need to verify the user before the code can continue. How do I ask and validate their existing log-in password?
3
votes
3answers
5k views

Transmission shutdown script for multiple torrents?

I have written a shutdown script for transmission. Transmission calls the script after a torrent download finishes. The script runs perfectly on my machine (Ubuntu 11.04 & 12.04). #!/bin/bash ...
0
votes
1answer
29 views

Bash script that runs a command with arguments and redirects

So I'm trying to execute a command in a bash script multiple times with different but same number of arguments while redirecting the output to a text file. For example ... ./test arg1 arg2 arg3 ...