Archive for the 'General' Category

How Many Partitions in general for RHEL?

While preparing to install Red Hat Enterprise Linux, you must give some consideration to the number and size of the partitions to be used by your new operating system.

You should at least create the following partitions: swap, /boot/ (or a /boot/efi/ partition for Itanium systems), a /var/ partition for Itanium systems, and / (root).

Dedicated partitions needed:

For x86 and AMD64 systems, at least two partitions ( / and swap ) must be dedicated to Red Hat Enterprise Linux.

For Itanium systems, at least three partitions ( / , /boot/efi/ , and swap ) must be dedicated to Red Hat Enterprise Linux.

If your partitioning scheme requires a swap partition that is larger than 2 GB, you should create an additional swap partition. For example, if you need 4 GB of swap, you should create two 2 GB swap partitions. If you have 4 GB of RAM, you should create three 2 GB swap partitions. Red Hat Enterprise Linux supports up to 32 swap files.

SBDavid

Use of file descriptors

Use of file descriptors

There are three types of I/O, which each have their own identifier, called a file descriptor:

standard input: 0

standard output: 1

standard error: 2

In the following descriptions, if the file descriptor number is omitted, and the first character of the redirection operator is , the redirection refers to the standard output (file descriptor 1).

Some practical examples will make this more clear:

ls > dirlist 2>&1

Will direct both standard output and standard error to the file dirlist, while the command

ls 2>&1 > dirlist

Will only direct standard output to dirlist. This can be a useful option for programmers.

ampersand is used to run a process in the background. Here, it merely serves as an indication that the number that follows is not a file name, but rather a location that the data stream is pointed to.

SBDavid

input and output redirection

input and output redirection

The following example combines input and output redirection. The file text.txt is first checked for spelling mistakes, and the output is redirected to an error log file:

#spell error.log

Output of one command can be piped into another command virtually as many times as you want, just as long as these commands would normally read input from standard input and write output to the standard output. Sometimes they don’t, but then there may be special options that instruct these commands to behave according to the standard definition.

$ less –help | grep -i examine > examine-files-in-less

:$ cat examine-files-in-less
:e [file] Examine a new file.
:n * Examine the (N-th) next file from the command line.
:p * Examine the (N-th) previous file from the command line.
:x * Examine the first (or N-th) file from the command line.
+cmd Execute the less cmd each time a new file is examined.

Make sure you don’t use names of existing files that you still need. Redirecting output to existing files will replace the content of those files.

SBDavid

Input redirection

Input redirection

You may want a file to be the input for a command that normally wouldn’t accept a file as an option. This redirecting of input is done using the “<” (less-than symbol) operator.

Below is an example of sending a file to somebody, using input redirection.

#mail buddies@serverbuddies.com < /tmp/mail.txt

If the user buddies exists on the system, you don’t need to type the full address. If you want to reach somebody on the Internet, enter the fully qualified address as an argument to mail.

This reads a bit more difficult than the beginner’s cat file | mail someone, but it is of course a much more elegant way of using the available tools.

SBDavid

File protection with chmod

File protection with chmod

chmod 400
file To protect a file against accidental overwriting.
chmod 500 directory To protect yourself from accidentally removing, renaming or moving files from this directory.
chmod 600 file A private file only changeable by the user who entered this command.
chmod 644 file A publicly readable file that can only be changed by the issuing user.
chmod 660 file Users belonging to your group can change this file, others don’t have any access to it at all.
chmod 700 file Protects a file against any access from other users, while the issuing user still has full access.
chmod 755 directory For files that should be readable and executable by others, but only changeable by the issuing user.
chmod 775 file Standard file sharing mode for a group.
chmod 777 file Everybody can do everything to this file.

« Prev - Next »