Script is series of instructions written in plain text file. The script interpreter (i.e. shell, Python, Ruby, etc.) can read this file and act on the instructions as if they were typed at the command prompt. The interpreter also provides a variety of useful programming features to make your scripts ...

learn more… | top users | synonyms (1)

5
votes
1answer
840 views

How to send keystrokes to Chrome in Ubuntu?

I would like my computer to press the Esc key every 2 minutes. How can I do this? With and app or shell script or otherwise?
5
votes
4answers
435 views

How do I make an entire directory executable?

I have an entire folder dedicated to python scripts. I'm tired of doing chmod on every new python script that I write. Is there a way to make every file inside my folder executable if it is a python ...
5
votes
2answers
227 views

How can I delete numbered files in a given range?

I have folderA that has some files with a number sequence starting with a_000000. What I want to do is to delete files starting from a specific number: let's say a_000750 till the end of files in this ...
5
votes
2answers
165 views

Why are my bash script's arguments causing an error?

In order to make uploading the code to github easily, I created a sh script #commit.sh git add . git commit -m $1 git push origin master But when I run it by saying ./commit.sh "comment1 comment2 ...
5
votes
2answers
4k views

How to pass results of bc to a variable

I'm writing a script and I would like to pass the results from bc into a variable. I've declared 2 variables (var1 and var2) and have given them values. In my script I want to pass the results from ...
5
votes
1answer
2k views

How to execute a script as super user first checking the user and getting pass from askpass if not super user

thers a similar question out there How can I determine whether a shell-script runs as root or not? I have the same doubt with different result Is it possible to, within the BASH script prior to ...
5
votes
5answers
2k views

How to collect all the “txt” and “log” files using find?

I currently have this script: find . -iname '*.log' -print0 | xargs -0 tar zcf $file To collect all the "*.log" files from a given directory. I would like to modify it to include also all the ...
5
votes
2answers
153 views

How do I get a list of non-LTS packages installed efficiently?

I'd like to see to what extent my system is LTS-supported by means of what packages are supported for 5 years and which are not. I could disregard some non-5yr-supported packages, as some are rarely ...
5
votes
3answers
23k views

Run a script on login using ~/.bash_login

I need to run a script when I login and logout in my Ubuntu. I tried to put the script in my ~/.bash_login but it didn't work. Is there a better location where I can run my script? My script is ...
5
votes
3answers
2k views

How to get longest line from a file?

I'm interested to find out the line number of the longest line from a file. For example, if I have a file with the following content: lalala tatatata abracadabra mu mu mu how can I write a bash ...
5
votes
2answers
7k views

How to write Bash script What is the command to open a terminal with two different tabed terminals and execute some commands separately tabs?

How to write Bash script to open a terminal with two tabs, and execute commands in both tabs? for instance: tab 1 opens skype tab 2 opens chromium-browser In the end, I want one more thing: write a ...
5
votes
2answers
5k views

How can I run an application in gnome-terminal automatically when booting?

I need to run an application automatically when Ubuntu starts. I've got this app running without opening the terminal. However, this application displays some information in a terminal window and, ...
5
votes
1answer
3k views

How to create Excel xlsx files from a script?

I'm looking for packages available in Ubuntu main/universe repositories (14.04) able to create Excel 2007+ xlsx files from a script (python3 or perl) My requirements: 100% compatible Excel XLSX ...
5
votes
3answers
734 views

Evaluating a string in shell script

I am following this bash shell scripting guide: http://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html In the section Numeric Comparisons, it cites an example: anny > num=`wc -l ...
5
votes
1answer
827 views

How to make scripts run in Guake terminal instead of normal terminal?

I have installed Guake terminal and I find it amazing. I have many scripts added as .desktop files in launcher. Now I want these scripts to run in the Guake terminal instead of opening in the normal ...
5
votes
4answers
15k views

Finding CPU usage from top command

I'm currently using top -b -d 1 > file1.csv to append the entire output to a csv file. However, I'd like the Cpu(%us) field alone to be entered in file1. I've gotten as far as this: top -b -d ...
5
votes
3answers
3k views

Command to activate (either run or bring to front if already running) a program

