Command & Conquer

March 3rd, 2011
by Chris

Terminal Commands

Moving around a server via the command line has a certain alure to it. But with so many commands, it's easy to get them confused or forget some of the flags and switches, or patterns for all of them. Especially if you're not doing IT stuff every day! The following are just some general tips/tricks/commands that help make life a little easier at the Linux command line.

There are many, many, many more commands than the ones listed below, but these are commonly used, or help immensely when they are needed (even if not used daily).

Partial disclosure: this post may very well exist so I don't have to keep Googling the commands or looking up their command help dialogs when I forget what's what.

What version is this?

Often times in this business you will be handed a server that is already setup, or running some software. It can be useful to know what version of Linux is installed and running.

Two methods of doing so would be:

cat /etc/*release

cat /proc/version

Additionally, you can get just the kernel information via the following:

uname -a

Sweet colored console Batman!

You can modify the look of your command prompt. For the commonly used bash command prompt you would look in your user directory for a file called .bashrc.

In this file you would add something like:

PS1="\h:\W > "

This would update your command prompt from whatever it's defaulting to, to be the servers host name colon current working directory space angle bracket, e.g. "server-name: public_html >". You can also get fancy and add some colors to this. A color is specified as:

\[\033[0;31m\] (or Red)

Placing this anywhere in the string above would make all resulting text after it was entered appear red. To put the color back to default, you would enter:

\[\033[0m\] (reset the color)

For a list of variables that you can use, or color codes, you can look on this site,


An invaluable tool to compress a bunch of files, and move them around in a much more efficient manner.

tar -cvzf yourfilename.tar.gz /path/to/file/or/dir [/more/files/if/needed]

Copying files between servers

Now that you've got your files all packaged up, do you really want to download them from one server, just so you can upload them to another server? I didn't think so, enter SCP. This command will allow you to move your file from one server directly to another.

scp /local/file for more examples.

Posted in console, customizing, general development, linux, modification, release, version