In the middle of a shell script, I need to create a file with some specific content. How do I do it? Can it be done using cat?
I'm just trying to review basic terminal commands. Having said that, how do I create a text file using the terminal only?
How do I add a new, valid tag when I don't have enough reputation? I'd like to post a question on StackOverflow, but I think I should be able to tag it with    . Poor me, there is no  tag; There is  and , I'm certainly not sure this is the right thing to do, so figure I'll start here.  Edit Question located here: How to determine which window manager is running Is there any way (such as a command or environmental variable) to determine what window manager is the one actively running in the current session? How to add an image to a JPanel? I have a  to which I'd like to add JPEG and PNG images that I generate on the fly.  All the examples I've seen so far in the , specially in the  use ImageIcons.  I'm generating these images as byte arrays, and they are usually larger than the common icon they use in the examples, at 640x480.   Is there any (performance or other) problem in using the ImageIcon class to display an image that size in a JPanel? What's the usual way of doing it? How to add an image to a JPanel without using the ImageIcon class?   Edit: A more careful examination of the tutorials and the API shows that you cannot add an ImageIcon directly to a JPanel. Instead, they achieve the same effect by setting the image as an icon of a JLabel. This just doesn't feel right... Opposite of Alternatives How can you accelerate without moving? I know this question has been asked in other forms, generally regarding the balance of forces.  This time I want to focus on motion.  I've got a laser accelerometer on my desk.  It tells me that I'm accelerating at $9.8~\rm m/s^2$.  For the first experiment I'm travelling in space.  I pick a nearby star and discover that I move about $490$ meters in $10$ seconds from that star.  For the next experiment I'm on the surface of Earth.  I measure the same acceleration with my laser accelerometer.  I pick a spot (the center of the Earth) and discover I don't move at all in $10$ seconds.  How is acceleration without motion possible? What are the differences between combat damage, direct damage, and loss of life? How to determine whether a given Linux is 32 bit or 64 bit? When I type uname -a, it gives the following output.  Linux mars 2.6.9-67.0.15.ELsmp #1 SMP Tue Apr 22 13:50:33 EDT 2008 i686 i686 i386 GNU/Linux   How can I know from this that the given OS is 32 or 64 bit?  This is useful when writing configure scripts, for example: what architecture am I building for? General Relativity Equivalence Is Einsteins Equivalence theorem in General Relativity correct? It seems to me that it neglects the fact that gravitational acceleration depends upon separation distance squared, thus neglecting the effect of tidal forces.   For example, as I sit on earth, I experience the affect of earth's gravity; Although the acceleration on my head is slightly less than the acceleration acting on my feet. If I make the claim that my frame is equivalent to me being in a space ship traveling at g, doesn't that mean my whole body is accelerating at g uniformly? This is contrary to the previous statement though. It is a common assumption (and, as far as historical stock market data goes, also proven) that the stock market is always growing if you enlarge the time window long enough . In other words: The stock market always goes up in the long term. Is, therefore, the conclusion valid that you can totally invest as much as you want at any point in time you want and you can never go wrong, if  You diversify strong enough (invest &quot;in the world&quot;) You do not need to urgently sell your assets at any point in time  If yes, all that strategies that rely also on diversified, long-term investments (Dollar-Cost-Averaging &amp; Rebalancing, .. what others do you know?) are just to optimize the yiels, but you'd make profit even without those strategies. Is that correct? I'd like to output a list of all installed packages into a text file so that I can review it and bulk-install on another system.  How would I do this? I recently installed the apache2 package using the Software Centre, I want to create an alias apacheres which will replace the more cumbersome command /etc/init.d/apache2 restart.  I opened the .bashrc file in my home directory, and it contains the following lines:  # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package.  if [ -f ~/.bash_aliases ]; then     . ~/.bash_aliases fi   So I created a .bash_aliases file in my home directory, and added only this line:  alias apacheres ='/etc/init.d/apache2 restart'  When I started my terminal, I get this error message:  bash: alias: apacheres: not found bash: alias: =/etc/init.d/apache2 restart: not found   The shell has obviously read the file, otherwise it wouldn't know of its existence. I have checked the directory path and I can find the file apache2 there. What do I need to do to make this alias work? 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 a minimum, allows me to understand the above PS1 variable. Can I travel to Paris for a day with a single entry visa for Schengen from Switzerland? I'm trying to install Lubuntu on my laptop (sorta old 2005). [Laptop stats: Intel® Celeron® CPU 410 @ 1.46 GHz 1.47GHz, 448 MB of RAM]  I press Install and this message appears:   This kernel requires an x86-64 CPU, but only detected an i686 CPU.  Unable to boot - please use a kernel appropriate for your CPU.   What can I do to install Lubuntu on my computer? In Star Trek II: The Wrath of Khan (the one from 1982, not the recent remake), Khan yells "This is Ceti Alpha V!" and they're all like this is a big surprise, we didn't know.  If they had previously charted the planet, wouldn't the computer have told them the planets weren't quite where they should be based on earlier visits? I mean, we can predict the next hundred transits of Venus, shouldn't 23rd century explorers be able to predict where the Ceti planets are less than twenty years after their first visit? Let $R$ be a commutative ring with $1$. Suppose that all ideals $I \neq R$ are prime. Prove that $R$ is a field.   Help me some hints.  Thanks a lot. Can you choose which version of a game to play on Steam? I want to play a game in an older update, but can't see a way to choose a specific version. Is this possible? Converting a short cage rear derailleur to a long cage derailleur Is it possible to convert a short cage rear derailleur (for example the Huret Svelto) to a long cage derailleur by just taking the lower cage and replacing it by a longer one? I am a bit lost how one has deduced the formula for electric field with electric dipole because of some inconsistency between different sources. The  contains a delta function in the formula, but  gives only the formula without the delta function,  $$\bar{E} = -\nabla \phi = \frac{-p}{4\pi \epsilon_{0} r^{3}} ( \hat{e}_{z}-3\hat{u}_{r}(\hat{u}_{r} \cdot \hat{u}_{z}) ) $$  Is it intentionally left out?  My notes mention that the dipole is with a circular thing $P=Q d$ where $d$ is distance and $Q$ is charge. What is the meaning of the term "linear"