A shell script is a script written for the shell, or command line interpreter, of an operating system.

learn more… | top users | synonyms (1)

38
votes
5answers
7k views

How do I create a deb package for a single python script?

I have a single python script that I want to distribute as a deb package. It is a indicator which shows local date in Unity panel. I did follow create a .deb Package from scripts or binaries but I ...
17
votes
5answers
24k views

How do I tell a start up program to start minimized?

Here is a quesion that has been bugging me. You know how you can set up a program to run on start up right? Well, how can i tell it to start minimized, like you would do in windows? TeamViewer ...
8
votes
2answers
5k views

Apply icons to bash scripts

I created a script for XChat according to this answer, and I was wondering if there is anyway to apply XChat icon to it.
7
votes
2answers
2k views

Autorun a script after I plugged or unplugged a USB device

What can I do to run automatically a script after I mount/plugin or unmount/unplug a USB device?
46
votes
3answers
3k views

Is #!/bin/sh read by the interpreter?

In bash or sh, I guess anything which starts with # is a comment. But in bash scripts we write: #!/bin/bash And in Python scripts, there is: #!/bin/python Does this mean that # by itself is a ...
18
votes
5answers
38k views

How can I make a script that opens terminal windows and executes commands in them?

I have three scripts I need to run when I start up my Ubuntu machine, they start services I use in my development environment. To do that, I manually open three terminals and type in the commands. ...
10
votes
3answers
11k views

How to run a script during boot as root

I had a script that automatically enables my wifi without using networkmanager, but I don't know how to run the script as root while the system is booting. How do I make the script run automatically ...
7
votes
2answers
5k views

Execute a script upon logout/reboot/shutdown in Ubuntu

I'd like to run a .sh file using bash on logout and shutdown of Ubuntu. I have searched up and down the web and have found only fixes for KDE and GNOME. The script is simple, I just need to know if I ...
25
votes
2answers
51k views

How to add a shell script to launcher as shortcut [duplicate]

Possible Duplicate: How can I edit/create new launcher items in Unity by hand? How can I create launchers on my desktop? I want to add some shell scripts in my launcher as shortcuts.. ...
8
votes
3answers
5k views

Launch an application in Windows from the Ubuntu desktop

I'd like a write a shell script in Ubuntu that does the following: Boot up a Windows 7 guest OS in Virtualbox, if it isn't running already. Run a shell script in Windows, where the shell script is ...
14
votes
2answers
1k views

What is apt-fast and should I use it?

Several times over the past couple years, I've heard of people using apt-fast for updating and installing packages, but I'm not really sure what it does. I think I've traced its origin to this forum ...
29
votes
3answers
6k views

How to make Skype use notify-osd?

How do I make Skype use the default Ubuntu notify-osd to display notifications (incoming messages, users connecting, etc.) instead of the Skype's own "ugly" message box?
21
votes
1answer
8k views

how to execute a command after resume from suspend?

I've got a script that is executed in order to have suspending/resuming working in my laptop. Then I have another series of xinput,xkbset and xmodmap commands that are executed when I initiate a ...
8
votes
1answer
3k views

How do I make post-install scripts?

How do I make post-install scripts so when I reinstall ubuntu everything is as I want it? Things I want to achive: Installing PPA installing my programs themes needs to be installed Settings needs ...
52
votes
1answer
5k views

Can I make the webcam take a picture when an incorrect password is entered?

I am using a laptop . I was thinking to have a support in my Ubuntu machine. When an incorrect password is entered, a picture is taken later revealing who has been trying to gain access. I have ...
2
votes
2answers
251 views

Script to Notify me when something happens on a shared directory

The situation is: I have a shared directories from many other machines where other users work on. I need to be notified whenever a user create, modify or delete a directory or file from his local ...
10
votes
2answers
17k views

Why doesn't rc.local run all my commands, and what can I do about it?

I have the following rc.local script: #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # ...
3
votes
3answers
913 views

Script at Startup

I'm using 10.10 and I need to run a script in order to get a windows-like international keyboard layout - basically, it changes how dead keys work. (Original script from this page ...
43
votes
3answers
50k views

How can I get a list of all repositories and PPAs from the command line?

I know how to list all packages installed on my system. But how could I get a list of all repositories and PPA's? I know I can look into /etc/apt/sources.list and /etc/apt/sources.list.d, but I'm ...
42
votes
6answers
9k views

What is the difference between ./ and sh to run a script?

I have written a simple script. When I runsh <myscriptname.sh>, i got the correct output, but when I run ./<myscriptname.sh>, I got an error. What is difference between when I do sh and ...
26
votes
8answers
2k views

How to keep “dot files” under version control?

Etckeeper is a great tool for keeping track of changes to your configuration files in /etc A few key things about it really stand out. It can be used with a wide variety of VCSs: git, mercurial, ...
33
votes
2answers
67k views

What is difference between #!/bin/sh and #!/bin/bash?

if I write, #!/bin/bash echo "foo" or #!/bin/sh echo "foo" both yields same. I have seen some scripts starting with #!/bin/sh or #!/bin/bash. Is there any difference between them?
19
votes
4answers
58k views

I've downloaded a .sh file - how do I install this?

I'm new to Ubuntu and know installing programs only from window. It is very easy there: Just double-click the setup.exe and the things start. But how do I install a program on Ubuntu? I want to ...
37
votes
2answers
12k views

What is the difference between “source” and “.” in bash?

As the question says, what is the difference between executing a script with source command and with . , i.e.: source /some/script and . /some/script
32
votes
2answers
6k views

