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

learn more… | top users | synonyms (1)

18
votes
9answers
124k views

How do I run .sh files in Terminal?

Whenever I open a .sh file, it opens it in gedit instead of the terminal. I can't find any option similar to Right Click → Open With → Other Application... → Terminal. How do I open this file in the ...
29
votes
9answers
22k views

How do I restrict my kids' computing time?

Access to our computer (not only to the internet) needs to be restricted for the accounts of my kids (7, 8) until they are old enough to manage this by themselves. Until then we need to be able to ...
37
votes
4answers
47k views

Running programs in the background from terminal

How do I run a program in the background of a shell, with the ability to close the shell while leaving the program running? Lets say my UI is having problems or for some reason, I need to boot up a ...
47
votes
6answers
81k views

How do I create a permanent Bash alias?

I would like to create an alias to rm command in order to have a confirmation message after executing this command. So I am creating an alias like this alias rm='rm -i'. But as far as I know this is a ...
70
votes
9answers
10k views

How can I tell what date Ubuntu was installed?

is there a command which will output the date that ubuntu (or any distribution) was installed?
14
votes
7answers
24k views

How do I rebuild a corrupt dpkg status file?

Whenever I type sudo apt-get remove and then press the Tab key for auto-completion I get the following message: grep-status: /var/lib/dpkg/status:15945: expected a colon. I don't see anything ...
52
votes
4answers
22k views

Hide current working directory in terminal

As a default, the terminal prompt shows something like: user@system:/folder1/folder2/folder3/folder4$ the deeper you go into the filesystem, the less space is left for typing in commands. Can I ...
9
votes
1answer
593 views

How to run a command or script at screen lock/unlock?

I am looking for a way to store lock/unlock screen times. A=$(date) echo $A >> $HOME/time_xprofile What did I try: $HOME/.bashrc $HOME/.bash_logout $HOME/.bash_prompt $HOME/.xprofile Then ...
42
votes
4answers
54k views

Why ~/.bash_profile is not getting sourced when opening a terminal?

Problem I have an Ubuntu 11.04 Virtual Machine and I wanted to set up my Java development environment. I did as follows sudo apt-get install openjdk-6-jdk Added the following entries to ...
34
votes
3answers
13k views

Bash history search, partial + up-arrow

I have searched, but not found anything on this. I am looking for a functionality in bash, using a terminal. Way back when, I had a user on a debian system, and a friend set me up with a convenient ...
16
votes
2answers
12k views

How can I shorten my command line (bash) prompt?

Currently it is: michael@Castle2012-Ubuntu-laptop01:~/Dropnot/webs/rails_v3/linker/spec/controllers$ Outside of renaming my machine and directory structure... How could I make it be something ...
11
votes
4answers
8k views

Differences between doublequotes “ ”, singlequotes ' ' and backticks ´ ´ on commandline?

I often see tutorials on the web or posts on this site which make heavy use of the following characters at the command line. Often it seems that they are used for pretty similar purposes. What are the ...
8
votes
5answers
4k views

Home directory not being created

I am trying to understand system administration on Ubuntu. So, as an example, I create a dummy user using sudo useradd -d /home/linda linda and the passwd to create a the password. I check that an ...
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 ...
27
votes
5answers
29k views

How to list all variables names and their current values?

Including not only $HOME, $PWD etc but any other you have defined.
20
votes
2answers
11k 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?
11
votes
5answers
7k views

trim the terminal command prompt working directory

When using the terminal in a deep folder structure sometimes the prompt can take up most of the line. Is there any way in which I can trim the working directory? I know I can do PS1="\W >" to only ...
11
votes
2answers
1k views

Can I enable bash-completion for the new apt command?

The new apt command in 14.04 seems to be a really useful intersection of functionality between apt-get and apt-cache but the current version of bash-completion doesn't know about it... Which makes it ...
9
votes
5answers
8k views

Search for duplicate file names within folder hierarchy?

I have a folder called img, this folder has many levels of sub-folders, all of which containing images. I am going to import them into an image server. Normally images (or any files) can have the ...
2
votes
1answer
5k views

Run simple bash script to start applications at login

I want to run a simple bash script automatically when I log in. For example #!/bin/bash echo "start spotify" gnome-terminal -e spotify --title spotify When I run this command, one gnome-terminal ...
46
votes
7answers
93k views

How to clear bash history completely?

I want to clear all before command from history of my server. I use history -c it seems all things are cleared but when I ssh to the server,all commands are still there. How can I clear them ...
24
votes
3answers
23k views

apt-get autocomplete package name is broken

At some moment apt-get install autocomplete was broken It was very useful to me to see packages name with Tab press How to repair this autocomplete?
20
votes
3answers
14k views

How do I modify my PATH so that the changes are available in every Terminal session

I want to add a directory to search my search path. I know I have to modify the $PATH environment variable. However, I want the change to be permanent, so that it is always in effect, for every ...
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
5k 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 ...
31
votes
4answers
25k views

/etc/profile not being sourced

