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

learn more… | top users | synonyms (1)

1
vote
2answers
10 views

Is it possible to make sandwhich aliases?

I'm looking for a way to make the following alias work for any file name. alias dim='cd /home/jason/Documents; vim *the desired file*; cd' I'm wondering if there is a way I could change this alias ...
3
votes
3answers
61 views

apt-file regex: escaping a dot

I want to find all packages which provide a shared object containing "ssl" in the file name. The apt-file manpage says: --regexp | -x Treat pattern as a (perl) regular expression. ...
-1
votes
1answer
27 views

Use of quotes when running commands on a remote machine using ssh

I have a command that I know works correctly when I remote into a machine and run it. The command is below: grep "SearchTerm $1" file.txt | sed 's/^.*SearchTerm $1,//g' | sort | uniq -c | ...
0
votes
0answers
19 views

Using Upstart / init with PHP daemon nohup php daemon.php

Till now I had no real need to learn bash and init scripts as I need to at this point. I have created a custom Twitter app that is persistently, or constantly, connected to the API. It does tasks like ...
2
votes
2answers
118 views

To understand the behaviour of script when running over SSH

Alright, lately I have been facing an odd behavior. I have small bash script which simply takes mysql dump remotely and then store data on the server itself which later get rsynced to backup server. ...
1
vote
2answers
36 views

Bash script and escaping special characters in password

I have been reading a lot of questions already asked here, however, somehow nothing is working for me. I have a bash script where I have to send password which dump database on remote machine, so its ...
1
vote
1answer
33 views

BASH->Python (2.6) piping

