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

learn more… | top users | synonyms (1)

2
votes
1answer
25 views

mkdir crashes bash

I'm trying to create a directory in my home directory but the shell itself keeps crashing. I have permission to write to the directory. I am able to create files in the directory via touch. I can ...
8
votes
3answers
2k views

Long lines overlap in Bash PS1 customized prompt

I have configured a fancy two-line PS1 bash prompt, with server name, time, user name and other useful variables. PS1="\n\[\033[1;34m\]\342\226\210\342\226\210 \u @ $SERVER_NAME""$BBlue"" ...
6
votes
3answers
11k views

Shell script to move all files from subfolders to parent folder

I've bunch of folders in folder A. I want to move files from all those folders to A. Or I want to cut all files from child folders and paste them in parent folder. How to do that?
1
vote
1answer
23 views

script.sh run differently when manually opening terminal and when using .desktop launcher

I have a script file script1.sh as shown below: #!/usr/bin/env bash cd /home/userA/scripts . r1.sh when I manually open a terminal and run it using . script.sh it works fine. But when I created ...
1
vote
1answer
25 views

shell file opens terminal and run a sequence of commands in specific order

What I used to do is: Manually open a terminal instance to run the following commands and shell files Run PACKAGE_PATH=/home/userA/package1:/home/userA/package2:$PACKAGE_PAT‌​H run: cd ...
0
votes
1answer
22 views

feedingbottle/n”export: No such file or directory

I'm noob in linux, so i install feedingbottle, but then I open terminal showing this: bash: ...
10
votes
3answers
23k views

How do I clean or disable the memory cache?

After the system starts, in a few minutes my memory cache fills up and it starts using the swap. Here's a screenshot of /proc/meminfo. However, if I can disable this process / clean the cache once ...
4
votes
4answers
1k views

Why is the output of _$ _ when executed on a terminal?

I have executed the following command sequence: $ now=$(date) $ echo _$now_ _ $ echo _ $now _ _ Mon Sep 22 09:53:44 IST 2014 _ Why is the output of _$now_ only _?
1
vote
0answers
45 views

how to run command in an already opened terminal through a shell script

I'm running a shell script.sh which is supposed to open terminal and then run some commands in this opened terminal. What happens is that the terminal starts but the following commands are not ...
1
vote
1answer
62 views

Disable 'ESC' and 'Shift + Tab' history shortcuts in terminal

When in a bash terminal, if I hit ESC or Shift + Tab the command line goes to the history where I can move around to previous bash commands with vi-like bindings. I get messed up when in this mode ...
0
votes
1answer
17 views

Desktop Launcher executing a sequence of commands after opening a terminal

I've created a .desktop launcher as shown below which successfully opens terminal. What I want to do next is to run the following commands such as cd home/userA/scripts then ...
0
votes
2answers
37 views

Type 'Debb' is not known on line 1 in source list

I want to install chrome and enter the source list when doing sudo apt-get update there is an error as follows: E: Type 'Debb' is not known on line 1 in source list ...
0
votes
1answer
33 views

Run some shell files from another shell file in different location

I have 5 shell files in a specific locations on my ubuntu system. I have two users on this system userA which is the main user and userB. Currently I have to manually open a terminal using user userA ...
20
votes
2answers
14k views

How can I shorten my command line (bash) prompt?

Currently it is: michael@Castle2012-Ubuntu-laptop01:~/Dropnot/webs/rails_v3/linker/spec/controllers$ Outside of renaming my machine and directory structure... How could I make it be something ...
0
votes
1answer
55 views

At what time does bash scripts execute?

I would like to run a bash script at system startup. I read recently that some bash scripts are executed before logging in to a user account, others, after. Can I get some information on when bash ...
0
votes
0answers
12 views

How to truncate directory name in terminal? [duplicate]

Something like ../parent folder/current folder instead of 8 different directories as mine currently is when I'm accessing deep files.
0
votes
0answers
25 views

Shell script loop stops by itself

