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

learn more… | top users | synonyms (1)

9
votes
2answers
863 views

What does the l command do?

There is a command l available on my machine which appears to do nothing. which l also produces no output. Is this a real command, and does it actually do anything?
6
votes
3answers
1k views

How to open several image files from command line, consecutively, for editing?

Lets say I have three image files to edit. Consider all the files are in ~/Pictures. Let name of the first file be 1.svg, name of the second file be 2.svg and name of the third file be 3.svg .I have ...
6
votes
6answers
24k views

How do I change my PYTHONPATH to make 3,2 my default Python instead of 2.7.2?

I have python3.2 located in /usr/lib/python3.2. I am not sure if that means it's installed but I assume it is for now. Some facts about my system: $ which python /usr/local/bin/python When I type ...
6
votes
3answers
466 views

How do you get details from the output of the locate command?

When I run the ls -l command I get details about the files in the current directory like permissions, owner, group, file size. Is there a way I can get these same details instead of just the ...
6
votes
3answers
6k views

using grep with pipe and ampersand to filter errors from find

I am using cygwin to find a file on the cygdrive. However I need to suppress the permission denied messages (otherwise the results get hidden in the error messages). The following command works: ...
6
votes
3answers
2k views

Why does my shell script hang without the .sh extension?

I created a shell script /usr/local/bin/suspend with the following content: #! /bin/sh # Take an optional delay parameter if [ "$#" -gt "0" ]; then sleep "$1" fi # Put the system to sleep ...
5
votes
4answers
632 views

How can I prevent accidental execution of the rm -r *command?

Occasionally I use command to delete some files. For example, the name might start with 'a', so I'll delete with the command rm -r a*, but I don't want to remove some other directory by accident. How ...
5
votes
3answers
795 views

How do I list the public files in my home directory? (mode 777)

I want to get the list of all the files in my home folder, having rwx (read-write-execute) or 777 permissions for everyone. Also, what is the command to know the permissions of a file?
5
votes
5answers
5k views

How to have a path containing spaces in PATH?

I tried export TASK=$HOME/Ubuntu\ One and export TASK="$HOME/Ubuntu One" but neither works.
5
votes
3answers
858 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 ...
4
votes
2answers
104 views

Emulate mouse click when hitting a key

I am trying to emulate left-mouse-down when Home key is down and left-mouse-up when Home key is released. The reason behind that is my touchpad's buttons are terrible and I like to use the ...
4
votes
4answers
461 views

Getting values from variables - bash script

I am trying to write a bash script to print values of the 3 variables. Keep getting errors. What am I doing wrong? INPUT1=/tmp/dir1 INPUT2=/tmp/dir2 INPUT3=/tmp/dir3 for i in 1 2 3 do echo ...
4
votes
4answers
3k views

segmentation fault when using su or sudo

example of the problem: $ su Segmentation fault $ sudo ls Segmentation fault I tried to compile sqlite3 from source earlier. I don't know what libraries it installed. This may be the reason why ...
4
votes
4answers
4k views

How can I make ssh-copy-id use a port other than 22?

How can I make ssh-copy-id use a port other than 22? I tried it with -p but I get: ssh-copy-id -p XXX XXXX@XX.XX.XX.XX Bad port 'umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ...
4
votes
1answer
3k views

Can't change theme of ZSH in Ubuntu 12.04

I have changed the theme in my ~/.zshrc file however whilst some of the colors in the prompt change the text size and background color remain as the Ubuntu default. Any one know how I can override ...
4
votes
1answer
7k views

Undertanding .bashrc and .bash_profile