I need to translate this line of Bash into Python: sample1=($(/bin/cat /proc/meminfo | egrep 'MemTotal|MemFree|Cached|SwapTotal|SwapFree|AnonPages|Dirty|Writeback|PageTables|HugePages_' | awk ' { ...
2
votes
1answer
43 views

command output based on pattern

Consider I have a command with some pattern, for example: $ grep "some string" file-[0-99] how can I write result into a file that will have its name based on the current value of a pattern, so ...
0
votes
3answers
26 views

Compress folders older than x days

In /opt/abc I have a path where a new folder gets created daily. In that folder a series of files gets created. I would like to run a script every Sunday at 02:00 and compress each folder which is ...
0
votes
1answer
30 views

how to write c program code to display directories in linux terminl [on hold]

i want a c program to get all the directories from bash terminal.also i need to color different types of files in different colors. eg:-executable files should b displayed in green color, ...
1
vote
0answers
25 views

.desktop launches app with custom icon. why not shell?

I have a .desktop file that launches an app, and it uses the .desktop icon: [Desktop Entry] Name=My Ro Type=Application Comment=Web Application Exec=/path/to/myapp -test Icon=/opt/giteye/icon.xpm ...
0
votes
1answer
17 views

MySQL Crontab Check

I have a serverpilot.io server running from digitalocean (1gb Ram), MySQL will crash once a week, the stats say the server is using ~256 mb out of 1 gb, but mysql will crash saying out of memory.... ...
2
votes
2answers
49 views

How to set JAVA_HOME for all users for “elasticsearch” program?

I'm trying to set JAVA_HOME for elasticsearch but no luck till now. I tried to set it in .bashrc, etc/environment, etc/.profile all fail. this is the command I use to run elasticsearch: sudo ...
0
votes
1answer
27 views

Bash Script to search a webpage

I've Googled my problem, and it's getting more confusing. I want to write a bash script that will search this page for a specific string and echo if it's found. For example, if I wanted to search ...
2
votes
3answers
177 views

How can I discover where apt-get has installed applications?

I have installed 2 development tools named maven and ant using this command: sudo apt-get install maven ant How can I discover what are the installation directories for these tools on my system?
0
votes
1answer
25 views

How to set a permanent environment variable?

I am not yet a Linux guy and I have some problem trying to add a new permanent environment variable. So I have to set a new environment variable named CATALINA_HOME with this value: ...
0
votes
1answer
23 views

Rotate binary files

I'm trying to solve a problem with rotating binary files. I have video files which are recorded from IP camera, and I want to delete oldest files when I have less then e.g. 10 Gb of free space. ...
1
vote
0answers
17 views

Automatically switch to Singstar Microphones when they're plugged in

I am running a media computer for my sharehouse and since singstar has been so popular I want to run Ultrastar for everyone too. The problem is that getting the microphones set up can be finicky and ...
0
votes
0answers
34 views

Script for Opening Two Terminals and Execute Three Consecutive Commands [duplicate]

I intent to open two terminals and execute three consecutive commands in bash script. Basically, the first terminal will execute first command, second terminal will execute second command, and back ...
0
votes
3answers
66 views

Use of the Rename Command

I have a two part question. I have a series of files with the names "file.pdb.#", where # is an integer. 1.) How can I script to rename all the "file.pdb.#" to "file_#.pdb", where the integer is ...
1
vote
0answers
32 views

Different results of 'ps aux | grep x' if entered manually and done via script

It was probably a bad method, but I was running ps aux | grep x | wc -l as part of the if statement in a script. When I ran this from the command line as a regular user, the result would be 1 if the ...
0
votes
0answers
25 views

Sorry, user is not allowed to execute X as root on lt

Whenever I try to run a command from the termainal as sudo, I am now getting the error: Sorry, user {user} is not allowed to execute {command} as root on lt. lt is the name of my computer. The only ...
0
votes
0answers
34 views

What is wrong with my code so far? [on hold]

I'm attempting to make a DNA translation script in bash that will take an input file, iterate through the file, and convert every three characters into the proper protein code it corresponds to. Thus ...
2
votes
1answer
33 views

How can I be sure “apt-get install” successfully finished its work?

I have Ubuntu 14.04 and I intend to download Skyrim. So I put the command into the terminal sudo apt-get install playonlinux. Everything was loading fine and it seemed to be working, however before ...
0
votes
0answers
11 views

Installing YADR on Ubuntu 14.04 error - prezto: old shell detected

I have a fresh install of Ubuntu 14.04 on VirtualBox, and I am trying to install YADR (https://github.com/skwp/dotfiles), which works really well on Mac OS X. However, after I finished installing and ...
0
votes
0answers
12 views

Standard LXC Container configs for shell scripting in Ubuntu?

I would like to do computation in neutral environment. I got a tip about Linux containers here. I am not sure how this project about Linux containers is managed, like who is the central board. ...
-1
votes
0answers
26 views

Script does not run properly under cron - restart OpenVPN

I have a OpenVPN Server, that I connect via a VM (Ubuntu 14.04). In this VM I have the following script, that checks if the connection is up, and then if it's down, it restarts the openvpn service. ...
2
votes
4answers
56 views

Remove whitespace from all array elements

I have a array called arrayvar, which is being defined as arrayvar=( $(awk '/'"$vovar"'/,/}/ {gsub("'"$vovar"'"," "); gsub("}"," "); gsub("{"," ");gsub(","," ");print}' temp1 | tr -d '\n' | sed ...
11
votes
2answers
443 views

Non-sudo alternative to /usr/local/bin for common scripts

I'm used to putting common scripts in /usr/local/bin so that I can execute them from anywhere with the terminal. For example, I make a shell script named 1, make it executable with chmod +x 1 and put ...
1
vote
1answer
37 views

Shell script to remove unity launcher(if present in Ubuntu 14.04 ) and/or the xfce panel (in the case of xubuntu)

Just want shell script to remove unity launcher(if present in Ubuntu 14.04 ) and/or the xfce panel (in the case of xubuntu). If anybody has idea about the same then please let me know. Thanks
0
votes
0answers
10 views

I want to allot ip adress using script file [on hold]

I want to allot ip adress using script file in my C Program ,i.e. by writing the ifconfig command in the bash file and calling it. Pls help how to achieve this.
0
votes
0answers
19 views

How to set environment variables for GUI program?

I am using texstudio, a latex editor, on Ubuntu 14.04. When I start it from bash $ texstudio, and click the compile button, it works fine. However, if I start it by clicking the icon in the launcher, ...
0
votes
1answer
66 views

A bash script to show logged off users [on hold]

Please help me create a bash script to show logged off users. It's easy to know which users are logged into a PC, the problem is to see those who are not, I have some time looking online, without ...
1
vote
1answer
24 views

How to use shell variables after doing sudo su

I am writing a script to fix a missing 'F' letter in a mail log file. The mail log file is continuously updating. I am getting a file name, after that I am doing 'sudo su' to get superuser access. ...
0
votes
0answers
28 views

Using sed to remove all lines containing special characters , numbers, and spaces

So I'm fairly new to using shell--bash specifically--and I'm in the process of writing a script which will translate files containing DNA sequences into a more useful format. Unfortunately, many of ...
2
votes
5answers
63 views

Add particular strings to an array sed/awk/grep

I have this ciscoFlashCopyStatus OBJECT-TYPE SYNTAX INTEGER { copyOperationPending(0), copyInProgress(1), ...
1
vote
1answer
24 views

core file size with ulimit

My question is probably not related to Ubuntu in particular, but since my desktop running this OS, I came to this forum. I am trying to change the core file size using ulimit -c command as follows: ...
1
vote
1answer
30 views

Storing some strings in a array

I have this sCSISmart1 TRAP-TYPE ENTERPRISE cyclone VARIABLES {cycHostAdapterNumber, cycHostAdapterID, cycManagerID} DESCRIPTION ...
2
votes
1answer
25 views

Passing Variable into awk gsub

I have this command Here vovar=OBJECTS prvar="$(awk '/'"$vovar"'/,/}/ {gsub("$vovar"," "); gsub("}",": %s,"); gsub("{"," ");gsub(",",": %s,");print}' temp1)" Contents of temp1 ...
0
votes
0answers
15 views

How can I make the bash pager recognise the terminal window width setting?

I checked that/bin/less is the default pager inside the bash shell. Try for instance: $ man man | egrep regex It does not automatically recognize the terminal window's width setting I have set to ...
0
votes
0answers
23 views

Ubuntu 14.04 desktop goes to sleep when issued “poweroff” command while lid closed?

My ubuntu version is 14.04 LTS. I used the following command to shutdown the system after a certain process was completed (This process takes a long time to complete, so I needed a way to ...
0
votes
0answers
14 views

Getting Rid of Autojump

I just removed autojump and I still get this line whenever I access my command terminal: bash: /usr/share/autojump/autojump.sh: No such file or directory I used sudo rm -rf autojump as my primary ...
0
votes
2answers
47 views

create scatter plot

file (1. arg) will create (scatter plot) for n. column (x-axis, 2. arg) and m. column (y-axis, 3. arg) function is called myfun sourcefile 1 3 for scatter plot of 1. and 3. column from file ...
4
votes
3answers
265 views

How can I pipe the output of a bash or shell command to the clip board? [duplicate]

In order to minimize mouse usage (accessibility and health reasons), how can I pipe the standard out to the OS clip board? That is, I'd like to do something like: $ drush uli | ...
0
votes
2answers
20 views

appends n-th line from the file x at the end of the file y

I have been asked to write a command that appends the n-th line (MYN) from a file (x)to another file (y). Here's what I've done so far: MYN=4 hey=$(awk 'NR==$MYN' x) echo "$hey" >> y But why ...
2
votes
2answers
128 views

How do I write a Bash script for this scenario?

I have these files in the directory home/acs. TBBN027162G_38d8-2f08-0c40 TBBN027605G_38d8-2f08-1518 TBBN027941G_38d8-2f08-0d1c TBBN027923G_38d8-2f08-35e4 I want to read TBBN027162G as service_id ...
2
votes
2answers
178 views

How to cancel next job in order after rsync

If two jobs are entered into bash command line separated by semicolon: $ job 1; job 2; How do I cancel the second one? If I press CTRL+c, the first one will be canceled and 'job 2' would start, I ...
6
votes
5answers
271 views

How do I delete everything after second occurrence of quotes using the command line?

I have this store in a variable sCellEventTrap-03-28 TRAP-TYPE -- CAC Code: 00 ENTERPRISE compaq VARIABLES { scellNameDateTime, scellSWComponent, ...
0
votes
2answers
38 views

How to make a script delete a directory after checking for its existence?

How might one make a bash script which when run will check for the existence of a file/folder and if the file/folder is there remove it?
1
vote
2answers
65 views

How to change niceness of process by name

Java process is killing my computer (Intel i3, 8GB RAM). It takes over whole CPU and system starts to hang. I was trying to change niceness of java processes but i have to control it for all time and ...