I have two script files like this. execute.sh #!/bin/bash #259200seconds = 5 days end=$((SECONDS+432000)) x=0 cp /dev/null ~/kill_start.txt while [ $SECONDS -lt $end ] do [[ $(cat ...
16
votes
6answers
10k views

Command to convert an upper-case string to lower-case?

What is the Bash command I can use to convert an upper-case string to lower-case and vice-versa? Thank you.
7
votes
3answers
8k views

How To Customize Ubuntu Bash to make it like Mint?

I love Linux Mint's bash customization. It includes both a color prompt and a quote displayed with ASCII art. Is it possible to have it in Ubuntu?
1
vote
1answer
20 views

Copying files and folders with cp with shopt extglob - error is not a directory

I'm trying to copy files from a directory while excluding a folder and a file. My problem is that a get an error with shopt extglob activated. Here is my code: ...
6
votes
6answers
1k views

How can I run this sh script without typing the full path?

I'm still very new to Ubuntu. I'm using 12.04, and I'd like to know if there is a way to run this program/shell script without typing: /opt/idea/bin/idea.sh It's kinda tedious and I'm quite lazy. ...
15
votes
3answers
7k views

How can a script check if it's being run as root?

I'm writing a simple bash script, but I need it to check whether it's being run as root or not. I know there's probably a very simple way to do that, but I have no idea how. Just to be clear: What's ...
2
votes
1answer
82 views

Stopping a running script though another script file

I am new to shell scripts. Say, I start a script like this. This runs for 3 days. So, I will start the script remotely through ssh and then close my local terminal. start.sh end=$((SECONDS+259200)) ...
-1
votes
1answer
16 views

Redirected Output

I just used a command ls -l > ~/ls_output in my /usr/bin directory and I'm not sure what happened. The terminal accepted my command but I don't know what happened to the output or where it went. ...
2
votes
2answers
729 views

Configure bash to print exit status of every command entered

Every command that I type on bash returns with an exit code. I want: Whenever I type a command on bash prompt, I want it to exit and print exit status i.e. echo $?. e.g. if I run echo "hello"; on ...
-4
votes
3answers
796 views

how to check if $1 and $2 are null?

I am running some script which passing the string argument and I want to do if else statement shown as below: if [ $1 != '' ] && [ $2 != '' ] then do something..... but it shown Error ...
1
vote
1answer
19 views

Can't Change power_method 14.04

I am trying to modify my power method for my ati card as it's like having a helicopter in the room. I use the same methods described here. sudo bash -c echo "profile" > ...
6
votes
2answers
482 views

What's the use of complete command?

While running the complete command on my gnome-terminal, it shows some commands.What are they? And what is the use of complete command? $ complete complete -F _minimal complete -F _filedir_xspec ...
0
votes
2answers
127 views

Launcher for programs which need multiple commands to run

I already installed a program called CadFeko, and I can run it from terminal. To run the program, first I have to run this command . /opt/feko/6.3/bin/initfeko Then I can call the program by ...
0
votes
1answer
55 views

shell script to function on subfolders

I want to write a simple shell script that will go into all the sub-folders in a directory, and organise the files in the sub-folders into new directories. Basically in terminal it would look like: ...
3
votes
2answers
81 views

Sending enter in interaction mode ubuntu 13.10

I'm trying to make a basic script for deployment of ocs-inventory and I got stuck on a problem. When I issue this command: sudo apt-get install -y ocsinventory-agent The interactive window ...
1
vote
1answer
197 views

Bash script for execute one command for many files

I just tried to clear my holiday video stuff and found program for stibilizng vision. There are a lot of files so I made script to stabilize all. Firstly I need to run command: transcode -J ...
-1
votes
1answer
43 views

Ubuntu 14.04 - Desktop icon is not running my BASH script

I have a simple script runme.sh which works when i run from terminal. #!/bin/bash chromium-browser "https://askubuntu.com/" But i need to make it now runnable for normal Users. So i place a desktop ...
2
votes
1answer
16 views

post-receive: No such file or directory