I want to be able to have a keyboard short-cut to either start or bring to the front a program. (sqldeveloper if it matters) I know how to run it, that leaves: 1) how do I find out if a program is ...
5
votes
1answer
1k views

How to batch rename files (images) based on CSV file

What I have and want to achieve: There are thousands of images in one folder. I have a CSV file with following columns: A: original name B: renamed name A typical row looks like this: ...
5
votes
2answers
195 views

How do I script juju deployment?

I have been working on a few juju charms and am ready to start testing a deployment of our services. Is there a standard method for deploying an environment? For instance, do I have to manually ...
5
votes
3answers
592 views

Where are logon and startup scripts for graphical settings located and how are they managed?

Where and how are the Ubuntu equivalent of your personal Windows configuration stored? Something akin to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run as well as the Start Up menu. ...
5
votes
2answers
945 views

Enabling unattended-upgrades from a shell script

I have a shell script to automatically configure new Ubuntu virtual machines for my purposes. I would like this script to install and enable unattended-upgrades, but I cannot figure out how to do so ...
5
votes
1answer
315 views

My bash function runs only once per terminal opened

When I try to run my bash function, defined in .bashrc, for a second time in the same terminal, it doesn't work. The code is the following: function nos (){ local option while getopts cs ...
5
votes
2answers
11k views

