Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Ubuntu 13.10, for the default setting, the following command in Terminal

user@host:~/path$ sudo su

results in entering an prompt


And this command

user@host:~/path$ sudo bash

enters prompt


Is this means a different between those two commands to be that ~ have different meaning?

Usually I use sudo only. But sometimes it is not enough. For example if I wanted to write a command that modifies some file with cat >> file <<EOF, and the file is only writeable for root, I have to either use sudo su or sudo bash(assume bash is your preferred shell). But the above example seems to show that use sudo bash is better because the operation environment is more like the previous one. Is this the case? What else are different between those commands?

share|improve this question
You can use sudo tee for redirection with sudo rights. – Daniel Andersson Mar 29 '14 at 11:27
@AvinashRaj The website only shows how to work with simple redirections like ls > out, but not for two way redirections as in my case. So can you or @DanielAndersson show me how to use sudo tee in this case? – Earth Engine Mar 29 '14 at 11:51
~ represents your $HOME directory. – Avinash Raj Mar 29 '14 at 11:56
@EarthEngine: Just write cat <<EOF | sudo tee -a file, followed by content and a new EOF. Your order works as well. Also, the FAQ linked by @AvinashRaj explains the difference in sudo su and sudo bash further down: Special notes on sudo and shells – Daniel Andersson Mar 29 '14 at 11:57

You must log in to answer this question.

Browse other questions tagged .