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

learn more… | top users | synonyms (1)

3
votes
1answer
168 views

Use a list of words to grep in an other list

I've got a list with 250 lines in it. I have to run all of them through a web server to get a list of output. This list, however returns many more lines, than I'm interested in. Say, my list.txt is: ...
0
votes
1answer
71 views

Making a Bash script to set desktop wallpaper as animated gif — what do these errors mean?

I was following this tutorial to see if I could make my desktop wallpaper in Ubuntu into an animated gif. In the tutorial, I copy and pasted a script that would supposedly allow me to do this. ...
0
votes
1answer
46 views

Echo command does not show text in terminal [closed]

this is what i wrote in myscript file #! /usr/bin/env bash echo "Hello world" then i added myscript path to PATH variable and ran it as a command. the command apparently run without error but ...
3
votes
5answers
315 views

Extract part of a line upto a particular string

Let us assume I have a file with lines like: /java/jdkxx/jvm_jdk/bin/opt /java/jre/jre_jvm/bin/opt /foo/bar/bin/other/stuff/here Is there a way I can extract part of the lines upto bin. I mean, ...
2
votes
1answer
212 views

Is there a way to fill an image with its background color to square size?

Let me describe my problem: I have a site where I post sponsors company logos. Once I'm sent the logo (or I've googled) they are usually in rectangle size - width and height are not equal. On my ...
1
vote
1answer
43 views

How to configure desktop appearence from the terminal?

I'm creating a small script to setup the installation with my preferences and I'd like to know how can I change desktop appearance settings from the terminal. Things like: Set the default app to ...
1
vote
0answers
23 views

Disappearing files in the cat command

I am handling a rather large dataset. I have 238 files, for whcih I would like to import their content into excel. In order to do so, I am creating a combined txt file using cat *.pdb > ...
4
votes
2answers
94 views

Print a group of lines if they contain specific strings

I have a file (file 1) that looks like that: >C 0 0 4231aa, >A6_03412... at 1:4226:1:4240/95.44% 1 4240aa, >A5_01600... * >C 1 0 4159aa, >FG1_03697... * >C 2 0 3942aa, ...
3
votes
0answers
29 views

Is there a way of telling apt to run when it can - when the previous instance has finished? [duplicate]

I am quite absent minded, and I forget everything I want to install - especially after a restart Is there a way that I can set another command to run (in a separate terminal, of course) when the ...
0
votes
0answers
12 views

Sorting out consecutive duplicates from bash history [duplicate]

When I press the up arrow in my terminal I want to get to the last command that is different to the previous command. a b b b If that is my command history, then I want the following ...
2
votes
4answers
254 views

Repeat each line in a text n times

I have a file that looks like this 888 924 873 1374 ..... The dots indicate that I have many more string, around 3000. I want repeat each string n time, to have something like this; 888 888 888 ...
0
votes
1answer
21 views

using cut in a loop script

I am using bash on my macbook pro. I have a list of files in a directory that I'd like to use the cut command on. When I use this command: cut -d " " -f 6- 2.ostat > 2.ostat1 it works nicely - a ...
0
votes
0answers
24 views

Shell Script whenever i am SSH it will change my terminal title bar according to that SSH ip

I'm not much expert in shell scripts. I want a shell script, that, whenever I am inside an SSH session, will change my terminal title bar according to the server IP address.
4
votes
2answers
57 views

Rename all file extension in directory

I am new to scripting, and I have a directory with all files named num.pdb.ostat. I would like to rename all num.ostat (that is deleting the .pdb in all). For a single file this works: mv 2.pdb.ostat ...
0
votes
1answer
30 views

Init.d code not quite working

The filtered out data from a MQTT live stream is dumped into a csv file named mqtt.csv and the dumping process is done by executor_start_up_job.txt which is written in BASH (has a shebang). I want to ...
2
votes
1answer
27 views

Defining and incrementing a variable in bash

I've something like this: declare -r constant1=0 declare -r constant2=0 for xx in 1 2 3 4 5 6 7 8 9 10 do constant1=$((constant1 + 1)) for yy in 8 7 3 9 3 9 2 8 4 4 do ...
1
vote
3answers
45 views