bash: [: too many arguments?

I'm trying to create a directory and cd into it: In ~/.bashrc: function abc() { appname=$1 appdir="$HOME/code/$appname" if [ mkdir $appdir -a cd $appdir ]; then echo Success else ...
5
votes
2answers
715 views

How do the environments of a standard Terminal command-line and a bash script differ?

I know there is something different about the environment of the Terminal command-line and the environment in a bash script, but I don't know what that difference is... Here is the example which ...
5
votes
1answer
1k views

Changing media key defaults in Gnome

Under XFCE, I had option to set my keyboard media keys to run particular programs or scripts. I understand the options to adjust the Keyboard Shortcuts under Gnome, but how do I change the default ...
5
votes
3answers
404 views

How to pass '*' wildcard to path parameter of find command via a variable in script?

I want to use find to find files in a set of folders restricted by wildcards, but where there are spaces in the path name. From the command line, this is easy. The following examples all work. find ...
5
votes
3answers
16k views

How to execute sudo commands with Expect & send commands in bash script?

Can any body let me know how to execute sudo commands with expect. I tried the following but this is not working. Can anyone give me suggestion please? set login "sasuke" set addr "hostname" set pw ...
5
votes
1answer
4k views

bash script source: No such file or directory

I have a script that begin like this #!/bin/bash VALKYRIE=~/myProjects/valkyrie source $VALKYRIE/cluster.conf but when I run it it returns line 2: ~/myProjects/valkyrie/cluster.conf: No such file ...
5
votes
3answers
8k views

Create a .desktop file that opens and execute a command in a terminal

I would like to know how to write the Exec command of a .desktop file to open a new terminal and execute a shell script in it. The shell script is working and accessible by all users. When launching ...
5
votes
4answers
1k views

A script for moving files from subdirs to parent dir

I am looking for a script for moving files from subdirs to the parent directory My folder structure looks like this. Inside of a folder A I have a lot of folders named 1,2,3,4,5... All these ...
5
votes
1answer
3k views

How to set keyboard shortcuts from a script

I appear to be suffering from this bug that means my custom keyboard shortcuts are lost on reboot. I have 8 custom shortcuts, and re-setting all 8 via the GUI method for setting keyboard shortcuts is ...
5
votes
3answers
2k views

Removing numbers and hyphens from file names recursively

I am modifying a simple BASH script to remove numbers and hyphens from the start of my MP3 files. The aim is to rename files such as: 11 Song 1.mp3 1-1-Song 2.mp3 11-1 Song 3.mp3 to: Song 1.mp3 ...
5
votes
1answer
3k views

blackhole exploit kit - Linux Server Script

It has come to our attention when scanning some of our hosted server websites that they have been infected with Blackhole Exploit Kit (top dollar hacking program - ...
5
votes
1answer
843 views

Customize Gnome-Do's default action order

I'm using Gnome-Do with the "Files and Folders v2.5" plugin. I set it to read my .scripts folder, so that I might run my personal scripts from Gnome-Do. The only problem is that Gnome-Do's standard ...
5
votes
2answers
150 views

How to save images from web links given in .xls file

I have an xls file which has weblinks of product-images. The number is about 5000. Can you advise me how can I save these images on my computer. Given here below is a link just to narrate the example. ...
5
votes
2answers
5k views

Python script won't write data when ran from cron

When I run a python script in a terminal it runs as expected; downloads file and saves it in the desired spot. sudo python script.py I've added the python script to the root crontab, but then ...
5
votes
1answer
3k views

Start multiple apps running in shells split in one console

I need to start multiple apps running in shells and monitor their execution. Currently I have a main script that launches every apps in a new gnome-console but I would prefer to launch them all in the ...
5
votes
1answer
258 views

How to set my Bluetooth python script on higher priority than Ubuntu's request?

I have got a Bluetooth Python Server Script on Ubuntu to connect with an incoming request from a Smartphone device. However Ubuntu's Bluetooth is getting the request before my script can react on it. ...
5
votes
3answers
431 views

Convey some message to all users

Is it possible to write a shell script that enables any user (may not be root) to set a message(e.g. "Download on progress do not turn off" etc.) which will be conveyed like pop-up message (zenity or ...
5
votes
1answer
5k views

Script at /etc/init.d does not run at start-up

I wanted to run my Dropbox daemon automatically at start-up. I did it via terminal, that is, I (1) moved it to /etc/init.d, (2) made it executable, and (3) ran sudo update-rc.d dropbox.sh defaults. So ...
5
votes
1answer
323 views

NetworkManager run script before connection based on SSID

Is it possible to have NetworkManager run a script before it connects to a wifi network and pass the SSID of the network to the script (or just execute a script based on SSID)? I'm switching back from ...
5
votes
1answer
264 views

Tell if windows are open and not minimised from shell script Unity

I'd like to add into my .bashrc a little script that sets the terminal background to transparent iff I don't have any non-minimised, non-terminal windows open and leaves the terminal background as ...
5
votes
2answers
2k views

How to diff two folders to multiple patch files

I'm not much of a unix guy so I'll just go ahead and ask: I have a following problem - two folders with plenty of subfolders. I need to diff them. I tried this: diff -drupN vanila_kernel_3.0.8 ...
5
votes
1answer
9k views

rc.local is not always executed upon boot

Hey, I have some weird problem with the rc.local file which is located in /etc/rc.local the thing is that it is not always running when I boot up the laptop. Maybe every second time, I haven't ...
5
votes
1answer
615 views

Can I set up two key-bindings to launch the Main Menu? … specifically: Alt+F1 and Super

I've set up the Super key to open the main menu. It works. gconftool-2 --set /apps/metacity/global_keybindings/panel_main_menu --type string "Super_L" , I have a shell script super.sh which ...
4
votes
3answers
5k views

Is there a standard place for placing custom Linux scripts?

I am developing a set of scripts, which I want to be present for all users, when I set up a server. But I don't want them in the standard locations like /usr[/local]/[bin],[sbin] etc. Is there some ...
4
votes
2answers
437 views

Why isn't this script to delete part of my command history working on my computer?

The script can be found here: http://stackoverflow.com/questions/14750650/how-to-delete-history-of-last-10-commands-in-shell For convenience here it is: for x in `seq $1 $2` do history -d $1 done ...
4
votes
2answers
2k views

How to shutdown Ubuntu after (2 hours) of idle?

Running: Xubuntu 14.04 32bit. I have read several outdated, not working, working different that I want answers here and elsewhere. I had a script that resulted in shutting my Laptop down at boot time ...
4
votes
4answers
338 views

How do I extract the version number portion from the version string?

How do I extract the version number from string=customer-asset-tag-1.0.2.9? Desired result: Component= customer-asset-tag version number=1.0.2.9
4
votes
1answer
4k views

Startup script for a specific user on Ubuntu Server

Here is the command I want to be run at startup: VBoxHeadless -s "pfsense" as user "enedene". Could someone give me step by step instructions?