bashrc or bash_profile?

I know the difference between the two bash login scripts: .bashrc is run only by "non-login" shells. .bash_profile (or .bash_login or .profile) is executed by "login" shells. Does anyone have some ...
25
votes
9answers
80k views

How can I create a select menu in a shell script?

I'm creating a simple bash script and I want to create a select menu in it, like this: ./script echo "Choose your option:" 1) Option 1 2) Option 2 3) Option 3 4) Quit And according to user's ...
23
votes
5answers
28k views

How to execute a script just by double clicking like .EXE files in Windows?

How can I make a bash script executable by double clicking just like .exe files in Windows? I tried creating a launcher and assigning the script to it, but there are two consequences: the terminal ...
22
votes
1answer
50k views

Command to append line to a text file without opening an editor

Assuming i have a line that i want to add to a file without opening an editor. How could i append this line alias list='ls -cl --group-directories-first' to this file config.fish
15
votes
3answers
80k views

How can I make “rc.local” run on startup?

I have a script that I would like to run when my system starts. I have put it on "rc.local", but it doesn't work. How can I enable it to run on startup? Thanks!
17
votes
5answers
10k views

Execute script before shutting down

When I shut down my computer I want to show some pending tasks that I have to do before leaving the office... I did a local application to manage those tasks, basically I just want to run a command, ...
14
votes
1answer
2k views

How to run a shell script when a new USB storage device is detected?

I want a script that dumps the log and starts logging on it as soon as a usb mass storage is plugged (with the file 'OKdump' on it).And if anything abnormal(Like a error that is visually present) is ...
6
votes
3answers
7k views

Run (system) script on SSH login and/or logout

I'd like my OpenSSH server to start a script whenever a user logs in using SSH, ideally passing the host name or IP, as well as the user name. Additionally I'd like it to run a script, whenever a ...
9
votes
2answers
1k views

What is the least insecure way to store a password that is used by a script?

I have a Bash script that automatically authenticates with a service using my username and password. The credentials are currently stored as plain text within the script. What precautions should I ...
5
votes
2answers
2k views

Run Script on Wakeup?

Is there a way to run a script when a computer "wakes up" (from sleeping)? I know it can be done on startup, obviously, but the issue in this case is that the backlight of my laptop seems to reset ...
3
votes
3answers
1k 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 ...
3
votes
1answer
336 views

How to emulate pressing the Close button from a script?

I wanted Thunderbird to stay in the Background to notify me of incoming mails. After a bit of searching, I found this post. How to keep Thunderbird and Pidgin running on background? The solution is ...
2
votes
5answers
6k views

How to batch rename files with “variables”?

I use xmbc to view my tv shows. Before I began using xmbc, I batch downloaded the first few seasons of "Bleach". What can I say, I'm an anime fan ;-). These are named: "bleachxx.mp4" where xx is the ...
1
vote
2answers
3k views

Transmission shutdown script for multiple torrents?

I have written a shutdown script for transmission. Transmission calls the script after a torrent download finishes. The script runs perfectly on my machine (Ubuntu 11.04 & 12.04). #!/bin/bash ...
46
votes
1answer
26k views

Differences between /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin [duplicate]

I'm running an Ubuntu Server 13.04, but I see the same on a 12.04: I have six directories with command files. These are: /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin What are the ...
28
votes
7answers
5k views

Repeat a command every x interval of time in terminal?

How can I repeat a command every interval of time , so that it will allow me to run commands for checking or monitoring directories ? There is no need for a script, i need just a simple command ...
25
votes
5answers
20k views

Beep in shell script not working?

I'd like to use a beep sound in a shell script. Unfortunately none of the methods I found via Google work for me. I tried echo -e '\a' echo -ne '\007' and the command beep after I installed it ...
39
votes
3answers
10k views

How can I determine whether a shellscript runs as root or not? [duplicate]

Possible Duplicate: How can a script check if it’s being run as root? This is something I've been curious about. I make a lot of small bash scripts (.sh files) to do tasks that I routinely ...
14
votes
2answers
2k views

How can I write Nautilus scripts in Python?

I want to write a Nautilus script in Python. Is that possible? If it is possible, how can I do that?
14
votes
5answers
14k views

How to start a terminal with certain text already input on the command-line?

Rather than rephrasing my question, let me describe to you the desired user-case: I create a short shell-script to run command "gnome-terminal --someoptionflagname 'my text to be posted'", and ...
10
votes
1answer
20k views

How to run a shell script in background?

How can I run a shell script in background?
7
votes
3answers
5k views

Call script after connecting to a wireless network

Is there a way for me to call a shell script once I connect to a specific wireless network? Reason I want to do this is I have to login to the network before I can start using it and I would like to ...
7
votes
5answers
587 views

Generating an app list from the old installation to run it on the new installation

I want to shift from ubuntu-desktop 10.10 to ubuntu netbook edition 10.10 on my netbook. Currently, the moment I ssh into ubuntu from my ad-hoc network, ubuntu freezes. It always requires a cold ...
7
votes
2answers
1k views

Getting a script to run on boot, not on login

How can I get a specific script to run (preferably not as superuser) whenever the machine boots, but before login. It can be the last thing to run on boot. I mostly just want the script to work even ...
15
votes
3answers
6k 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 ...
11
votes
2answers
39k views

How do I run a script after OpenVPN has connected successfully?

How can I associate a script to OpenVPN so that it runs when the VPN is connected successfully?