I'm getting an error when trying to push to a remote Amazon EC2 (Ubuntu Linux) instance. I've given all related directories and files full permissions. I'm trying to use a post-receive hook to move ...
1
vote
2answers
70 views

Only display a range of entries from the bash history

Is it possible to set a fixed number for the "history" command to only show a certain amount of history items like 100, instead of everything from the beginning of time?
1
vote
2answers
42 views

Unable to delete file

I am unable to delete file: sudo rm /usr/local/bin/Katy Perry - Dark Horse (Official) ft. Juicy J-0KSOMA3QBU0.mp4.part It is showing an error: bash: syntax error near unexpected token `(' How to ...
1
vote
2answers
285 views

how to write a script that will execute xampp start and stop

I am trying to write a script that will enable xampp start and xampp stop with the same script without having to write in the terminal everytime. To start xampp, I write in console : sudo ...
1
vote
0answers
46 views

Display running clock in terminal [duplicate]

I want to display running clock inside terminal. I have already gone through this answer but this method only works in zsh terminal. But I want to display in bash. Is there any other way to display ...
5
votes
1answer
732 views

Difference between cd / and cd //? [duplicate]

What is the difference between cd / and cd //? We can see that adding / to the end doesn't do anything. But when I do cd // and pwd, I found: $ cd // $ pwd // What is difference between / and ...
19
votes
1answer
27k views

'sudo su -' vs 'sudo -i' vs 'sudo /bin/bash' - when does it matter which is used, or does it matter at all?

When I'm doing something that requires root be typed in dozens of times in a row, I prefer to switch my session to a root session. In the various tutorials and instructions I have used on the ...
11
votes
5answers
964 views

How can I run original command that aliased with same name?

An alias for ls command in ~/.bashrc file aliased with this one: alias ls='ls --color=auto' then, when I run ls command in terminal aliased ls(ls --color=auto) runs. but my question is how can I ...
1
vote
2answers
52 views

Hide stdout of a process only when it is running in background

How could I hide the standard output of a process only when it is running in background? For example, test.sh #!/bin/bash for i in $(seq 200); do echo $i done Now, I run the script. I stop ...
0
votes
4answers
33 views

Explain exec in simple terms?

I don't understand the bash command exec. I have seen it used inside scripts to redirect all output to a file (see ...
3
votes
3answers
12k views

How to get separate with space or tab in the awk example

while I'm playing with awk I came to execute like ls -la >> a.txt ; awk {'print $5 $1'} a.txt ; then its giving output like 53277-rw------- 52347-rw------- how can I get space between ...
0
votes
0answers
14 views

Run script in another opened terminal

Is it possible to run a script in another opened terminal? In that case I would need to know all opened ttys. Another case would be, if I'm using SSH to login into a remote host. I would like to run ...
1
vote
3answers
54 views

Git prompt won't colorize

I want my git prompt in bash to colorize (green for clean repos, red for dirty repos). Right now, it shows plain white text no matter the git state of my cwd/repo. ...
3
votes
1answer
47 views

How to quickly check the value of bash variables, aliases and history commands from terminal?

How do you expand in place: bash aliases environment variables history commands to edit them and check they are correct? For example, I have some aliases I use for flashing different devices and ...
2
votes
2answers
47 views

Pass variable value to script from terminal

I like the shred command so instead of using the 'rm' command I prefer shred. I would like to create a bash script in /usr/bin, say we will call it "shredder" so that if I want to shred a file (i.e. ...
4
votes
4answers
256 views

Getting values from variables - bash script

I am trying to write a bash script to print values of the 3 variables. Keep getting errors. What am I doing wrong? INPUT1=/tmp/dir1 INPUT2=/tmp/dir2 INPUT3=/tmp/dir3 for i in 1 2 3 do echo ...
5
votes
2answers
160 views

Creating a new subdirectory in multiple existing directories

I am trying to figure out an elegant way to create a new subdirectory in a series of existing directories. I have 15 already created directories called Week1 through Week15. Within those ...