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

learn more… | top users | synonyms (1)

12
votes
4answers
4k views

Is bash scripting the same as shell scripting?

I'm very new to Ubuntu. I hear people say "shell scripting", "bash scripting". I wonder are they same? Or they are different? Thanks in advance.
12
votes
2answers
9k views

Shell does not show typed in commands, “reset” works, but what happened?

My problem is that the Bash shell stops showing the characters I type into it. It does read the commands though. I've come across this problem quite a few times and I don't understand what causes it. ...
0
votes
2answers
1k views

How do I copy files that I just searched for via the command line?

Using Ubuntu 12.04 I need help on copying files that were returned from a search with grep . I have many pdf files, so to filter specific named files I am using General grep command as follows. ...
2
votes
3answers
5k views

Shell Script to Run Commands to All Subdirectories

I am making a script to simplify my daily tasks. Everyday, I have to grep for a few things inside a company server. It was okay, however, now, they have segregated each object into sub directories. I ...
0
votes
1answer
510 views

How can I make a .deb file from a bash script? [duplicate]

Possible Duplicate: create a .deb Package from scripts or binaries I've made a bash script and stored it in /usr/local/bin. In the future, I'd like to get this bash script in /usr/local/bin ...
16
votes
0answers
4k views

How do I set a path permanently? [duplicate]

Possible Duplicate: How to add a directory to my path? I am trying to install the play framework permanently. http://www.playframework.org/documentation/2.0.2/Installing export ...
0
votes
2answers
2k views

edit ftp file via ubuntu terminal?

I'm connecting my website via $ ftp command. I want to edit some files via nano or gedit.But When I enter nano filename.php bash returns ?Invalid Command. How can i edit files via using ubuntu ...
3
votes
1answer
26k views

How to run Bash script as root with no password? [duplicate]

