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

learn more… | top users | synonyms (1)

9
votes
8answers
2k views

change directory (cd) but by replacing a part of the path only

Not sure if it is possible, but i seem to remember from my old days using AIX it was possible to change my path by just saying which part of the path needed to be replaced by something else. For ...
21
votes
3answers
17k 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 ...
6
votes
2answers
2k views

Get a file's emblem from command line?

I'd like to be able to determine what emblem a file has from the command line. Is there a way to determine this? Also, is there a way to apply emblems from the command line? I usually have a cron ...
6
votes
2answers
4k views

What is the default character encoding?

I don't myself know how deep this question actually goes (for example, for all I know there could be several, depending on my task). Particularly, I am interested in what kinds of strings are used to ...
7
votes
2answers
6k views

Most elegant way to check if a process is running, and start if not?

I've been messing around with various ways to do this in bash, and I've found pgrep program > /dev/null || program to be the shortest/most elegant way of doing this. Is there a better method than ...
8
votes
3answers
12k views

How is the default TERM shell variable value set?

After upgrading to Maverick I have my TERM variable set to 'dumb', this does not happen with the same home dir running from Lucid and I didn't manually changed anything related to TERM. Any idea ...
5
votes
3answers
332 views

Copying to two locations at the same time

I'm not very fluent with bash... what I'd like to do is copy the content of a DVD-R to two different hard drives in the fastest possible way. (UI-based solutions are welcome too) Thanks!
27
votes
9answers
83k 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 ...
98
votes
10answers
35k views

Moving from bash to zsh

I'm considering moving from bash to zsh as I often come across posts praising zsh. I'm an experienced command line user and I'm assuming the basics are pretty much the same, so I'm looking for advice ...
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 ...
70
votes
9answers
11k 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?
2
votes
3answers
470 views

Backup bash script is not gzipping its tarball

I have a bash script that runs as a cron to backup files on the server. #!/bin/bash FILE=/path/to/backup_$(date +%Y%m%d).tar tar -cf $FILE /backup/this /and/that /and/someotherfiles gzip $FILE When ...