Jump to Navigation


288 - How to break a file system

When you are testing on the recovery and so on, sometimes you may want to break a file system on purpose.

dd if=/dev/zero of=/dev/your_partition bs=512 count=512

Before the above command, make sure whether you can or not.


280 - CUPS Cancel Print Jobs

If you are using CUPS, sometimes you want to cancel some print queues. So "lprm" is a useful command for that.

lprm will remove a job, or jobs, from a printer’s spool queue. Since the spooling directory is protected from users, using lprm is normally the only method by
which a user may remove a job. The owner of a job is determined by the user’s login name and host name on the machine where the lpr(1) command was invoked.

 lprm [-Pprinter] [-] [job # ...] [user ...]

Options and arguments :

Shell Script:

279 - Monitor Open File

It is easy to remember lsof command if you think of it as “ls + of”, where ls stands for list, and of stands for open files.
It is a command line utility which is used to list the information about the files that are opened by various processes. In unix, everything is a file,
( pipes, sockets, directories, devices, etc.). So by using lsof, you can get the information about any opened files.

Simply typing lsof will provide a list of all open files belonging to all active processes.


273 - Monitor processes in Linux Server

1. Monitor CPU, Memory per a specific process

# watch -n 3 "ps auxw | grep -v root | grep ora_p0"

* watch - Run the script comnand repeatedly (by default, every two seconds) and display the output so you can watch it change over time.
                The command and any options are passed to sh -c, so you may need to use quotes to get correct results.

2. Monitor I/O per process


264 - Basic LVM commands

1. Initializing disks or disk partitions

To use LVM, partitions and whole disks must first be converted into physical volumes (PVs) using the pvcreate command.
For example, to convert /dev/hda and /dev/hdb into PVs use the following commands :

# pvcreate /dev/hda

# pvcreate /dev/hdb

If a Linux partition is to be converted make sure that it is given partition type 0x8E using fdisk, then use pvcreate :


261 - yum whatprovides

To searching for package names, yum's "whatprovides" option can be used
to locate the package that contains a specific executable:

If you need the package libXp.so.6, You can search for the package by adding
'*/ before the package name and closing it by '

# yum whatprovides '*/libXp.so.6'


*** You can install it as the following

# yum install libXp.so.6



259 - Connect IMAP server with no SSL(143)

If you want to connect IMAP with telnet & command line, you should do the following steps.

The "tag1" etc at the begining of each command is just a tag you make up.
Supposedly it should be unique for each line; I've found you can actually use the same tag over and over again.

# telnet imap.myserver.com 143


255 - dd command for backup

The ' dd ' command is one of the original Unix utilities and should be in everyone's tool box.
It can strip headers, extract parts of binary files and write into the middle of floppy disks;
it is used by the Linux kernel Makefiles to make boot images. It can be used to copy and convert magnetic tape formats,
convert between ASCII and EBCDIC, swap bytes, and force to upper and lowercase.


250 - Change the default kernel that boots from GRUB

If you selected GRUB as your boot loader, you need to modify the file /boot/grub/grub.conf.

* default 0

The first menu entry title linux is the one to boot by default. grub.conf "default=x" getting updated upon yum update

To get changed it to "default=1".

Rebooting the machine boots to an old version of the kernel, rather than the new version which had been correctly loaded
as the 0th stanza in grub.conf.  Installing a new kernel RPM will insert a stanza into grub.conf for the new kernel version.



248 - Use SNMP, snmpwalk

SNMP is a unified protocol of network monitoring and network device management. All active network devices support SNMP.
Besides that, SNMP is supported by major operational systems and a large number of network applications.

To install snmpwalk or snmpget on Redhat use the command yum install net-snmp-utils.



Subscribe to RSS - command

Main menu 2