How to dump user's environment into a file?

I want to dump all user's environment into 'env.log'. Please tell me the command to do this.
2
votes
1answer
20 views

Logarithmic shell expansion?

I know there is ** for exponentiation in bash. Is there a simple shell expansion for logarithms?
0
votes
0answers
42 views

automate processes based on priority and memory size.

I have written a script to output vmstat etc according to user input and have also written a script for process control based on user input. the process script allows the user to use a series of menu ...
0
votes
1answer
89 views

CRON doesn't run tasks because “/bin/bash: /var/log/cron.log: Permission denied”

I have the following CRON task: MAILTO="my@email.com" # Begin Whenever generated tasks for: projectname 30 4 * * * /bin/bash -l -c 'cd /home/deployer/apps/project_production/releases/20150305135322 ...
0
votes
1answer
31 views

why is “export PATH” displayed in terminal as a title?

I have a long time using Ubuntu, probably 3 or 4 years, I've never had the need to "export a path". Now, I was installing Xilinx ISE 14.7 in Kubuntu 14.04 Trusty Tahr LTS following a tutorial, at ...
1
vote
0answers
58 views

bash script to cd into an USB device

i am creating a simple updater for a program which will be ran on an Odroid C1 with Ubuntu 14.04 Server.. Preamble 1) i want the updater.run downloaded from my server and placed into an USB; then ...
7
votes
11answers
939 views

How to count occurrences of each character? [closed]

For example I have file 1.txt, that contain: Moscow Astana Tokyo Ottawa I want to count number of all char as: a - 4, b - 0, c - 1, ... z - 0
2
votes
1answer
54 views

can't find package crontab-ubuntu 12.04

I am trying to install cron for scheduling and before anyone says duplicate, I have tried the methods of sudo apt-get update and upgrade mentioned and they don't work. When I go to install crontab, ...
0
votes
0answers
15 views

Simple shell script for iPerf [duplicate]

We have an Ubuntu network in our test lab, and run traffic using iPerf. I want to automate the process a bit by writing out a script that would run the following from a terminal: iperf -s -u -P 0 -i ...
-1
votes
1answer
35 views

Command output to file, new lines at top [duplicate]

I'm rewriting some 20+ year old Unix scripts and I want the output to go to the screen and a file. I know this is possible with tee. Is there a similar command that stacks new lines on top, at the ...
0
votes
0answers
16 views

ubuntu 10.04 vm corrupted, tries to run 32-bit which ltib can't access path

All, I am running a 64bit version of Ubuntu 10.04lts doing software/kernel work for the imx6 processor. Yesterday, something I did caused ltib not to find the cross-compiler on the path, even though ...
1
vote
2answers
32 views

Why does cp not copy a specified folder

let's say that I have a following file structure: ~/DIR1 -fileA -DIR2 --fileB Then, being in ~, I run this script: cp DIR1 NEWDIR2 And just an error happens: cp: omitting directory ‘DIR1’ I ...
2
votes
1answer
23 views

“cd” redefinition causes infinite loop in bash