On a server when I login as root I see .bashrc (ubuntu 10.10). On my Mac I have a .bash_profile, does ubuntu always have only a .bashrc file and not .bash_profile? (just confused so asking, I realize ...
4
votes
1answer
2k views

Toggling between Unity 3D and unity 2D [closed]

Generally, I much prefer Unity 3D over the 2D version, which is a bit broken on my machine. However, I frequently give presentations, and Compiz doesn't support multiple screens. I've been forced to ...
3
votes
3answers
243 views

Sudo command in bash script halts the script

I have an early 2009 iMac with a sensor problem. The ODD and CPU fans run at full speed. To get them down to minimum speed in Ubuntu I need to set the speeds in the Terminal, using this method. Rather ...
3
votes
4answers
429 views

Add to path only sh file not a dir

I have a bin folder with a bunch of sh files. For example "server-run.sh", "server-stop.sh", "server-do-something.sh". And I want to run file "server-stop.sh" from anywhere. I could add this bin ...
3
votes
1answer
1k views

How to check in a bash script if passed argument is file or directory?

I have to write a simple bash script in Ubuntu which would allow me to pass it some arguments and I want to check if these arguments which can contain spaces are files or directories. How can I do ...
3
votes
2answers
5k views

How to rename all files in folder with name ending with “_backup”

I have a bunch of images that were somehow renamed from myimage.jpg to myimage.jpg_backup, so the images on my website don't load anymore. How would I recursively find all images ending with _backup ...
3
votes
1answer
81 views

no features in bash in new vps?

I have 12.04 server minimal running on my VPS. When I ssh into the server, only $ is showing at the prompt for each prompt. There's no typical <directory> <username>$, no autocompletion ...
3
votes
2answers
3k views

Run Bash Script as Root

Is there some way I can run a Bash script as root without being prompted for a password every time? I'm attempting to automate the process of starting my LAMPP install, which requires me running a ...
3
votes
2answers
4k views

How to replace/fix a messed up /bin/sh and /bin/dash

I have corrupted my /bin/sh and have no idea how to replace it. I accidentally copied over it. How can I fix this? I am running Ubuntu Server 11.10, no X. update: I have tried the fix that was ...
3
votes
2answers
771 views

Wget like utility to download all images in mysite.com/img/ directory

My access to the mysite.com/img/ directory is blocked. However all the images in that directory are in the form n.jpg where n is the nth image. My access to mysite.com/img/n.jpg is not blocked Is ...
3
votes
4answers
221 views

Is there a way to take influence on behavior of bash history?

In terminal the bash history is often helpful when you are searching for a command-line that you already used. But is there a way to influence the behavior of the bash history (i.e. which commands are ...
2
votes
1answer
173 views

Why isn't .profile sourced when opening a terminal?

Just installed Ubuntu 14.04.1 LTS. According to .profile, # ~/.profile: executed by the command interpreter for login shells. # This file is not read by bash, if ~/.bash_profile or ~/.bash_login ...
2
votes
1answer
215 views

fsl.sh cannot be sourced

I need to install FSL and Freesurfer as part of running Connectome Mapper. Freesurfer required changing the shell to tcsh in order to configure its folders. Now for FSL, I have to add to .profile the ...
2
votes
1answer
307 views

How to remove element from gsettings array in script?

Array in dbus/gsettings has a format [element1, element2, element3, ...]. Gsettings' interface allows only replacing existing array with another, so for instance, adding another item element can be ...
2
votes
2answers
429 views

Temperature & RAM monitoring script

I have the following script: while : do clear; echo "---------------------------RAM Load------------------------------$ free -mt >> memory.txt; free -mt; ...
2
votes
4answers
980 views

Bash History not containing all history and blank after reboot, how to resolve?

I've recently upgraded from 13.04 to 13.10 and realized my terminal bash history is not surviving reboots. cat ~/.bash_history gave me a permissions denied error. I, possibly unnecessarily or ...
2
votes
1answer
2k views

Passing multiple commands to gnome-terminal from a script

My bash-script is not run in a terminal, but opens a terminal at runtime to ask for user input (sudo password). I would like to tell the user in this terminal what the script is trying to do. First, ...
2
votes
4answers
195 views

Using filename substitution — How to search for files with letters in this order?

So I need to find all files which have d, o, and g in the filename. The letters do not need to be side by side (aadaaoaagaa would be a correct filename, aaoaadaag would not be a correct filename). It ...
2
votes
1answer
988 views

How to execute a script before login screen?

I would like to know , how can I run scripts before the login screen.I mean My script should start running before login screen will appear.How can I achieve that?. I am the root user of that PC. ...
2
votes
2answers
527 views

“too many arguments” checking a condition and execute some action in case it's not true?

I have edited my sudoers file to allow my non-root user to run sudo commands without being prompted for a password. In vim, how do I create a function that checks whether this condition is true, if ...
2
votes
1answer
144 views

Is there a way to alias the command cd so that it protects the arguments?

When I run cd My folder There is an error because I have not protected the string. bash: cd: My: No such file or directory But this works fine cd "My folder" Is there a way to redefine cd as an ...
2
votes
1answer
812 views

How to run script at shutdown? [duplicate]

How can I make a bash script run only at shutdown? I have searched for it and keep coming up empty handed. I would be fine with either a link or an explanation to how to do it.
2
votes
3answers
4k views

I accidentally overwrite /etc/bash.bashrc file. Please give the default content

I accidentally overwrote the /etc/bash.bashrc file. Please give me the default content in that file to restore, or the file itself.
2
votes
1answer
201 views

Extra dash insertion when trying to run tar

I have a really weird issue where I'm getting an extra - insertion on tar: # tar -zxvf mod_wsgi-3.3.tar.gz /bin/tar: unrecognized option '--zxvf' Try `tar --help' or `tar --usage' for more ...
2
votes
3answers
393 views

What other bash variables are available during execution such as $USER that can assist on my script?

This is related to question 19245, in that one of the responders answered the question in an awesome way, and very VERY clear to any newbie. Now here is a question that i can't seem to figure. i ...
1
vote
4answers
166 views

Create bash file to open minecraft launcher

I use this command in the terminal to run the minecraft launcher with java 8: /home/max/Java/jre1.8.0_25/bin/java -jar Minecraft.jar I included the full java path because I installed it on /home as ...
1
vote
2answers
75 views

How can I run a bash script without affecting the file system?

I am trying to create some soft of a sandbox for linux systems (ubuntu). My main goal is to find out which files are executed by a bash script of my choice, without actually letting it run them. I ...
1
vote
1answer
3k views

Pause execution and wait for user input

I have a script that I am making and I have an issue with it: I would like to pause execution and wait for user input. I thought that I had it with the read -p -n 1 $foo command but the system is ...
1
vote
1answer
155 views

How can I remove an entry from a list in a shells script?

I have the following script: #!/bin/bash # Bash Menu Script Example PS3='Please enter your choice: ' options=("Option 1" "Option 2" "Option 3" "Quit") select opt in "${options[@]}" do case $opt ...
1
vote
2answers
455 views

Declare an array but not define it?

There are a lot of guides out there which show how to declare and define an array foo[0]=abc foo[1]=def What I am trying to achieve is to declare an array but not define it because it does not ...
1
vote
1answer
87 views

Keep working with bash while a program is running [duplicate]

I know, this is a very stupid question and the answer is out there in Googleland. But I just can't find it. I want to start a process/program (e.g. firefox) in bash and keep working with the ...
1
vote
1answer
246 views

Why does the “who” command not show “root” as a logged in user?

When I log in as root from gnome-terminal using the command: sudo su it logs me in as the root user. Isn't this switching a user considered as a log in? Also, which command can show me all the ...
1
vote
1answer
1k views

problem on java: not found

Initializing InstallScape using JVM at /home/manoj/iscap/iscape/runtime/LNX86/bin/java. This might take some time... /home/manoj/iscap/iscape/bin/iscape.sh: 209: exec: ...
1
vote
1answer
153 views

Bring all open terminal windows forward using a script

I am trying to use a script suggested for an answer I asked earlier, however I am having trouble getting it to work. The script should bring all instances of a program (whose name is passed as an ...
1
vote
2answers
363 views

Basic script listing directories ([: discover: unexpected operator)

I encounter an issue running a basic script listing directories. for item in * do if [ -d $item ] then echo $item fi done The outcome: lists all system folders returns an error: ...