For 11.04, I did a fresh install of my system. Part of that install was to install rvm, which sticks a rvm.sh in /etc/profile.d/. This doesn't work as /etc/profile (which loads each +r in ...
20
votes
7answers
32k views

Can you set passwords in .ssh/config to allow automatic login?

I'm using ubuntu 11.10. I'm using ssh for connecting to many servers daily, so i put their parameters in .ssh/config file; like this : Host Home User netmoon Port 22 HostName test.com Is there a ...
31
votes
4answers
15k views

Which one is better: using ; or && to execute multiple commands in one line?

In tutorials and how-to's I often see commands combined. For instance, sudo apt-get update && sudo apt-get install pyrenamer There seem to be four possible connectors: &, &&, || ...
21
votes
1answer
47k 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
21
votes
9answers
75k 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 ...
11
votes
5answers
12k 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 ...
11
votes
2answers
5k 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. ...
21
votes
2answers
19k views

How do I add environment variables?

I'm running Ubuntu 11.04. I use the terminal to start a bash session, and I want to add an environment variable: $r@hajt:~$ env THEVAR=/example But it's not working. It shows all the variables with ...
5
votes
2answers
868 views

How does one open the HUD from the command line.

Alt is used to open the HUD in 12.04. I'd like to use alt to execute a second action as well as open the HUD by having alt execute an executable script. So Alt = script, that does HUD and other ...
20
votes
5answers
7k views

How to avoid duplicate entries in .bash_history

The same command is listed in my history again and again. How can I avoid this? I know it's possible via HISTCONTROL but I haven't found the right way.
3
votes
2answers
4k views

Running commands on boot in 11.10

So I am getting properly confused on how to create a startup script on my Ubuntu 11.10 server. I have read about init-scripts, upstart-jobs and more, but I get even more confused the more I read. ...
14
votes
3answers
30k views

What is the difference between 'su -' , 'sudo bash' and 'sudo sh'?

I would like to know what is the difference between su - sudo bash sudo sh I cannot login as root while doing su - because I do not have the root password - I mean I have my user password with ...
7
votes
4answers
1k views

How do I set the prompt to use two colors?

However, one thing I liked about Mint was that the terminal would usually show two colors: everything from the left to the $ would be one color (green, I think), and every then past the $ would be ...
5
votes
4answers
3k views

Concatenating several .mp3 files into one .mp3

As it was suggested here I am using cat command to concatenate several .mp3 files into one .mp3 file. Imagine, I have following .mp3 files in the current folder: 001001.mp3 001002.mp3 001003.mp3 ...
4
votes
1answer
4k views

How do I install libusbx library

I am trying to run flashtool (flashing utility for android phones) in ubuntu. Already setup java and appropriate environment On execution the following error comes up rajeswar@WebE-PCl:~$ ...
3
votes
2answers
6k views

How can I install a specific older version of Firefox and keep it from automatically updating?

I wrote a bash script to configure a suite of tools for continuous integration on top of Ubuntu 10.04.2. The script recently stopped working and I tracked the problem down to the newer version of ...
10
votes
2answers
10k views

Tab completion doesn't work for commands

I am trying to use tab completion for commands in Ubuntu 11.04 Beta 1, running all the latest updates, but it doesn't seem to work. (Though package bash-completion is installed) Tab completion works ...
3
votes
2answers
279 views

Any way to list similar commands?

When you write the command name wrong, bash often does this: septi@norbert:~$ good No command 'good' found, did you mean: Command 'gold' from package 'binutils' (main) Command 'gmod' from package ...
2
votes
3answers
14k views

Wubi Grub Prompt “Minimal BASH-like line editing is supported” [duplicate]

I just installed ubuntu today with WUBI. After installing, the first time I tried to boot it, it gave me a screen with this grub prompt: Minimal BASH-like line editing is supported. For the first ...
3
votes
3answers
384 views

Where can I find a complete reference for the $PS1 variable?

The default PS1 variable on my machine (Kubuntu 13.10) is this: \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$ I'm looking for a reference for how the $PS1 variable works that, at ...
3
votes
4answers
10k views

Using the Terminal in Ubuntu to change directory

I have a question about using the terminal in ubuntu 11.04.I have installed wine and steam and civ III thru steam.According to instructions on wine forum in order to play civ some font files need to ...
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
6answers
10k views

What to do when Ctrl-C won't kill running job?

Sometimes, processes ignore the SIGINT signal sent by Ctrl-C in Bash. For instance, man and vi. Assuming you don't want to google or read the manual on how to exit the running process, is there any ...
20
votes
4answers
7k views

How to navigate long commands faster?

Is there a way speed up Linux CLI navigation when I must enter long commands? I simply use arrows right now, and - if I have a long command it takes some time to get from start of the command to the ...
25
votes
3answers
3k views

Conveniently schedule a command to run later?

What's a simple way to run a command, say, 8 hours from now? I can think of this way: nohup bash -c "sleep 28800 ; ./mycommand.sh" & Is there a more "proper" way?