I redefined cd in my .bashrc to: function cd() { builtin cd $* pwd } This worked for a while, until I mistyped cd *2 as cd *(2 When I did that, bash prompted me, I went "d'oh", and when I ...
1
vote
1answer
55 views

Permission denied [closed]

I am using Ubuntu 14.04 linux and 64 bit pc. Whatever I try to install through terminal am getting the following error bash: /home/vinod/android-sdk-linux/tools/android: Permission denied
0
votes
1answer
63 views

What does cd [-L] [-P] [-e] [-@] do?

Out of curiosity I typed cd --help to see if there were any extra things you can do with changing directory, and it came up with cd: usage: cd [-L|[-P [-e]] [-@]] [dir] What does each option do? I ...
0
votes
2answers
61 views

Bash Syntax error while using 'source' command in Ubuntu 14.04

The error message displayed in my terminal has been pasted below. sarvotham@ramanPC:~$ source("http://bioconductor.org/biocLite.R") bash: syntax error near unexpected token ...
0
votes
0answers
23 views

How can I truly clear a terminal window? [duplicate]

When I run clear in the terminal, the tab appears to be cleared of text, with only a fresh command prompt visible in the top left corner. However, the scrollbar is still active and if I scroll up, I ...
0
votes
2answers
48 views

How to create the command in bash? [closed]

Are there ways to create my own command in bash, except copy of the script in the /bin and create an alias?
2
votes
2answers
133 views

Pipe file to gnome-open command

For example I want to open a specific book from Books directory. To find it I do ls | grep -i 'book_i_want' Ideally I would like to add next pipe with command, like this: ls | grep -i 'some_book' | ...
0
votes
1answer
39 views

How to Perform operations on files or directories with dashes or hyphens? [closed]

My question is that I was trying to rename a file named 12F-XYZ.pdf to 13F-XYX_ABX.pdf. Now the problem that rises is that both of hyphen the original and the required names have hyphens I know that ...
0
votes
0answers
48 views

Bash cursor graphical bug in ubuntu 14.10

For the past few weeks (I'm not exactly sure on the timeframe, but I think it coincides with me upgrading to Ubuntu 14.10) I've had an issue with my terminal where, while typing, the white cursor ...
3
votes
1answer
171 views

Bash script, arithmetic with floating point variables / strings that represent them

I'm trying to create a simple script that takes an average load percentage of the CPU each minute. I'm doing this by using the sar command from the sysstat package. Here is my current code: ...
1
vote
1answer
33 views

Alias for gnome-open to open different files

I want to make alias for gnome-open so I be able to open files with command opn somefile.doc How can I pass filename with this alias?
3
votes
1answer
170 views

How to find a place where a constant is defined in Bash

I need to find at least a file where $JAVA_HOME is defined (exported). Is there any smart way to do that besides text search in files?
0
votes
1answer
24 views

How to get help on a specific option of a command [duplicate]

I guess the title says it all. I know I can get help on a specific command, for example wget, like this: wget --help But how can I get help on some specific option of that command? For example, I ...
11
votes
3answers
398 views

Pre-define colors for Terminal?

I was trying to remember how I could pre-define colors inside of .bashrc file so they could be called on when I do ${RED} for example. I can't remember if this was the right way of doing it, but it ...
0
votes
0answers
37 views

Cloning Ubuntu 14.10 installations

I need to use a range of Cloud VPS providers to run servers across the world. The first batch of providers is Vultr, DigitalOcean and DimensionData. Each of them offer the ability to create ...
1
vote
1answer
76 views

Is it possible to run stress at the same time as vmstat/iostat etc?

I have written two scripts-one to stress the system and one to run vmstat etc. I am able to get the file outputs for vmstat etc but am not able to get the ones for stress as it tells me that the file ...
2
votes
1answer
46 views

Execute a shell script only for LiveCD session [closed]

I want to execute a shell script on startup but only for LiveCD session not for harddisk installation. Which directory should I put my shell script? For example Ubuntu somehow detecting LiveCD ...
0
votes
1answer
36 views

Having trouble running setup-environment (YOCTO) in a ubuntu 32-bit VM

I am running a 32-bit Ubuntu in VirtualBox on my i7-64 bit System and was following steps to build YOCTO; In the process, I have to run the following command $ MACHINE=smarch-samx6i ...
0
votes
0answers
21 views

How to run an alias command with sudo [duplicate]

I created an alias called runmc that allows me to start up a java program. But I noticed that when I type in "sudo runmc" (It needs root access to work properly.), it will display "runmc: command not ...
0
votes
3answers
66 views

How would I create an alias to run a game? (Minecraft)

I would like to create a command-line alias to run a game (Minecraft in particular). How would I accomplish this? I want to type in runmc to run the command java -jar /root/.minecraft/launcher.jar. ...
3
votes
1answer
83 views

How can I run a script when the power supply is plugged-in or -out?

For some reason, my laptop's screen brightness does not update when I plug-in or plug-out the power supply. I've looked at quite a few solutions for that problem, but none of them seemed to work well. ...
0
votes
1answer
45 views

Script wont print my echo statement (Also need to suppress the warning)

I am trying to write a very simple shell script in Linux. The Scenario I am trying to achieve is: Creating an user account and giving it a password internally (No interaction with user allowed for ...