Archive for the tag 'command'

How to install Parallels Plesk Panel using command line.

To install Parallels Plesk Panel, issue a command of the following format:

parallels_installer [packages source options] –select-release-id [ID] [components installation options] [other options]

where

Packages source options define the location where the installer should obtain the Panel packages for installation
[packages source options] = –source [URL]

Examples, Linux/Unix

The following command installs Parallels Plesk Panel 10.0 (release ID is PANEL_10_0_0) from the mirror set up on server available via HTTP at host mirror.example.com. Installation files will temporarily be stored at /tmp/panel, and the installation status will be reported to e-mail admin@example.com. The installed components are base Panel packages, PostgreSQL server, and SpamAssassin spam filter.

./parallels_installer –source http://mirror.example.com/ –target /tmp/panel –select-release-id PLESK_10_0_0 –install-component base –install-component postgresql –install-component spamassassin –notify-email admin@example.com

Reference: http://parallels.com/

SBDavid

vzctl command examples

vzctl command examples

Create a Container with ID 444 and IP 10.100.1.2, based on the Debian 5 OS template.

# vzctl create 444 –ostemplate debian-5.0-x86_64

To set the IP address and hostname.

# vzctl set 444 –ipadd 10.100.1.2 –hostname example.com –save

Start the newly created Container:

# vzctl start [CTID]

How to use lsof command to Find Open Files

The lsof utility can help identify which files are being used by any given application, which network ports are open, and much more.

A process would show up in top or ps aux, but the executable may not seem to exist. Using lsof, we could hunt down the scripts or executables used to run the program. If we run just lsof, it will attempt to show all files (which includes network sockets, pipes and special files) that are open.

If we want to see all the open files owned by a process, we can use the -p option (for PID) like so:

lsof -p XXXXX

Just replace XXXXX with the process ID (PID) of the process you want to see. The output will show the command that has the file open, the PID, the user, the file descriptor, type, size of the file and the name of the file.

We can also see what files are open by users. Running lsof -u user will show all open files by processes owned by the user. You can also substitute the user ID (UID) for the username. If you want to eliminate a user from the listing, use ^user instead. The preceding caret will negate the selection, so the user will be ignored.

If we want to see what network sockets are owned by a particular user or process? Try ..

lsof -u user -a -i

That will show only the open TCP and UDP sockets. If we want to see what files are open over the network, use -i. This will show you which files and sockets are open, and their respective protocols, hostnames and so on. We can narrow network parameters down by IP version (-i4 for IPv4, -i6 for IPv6), protocol (UDP or TCP), and even hostname or port.

By default, lsof will look up hostnames, but we can turn this off using the -n option. It will run faster without needing to do name lookups.

lsof 4.81
latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man

Using SED command line to delete line from a file.

d Delete pattern space. Start next cycle.

You can use the following one liner to remove one line (line 3) from a file.

$ sed -i 3d ~/.ssh/known_hosts

This will remove line 3 form the file ~/.ssh/known_hosts

SBDavid

Backup using the dd command

`dd’: Convert and copy a file

`dd’ copies a file (from standard input to standard output, by default)with a changeable I/O block size, while optionally performing conversions on it. Synopses:

dd [OPERAND]…
dd OPTION

The only options are `–help’ and `–version’.

For instance, to make an exact clone of the /boot partition to a backup file, you could use:

# dd if=/dev/sda1 of=/srv/boot-linux.img

We can also use bzip2 to compresses files and then bunzip2 (or bzip2 -d) decompresses all specified files.

To clone one hard disk to another first use fdisk to recreate the appropriately-sized partitions, on the new disk and then use dd to do the actual cloning.

dd –help
Usage: dd [OPERAND]…
or: dd OPTION

Copy a file, converting and formatting according to the operands.

bs=BYTES force ibs=BYTES and obs=BYTES
cbs=BYTES convert BYTES bytes at a time
conv=CONVS convert the file as per the comma separated symbol list
count=BLOCKS copy only BLOCKS input blocks
ibs=BYTES read BYTES bytes at a time
if=FILE read from FILE instead of stdin
iflag=FLAGS read as per the comma separated symbol list
obs=BYTES write BYTES bytes at a time
of=FILE write to FILE instead of stdout
oflag=FLAGS write as per the comma separated symbol list
seek=BLOCKS skip BLOCKS obs-sized blocks at start of output
skip=BLOCKS skip BLOCKS ibs-sized blocks at start of input
status=noxfer suppress transfer statistics

« Prev - Next »