Possible Duplicate: How do I use sudo in my script without needing a password? I want to run a bash script as root with no password prompt. I tried visudo with no luck(your_username ...
1
vote
1answer
1k views

How can I recursively check folders with flac files for corruption?

Something caused to damage some of my flac files, and to find out which ones I need to rerip, I would like to get a list containing only the damaged files. How I do it now: Open a terminal in a ...
3
votes
1answer
269 views

How do I set ubuntu to compress a series of folders , deleting the original after its been compressed?

I need to setup some kind of script to go through a set of folders, compressing each one, and only leaving the compressed copy of each. How can I do that?
0
votes
2answers
6k views

Source .profile using bash?

I am unable to source my ~/.profile using a bash script. I tried: source ~/.profile By the way this is the script I am using #!/bin/bash echo Enter the shortcut, or alias, you want to use: read ...
2
votes
1answer
6k views

Bash for loop with range {#..#}

The {#..#} generate a sequence of numbers or chars, similarly to range() in Python. If I execute the command echo {1..5} in the command line I have: 1 2 3 4 5 Instead the following bash script ...
2
votes
3answers
1k views

Is there a way suspend 12.04 using a bash command while keeping the password prompt?

I desire to suspend my Ubuntu 12.04 install with a bash script. The pm-suspend command will not prompt for a password when resumed. Is there a way to suspend my machine and have a password prompt when ...
1
vote
3answers
2k views

Bash command to lock the screen in Unity

I am in need to lock my screen with a bash command. The commands below will provide a blank screen, however the desktop is brought back without a password prompt. Is there a better way to do this? ...
1
vote
1answer
206 views

bash doesn't use all directories from $PATH to search for executable

I thought, if you call a command in bash, all of the directories set in $PATH would be searched for this command. (running as root) $ clamscan ./ -bash: /usr/bin/clamscan: No such file or directory ...
3
votes
1answer
3k views

How would you go about backing up a remote Ubuntu VPS via SSH?

So, as I said I have a VPS, Raspberry Pi and a plan, but I am in need of some advice, so here goes. I have a VPS with prgmr.com which I ahve up and running nice and smoothly without any issues. I ...
2
votes
1answer
1k views

How do I flush output appended to a file by a bash function/loop in real-time?

My issue is that I have a function call it function1 which runs indefinitely. The function itself echo's "hello" every 1 second. Using the command: function1 >> temp.txt Every 1 second if I am to ...
1
vote
1answer
78 views

Graphical terminal misinterpreting input

I've been having this weird problem with typing commands into gnome-terminal. If the command takes up multiple screen lines and I use any backspaces and the stars are in proper alignment the command ...
1
vote
1answer
1k views

Print specific dates in a specific format

I would like to write a bash script that prints out the date in the following format: 20120205_16 (year)(month)(day)_(24 hour) so the command to do this for the current date is: date ...
0
votes
2answers
942 views

Batch command that reqiures output redirection

When I want to process a bunch of tex files, I use for f in *.tex; do latex "$f" ; done; What do I do when I need to redirect output to another file, like in case of catdvi? The following does not ...
0
votes
1answer
2k views

How to execute a command on multiple files and redirct output to a different file depending on the name of the input file

I am trying to convert a batch of latex files using catdvi. The command I use for a single file is: catdvi -e 1 -U 1.dvi | sed -re "s/\[U\+2022\]/*/g" | sed -re "s/([^^[:space:]])\s+/\1 /g" > ...
0
votes
1answer
192 views

is there a way to autorun-on-DISconnect a USB external drive (U10.04)?

I have a small USB HD I've bought for doing daily backups, which has an encfs system on it. I've got an autorun script in the root that does a couple of things including mounting the enc-FS and that ...
1
vote
3answers
2k views

grep invalid option on ubuntu

I've already removed and reinstalled grep on Ubuntu but still the same error persists. Whatever grep command I type I always see the following output: grep: invalid option -- '=' Usage: grep ...
1
vote
2answers
2k views

Bash script to add/remove desktop launchers to Unity launcher?

I'm trying to write a script to setup my desktop environment after a fresh install. One thing I can't figure out is how to pin/unpin items to the Unity Launcher from a bash script. Any ideas?
44
votes
4answers
7k views

How can I undo the last cd command?

Is there any way to jump back to the previous working directory after doing a cd to a different directory? My use-case is that I'm traversing a directory structure for a Java project, and I'm ...
4
votes
3answers
277 views

Search and replace within files

I found the following awesome little script at link $ find /home/bruno/old-friends -type f -exec sed -i 's/ugly/beautiful/g' {} \; But I really do not understand the final bit {} \; ...
1
vote
1answer
3k views

XFCE suspend system command

When I click on the exit icon there is a suspend option. When I click this the computer suspends, which works really well. I want to create a custom key mapping on the suspend command XK86Sleep ...
5
votes
3answers
7k views

Different ways of executing binaries and scripts

I've been using Linux for some time now and I've been searching for a complete overview of this but not found any. I just don't come to terms with all the different ways of executing scripts and ...
11
votes
1answer
20k views

difference between gksudo and sudo? [duplicate]

Possible Duplicate: What is the difference between “gksudo nautilus” and “sudo nautilus”? I have tiny script that I want it to run on start-up, but it needs sudo ...
6
votes
2answers
1k views

alias vs. function in bash scripts

I want to know the difference between aliases and functions in the bash shell - and when to use which one. It seems obvious that since functions can take arguments, they are a lot more powerful - ...
2
votes
2answers
306 views

Run shell script on every new shell

I want to run a shell script (define some environment variables) at the start of every new shell (globally, not for several users). So I placed my script into the directory /etc/profile.d/, but that ...
4
votes
1answer
640 views

How to run a script on each login or once a day if not run that day already?

I've made a custom directory where I've put a couple of my favourite wallpapers. I made a script which examines this directory, counts the number of PNGs, and then randomly sets one image as a ...
2
votes
1answer
327 views

How to stop bash prompt colours from escaping

I'm trying to configure bash to display the current git branch, based off the example here, but I can't figure out how to get bash to stop escaping the colour strings. Everything I try results in the ...
2
votes
3answers
1k views

How do I delete a random line in a text file from a given range?

I have a text file and I want to delete random lines from a range. Here is an example: Line 1: abcd Line 2: efgh Line 3: ijkl Line 4: mnop Line 5: qrst Line 6: uvwxyz Out of these six, I want ...
33
votes
2answers
19k views

How can I tell if my system was booted as EFI/UEFI or BIOS?

How do I determine whether a particular running Ubuntu system was booted using EFI/UEFI, or BIOS?
0
votes
1answer
249 views

BASH Downloading File

Now all I have problems with is the yes no statements. They aren't allowing input but look setup like the rest of them... mc_addplugin() { if pgrep -u $USERNAME -f $SERVICE > /dev/null ...
2
votes
3answers
364 views

What do I do if I want to execute ls command everytime I do a cd to any directory?

Most of the time when I do a cd command I also do a ls to see what other files or folder are in that directory. So I want to execute ls everytime I change the directory. I know I can do cd foo ...
11
votes
2answers
8k views

How do I use 'notify-send' to immediately replace an existing notification?

When I use notify-send to show a notification on the desktop, and then use it again to show a different notification, I have noticed that the second one only shows after the first one has disappeared. ...
0
votes
2answers
3k views

unexpected EOF and end of document

I have been fiddling with this code for a few days. Mind you I am a beginner. I just want to get my script to be able to download a remote file, and scan MineCraft plugins. I got the scan plugins to ...
12
votes
2answers
6k views

How do I select a field/column from the output of `ls -l`?

My goal is deceptively simple (at least to me). I wish to take the output of ls -l or ls -lh and select just one field. I am looking for this to be as bulletproof as possible, by which I mean, assume ...
17
votes
5answers
21k views

How do I use wget/curl to download from a site I am logged into?

Some parts of wikipedia appear differently when you're logged in. I would like to wget user pages so they would appear as if I was logged in. Is there a way I can wget user pages like this ...
3
votes
4answers
8k views

Command to delete all files from folders matching name recursivly?

I have my base folder (let's call it base). I have a bunch of folders inside, scattered at various depths within these folders are cache folders. I want to delete all files from within the cache ...
0
votes
1answer
412 views

How do I solve this “unexpected '}' syntax error” in my bash script?

I have a piece of code that has some serious issues and I was hoping to get it solved soon but no one has offered any help. I thought I'd try some Ubuntu users since this is the OS running the script. ...
8
votes
4answers
19k views

How to find history of shell commands since machine was created?

I created an Ubuntu virtualbox machine a couple weeks ago and have been working on projects off and on in it since then. Now I would like to find the syntax of some commands I typed in the terminal ...
2
votes
2answers
877 views

Bash script not working as required with xbindkeys

I made a simple bash script to display a notification whenever my capslock key is pressed. It works fine when I call it like bash capsnotify.sh. The problem now is when I bind my above script to ...
0
votes
1answer
338 views

create a Pseudo command for lampp xampp

How do I create a psuedo command for the terminal? The basic command for lampp is: sudo /opt/lampp/lampp start But I don't want to type this every time so can I create a psuedo for this so I can ...
2
votes
4answers
225 views

Where does 'clear' command come from?

I'm from windows background. I wish to know where do all commands like exit,clear comes from in my terminal? And are they scripts? In what language they have been written?
4
votes
2answers
470 views

Script to find executable based on extension of a file?

I need to create a script that returns the default app to be used for a given file extension (including the path). I had a look at the file command which can return the mime type and xdg-open which ...
3
votes
1answer
389 views

Script for filing call recordings into date folders

We have an IP PBX that is running Asterisk and is set by the manufacturer to delete call recordings after a certain time period. I am backing these up to an Ubuntu server using rsync so that we are ...
0
votes
1answer
525 views

Why won't this bash script to drop caches work?

I am trying to make a bash script to clear my RAM caches. Here's what I have so far: #! /bin/bash free -m sync sudo -s echo 3 > /proc/sys/vm/drop_caches But it doesn't fully work. The first ...