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)

6
votes
1answer
367 views

Create a script to open firefox with some google search term from terminal

Is there any way to create a script or a program that will open firefox, go onto google and search for the arguments passed to it ? So something like google How do I shoot web should open Firefox ...
6
votes
1answer
709 views

Can you help me write a script to set a new default brightness for the screen/keyboard after login?

On my Macbook Pro Ubuntu alsways boots with... keyboard brightness at maximum illumination screen brightness at maximum illumination ...both which I need almost never during normal usage. ...
6
votes
2answers
937 views

How can I create automated keyboard scripts?

Is it possible to do the following in Ubuntu? If so can someone point me in the right direction. Say you want to set a keyboard shortcut to do the following: For examples sake, set Alt+F to open ...
6
votes
8answers
3k views

Which download manager is capable of 'throttle' and 'pause & resume' a running instance of download from a script

When downloading big files it necessary to pause the download many times. A big file can be downloaded by using wget. First start download, then kill wget, then resume download by wget -c. I want to ...
6
votes
1answer
795 views

How can I make a script to place files older than each day before into their own folder?

I'm running an unnecessarily complex script which looks similar to this command: find /home/user/videos/*.avi -mtime +0 -exec mv -f {} "/home/nb/videos/1 day old" \; And then I run the same ...
6
votes
3answers
6k views

Run script as root at login (no sudoer user, shell session)

Much like /etc/profile and ~/.profile but ran by root instead of the user is doing login. /etc/rc.local runs after boot but I need running the script before login. The user is not a sudoer one. ...
6
votes
1answer
371 views

How to run a script when password is entered at the lock screen?

To toggle the enabling/disabling of my notebook's touchpad according to connected USB mouse, I used touchpad-indicator, which runs a daemon to monitor connected devices and take appropriate action. ...
5
votes
2answers
12k views

What does outputting to /dev/null accomplish in bash scripts?

Oftentimes I run into small bash scripts that use this sort of syntax in if statements: "some command" > /dev/null 2>&1 What is the purpose of outputting to /dev/null like that, and what does ...
5
votes
3answers
863 views

Why is this by passing the SUDO password?

I have a bash script I am using to automate a SVN checkout. The contents of the file were: #!/bin/bash cd /var/www-cake sudo svn checkout file:///usr/local/svn/bash_repo/repo/ Then when I double ...
5
votes
5answers
420 views

Needed simple script/loop/command for input command, execute and output within textfiles

Suppose I have list of commands in text file as below (cat cmdlist.txt):- cut lshw top awk sensors Now I want to get simple information on that command by whatis cut, whatis lshw etc. respectively ...
5
votes
3answers
4k views

How can I make a script run automatically after gdm login and logout?

I have a setup where my users log on using ldap and it works just fine. I want to run a script after my users login (its a script that will detect which groups they are in and map network shares ...
5
votes
1answer
5k views

How to loop through arguments in Bash ($1 $2 $3 and so forth)?

I have the following code snippet for num do echo $num done But I don't understand why it works! How come does Bash know to loop through my params $1, $2, $3, $... using my personal taste of ...
5
votes
1answer
887 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
2answers
414 views

Move multiple files to a dir if their names contain the same string present in dir name

I have multiple files in one folder: ABA.xy BEB.xy ACA.xy The same files with different extension in another folder ABA.rr BEB.rr ACA.rr Then I have single folder for each file name ABA BEB ACA ...
5
votes
4answers
634 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
263 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
183 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
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
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
163 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
25k 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
209 views

Count down script is not working

I am trying to create a script that will count down to 0 from what ever number I give it. Below is my script and basically nothing happens, no error message, I merely get the standard command line ...
5
votes
3answers
3k views

How to completely restart script from inside the script itself

I'm setting up a shell script with menues and sub menues, options, etc. But on each menu/submenu/etc, i need a "Go back to main menu" choice. I've already got the menu set up and it works fine, but i ...
5
votes
2answers
8k 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
7k views

Writing scripts with arguments?

I want to write shell script that takes an argument, and then applies it to files. Specifically, I want to give a term, and then have it compile term.as with mxmlc ("mxmlc term.as"), then run ...
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
3answers
144 views

To which directory should I install a program from a bash script?

I want to install Netbeans 7.0.1 with a bash script from the Netbeans website. The default directory chosen by the installer is /home/geoffrey/netbeans-7.0.1. But I do not think it belongs there.
5
votes
4answers
16k 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
943 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
2answers
226 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
1answer
896 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
2answers
743 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
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
2k 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
710 views

Recursively apply the msgfmt command to all .po files in directory with find -exec

I have the following directory structure: webiste/ locale/ en/ LC_MESSAGES/ translation.po de/ LC_MESSAGES/ ...
5
votes
3answers
652 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
1answer
342 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
1answer
3k views

Ubuntu 12.04 doesn't seem to execute my .profile file

(I'm kinna n00bish) 1: I had ubuntu 11.10 installed, then upgraded to 12.04. 2: I had a script in my .profile file to turn off my laptop's touchpad (it worked, and was executed on login) 3: Now it ...
5
votes
2answers
12k 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
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
1answer
66 views

What do these commands from a shell script do?

I'm just starting to learn bash. I have the following script, and I would like to know what does the following commands do in order to start to understand a little bit this world. if [ ! -w "." ] ...
5
votes
3answers
927 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
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
10k 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
3k 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
866 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 ...