• Increase font size
  • Default font size
  • Decrease font size
linux

   Edit file /etc/sysconfig/network using your favourite editor.

 

 NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME="www.pcdog.com"

GATEWAY=192.168.0.1

 

 

To format the partition with ext3:

Code:
# mke2fs -j /dev/hdb1

ext2:
 

Code:
# mke2fs /dev/hdb1

reiser:
 

Code:
# mkreiserfs /dev/hdb1

EDIT: It can also be useful to look what the output is of:
 

Code:
# mount -v -o rw /dev/hdb1 /mnt/hdb1
 

 

 [root@localhost init.d]# usermod --help
usage: usermod  [-u uid [-o]] [-g group] [[-a] -G group,...]
                [-d home [-m]] [-s shell] [-c comment] [-l new_name]
                [-f inactive] [-e expire ] [-p passwd] [-L|-U] name

If you feel that your user name is not attractive enough, or boring or your taste and experience has changed since the user name was first created, use the following command to change the user name in Linux.

usermod -l new login name old login name

Replace new login name with the new user name you want to use in future, andold login name with the existing username to change.

For NIS accounts, additional commands is required to maintain a proper copy of user account across computer network. Run the following commands:

cd /var/yp
make

 

you need to edit this file:

etc/resolv.conf

#vi /etc/resolv.conf

 

search local
nameserver 202.103.225.68
 

 

 

 

An ISO image is an archive file (disk image) of an optical disc using a conventional ISO (International Organization for Standardization) format. ISO image files typically have a file extension of .ISO. The name "ISO" is taken from the ISO 9660 file system used with CD-ROM media, but an ISO image can also contain UDF file system because UDF is backward-compatible to ISO 9660.

You can mount an ISO images via the loop device under Linux. It is possible to specify transfer functions (for encryption/decryption or other purposes) using loop device.

 

 just mount your CD or iso image to some directory by commands:

sudo mkdir /mnt/image

sudo mount /dev/cdrom /mnt/image

or

sudo mount /path/to/your.iso /mnt/image -o loop

then copy it’s contents to some directory:

mkdir /tmp/newiso

cp -r /mnt/image /tmp/newiso

 

After this you can modify any files in /tmp/newiso, add files, delete them. After modifications are done, create new ISO image to be burned onto CD (or kept somewhere for a rainy day):

cd /tmp/newiso

and

sudo mkisofs -o /tmp/new.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V “new iso name” .

After mkisofs is finished new ISO file will be created at /tmp directory.

It works in any Linux distributions like Ubuntu, Debian or Fedora.

 

 

 Usage: grep [OPTION]... PATTERN [FILE] ...

Search for PATTERN in each FILE or standard input.
Example: grep -i 'hello world' menu.h main.c
 
Regexp selection and interpretation:
  -E, --extended-regexp     PATTERN is an extended regular expression
  -F, --fixed-strings       PATTERN is a set of newline-separated strings
  -G, --basic-regexp        PATTERN is a basic regular expression
  -P, --perl-regexp         PATTERN is a Perl regular expression
  -e, --regexp=PATTERN      use PATTERN as a regular expression
  -f, --file=FILE           obtain PATTERN from FILE
  -i, --ignore-case         ignore case distinctions
  -w, --word-regexp         force PATTERN to match only whole words
  -x, --line-regexp         force PATTERN to match only whole lines
  -z, --null-data           a data line ends in 0 byte, not newline
 
Miscellaneous:
  -s, --no-messages         suppress error messages
  -v, --invert-match        select non-matching lines
  -V, --version             print version information and exit
      --help                display this help and exit
      --mmap                use memory-mapped input if possible
 
Output control:
  -m, --max-count=NUM       stop after NUM matches
  -b, --byte-offset         print the byte offset with output lines
  -n, --line-number         print line number with output lines
      --line-buffered       flush output on every line
  -H, --with-filename       print the filename for each match
  -h, --no-filename         suppress the prefixing filename on output
      --label=LABEL         print LABEL as filename for standard input
  -o, --only-matching       show only the part of a line matching PATTERN
  -q, --quiet, --silent     suppress all normal output
      --binary-files=TYPE   assume that binary files are TYPE
                            TYPE is 'binary', 'text', or 'without-match'
  -a, --text                equivalent to --binary-files=text
  -I                        equivalent to --binary-files=without-match
  -d, --directories=ACTION  how to handle directories
                            ACTION is 'read', 'recurse', or 'skip'
  -D, --devices=ACTION      how to handle devices, FIFOs and sockets
                            ACTION is 'read' or 'skip'
  -R, -r, --recursive       equivalent to --directories=recurse
      --include=PATTERN     files that match PATTERN will be examined
      --exclude=PATTERN     files that match PATTERN will be skipped.
      --exclude-from=FILE   files that match PATTERN in FILE will be skipped.
  -L, --files-without-match only print FILE names containing no match
  -l, --files-with-matches  only print FILE names containing matches
  -c, --count               only print a count of matching lines per FILE
  -Z, --null                print 0 byte after FILE name
 
Context control:
  -B, --before-context=NUM  print NUM lines of leading context
  -A, --after-context=NUM   print NUM lines of trailing context
  -C, --context=NUM         print NUM lines of output context
  -NUM                      same as --context=NUM
      --color[=WHEN],
      --colour[=WHEN]       use markers to distinguish the matching string
                            WHEN may be `always', `never' or `auto'.
  -U, --binary              do not strip CR characters at EOL (MSDOS)
  -u, --unix-byte-offsets   report offsets as if CRs were not there (MSDOS)
 
`egrep' means `grep -E'.  `fgrep' means `grep -F'.
With no FILE, or when FILE is -, read standard input.  If less than
two FILEs given, assume -h.  Exit status is 0 if match, 1 if no match,
and 2 if trouble.

Examples

grep "unix" *.htm

search all .htm files in the current directory for any reference of  unix and give results similar to the below example text.

asoftwar.htm: href="/win95.htm">Windows 95, Unix, MS-DOS,
asoftwar.htm:

Unix
learnhtm.htm: Unix help

os.htm: Unix

 

 

Name

route - show / manipulate the IP routing table
Synopsis


 route [-CFvnee]
route
[-v] [-A family] add [-net|-host] target [netmask Nm] [gw Gw] [metric N] [mss M] [window W] [irtt I] [reject] [mod] [dyn] [reinstate] [[dev] If]
route
[-v] [-A family] del [-net|-host] target [gw Gw] [netmask Nm] [metric N] [[dev] If]
route
[-V] [--version] [-h] [--help]
Description

Route manipulates the kernel's IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig program.

[root@localhost ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.0.0      *               255.255.255.0   U     0      0        0 eth0
169.254.0.0     *               255.255.0.0     U     0      0        0 eth0
default         172.16.0.254    0.0.0.0         UG    0      0        0 eth0

 

 

[root@]# ps aux | less
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0   2064   620 ?        Ss   Oct18   0:04 init [3]                 
root         2  0.0  0.0      0     0 ?        S<   Oct18   0:00 [migration/0]
root         3  0.0  0.0      0     0 ?        SN   Oct18   0:00 [ksoftirqd/0]
root         4  0.0  0.0      0     0 ?        S<   Oct18   0:00 [watchdog/0]
root         5  0.0  0.0      0     0 ?        S<   Oct18   0:00 [migration/1]
root         6  0.0  0.0      0     0 ?        SN   Oct18   0:00 [ksoftirqd/1]
root         7  0.0  0.0      0     0 ?        S<   Oct18   0:00 [watchdog/1]
root         8  0.0  0.0      0     0 ?        S<   Oct18   0:00 [migration/2]
root         9  0.0  0.0      0     0 ?        SN   Oct18   0:00 [ksoftirqd/2]
root        10  0.0  0.0      0     0 ?        S<   Oct18   0:00 [watchdog/2]
root        11  0.0  0.0      0     0 ?        S<   Oct18   0:00 [migration/3]
root        12  0.0  0.0      0     0 ?        SN   Oct18   0:00 [ksoftirqd/3]
root        13  0.0  0.0      0     0 ?        S<   Oct18   0:00 [watchdog/3]

how to view processes in linux********* simple selection *********  ********* selection by list *********
-A all processes                      -C by command name
-N negate selection                   -G by real group ID (supports names)
-a all w/ tty except session leaders  -U by real user ID (supports names)
-d all except session leaders         -g by session OR by effective group name
-e all processes                      -p by process ID
T  all processes on this terminal     -s processes in the sessions given
a  all w/ tty, including other users  -t by tty
g  OBSOLETE -- DO NOT USE             -u by effective user ID (supports names)
r  only running processes             U  processes for specified users
x  processes w/o controlling ttys     t  by tty
*********** output format **********  *********** long options ***********
-o,o user-defined  -f full            --Group --User --pid --cols --ppid
-j,j job control   s  signal          --group --user --sid --rows --info
-O,O preloaded -o  v  virtual memory  --cumulative --format --deselect
-l,l long          u  user-oriented   --sort --tty --forest --version
-F   extra full    X  registers       --heading --no-heading --context
                    ********* misc options *********
-V,V  show version      L  list format codes  f  ASCII art forest
-m,m,-L,-T,H  threads   S  children in sum    -y change -l format
-M,Z  security data     c  true command name  -c scheduling class
-w,w  wide output       n  numeric WCHAN,UID  -H process hierarchy

#ps -ef

Task: Use ps command

Type the following ps command to display all running process
# ps aux | less

Where,

  • -A: select all processes
  • a: select all processes on a terminal, including those of other users
  • x: select processes without controlling ttys

Task: see every process on the system

# ps -A
# ps -e

Task: See every process except those running as root

# ps -U root -u root -N

Task: See process run by user vivek

# ps -u vivek

 

 

If you configured the Apache HTTP Server with the HTTP Configuration Tool in previous versions of Red Hat Linux and then performed an upgrade, you can use the application to migrate the configuration file to the new format for version 2.0. Start the HTTP Configuration Tool, make any changes to the configuration, and save it. The configuration file saved will be compatible with version 2.0.

 

The HTTP Configuration Tool allows you to configure the /etc/httpd/conf/httpd.conf configuration file for the Apache HTTP Server. It does not use the oldsrm.conf or access.conf configuration files; leave them empty. Through the graphical interface, you can configure directives such as virtual hosts, logging attributes, and maximum number of connections.

Only modules that are shipped with Red Hat Linux can be configured with HTTP Configuration Tool. If additional modules are installed, they can not be configured using this tool.

The httpd and redhat-config-httpd RPM packages need to be installed to use the HTTP Configuration Tool. It also requires the X Window System and root access. To start the application, go to the Main Menu Button => System Settings => Server Settings => HTTP Server or type the command redhat-config-httpd at a shell prompt (for example, in an XTerm or GNOME Terminal).

The general steps for configuring the Apache HTTP Server using the HTTP Configuration Tool are as following:

 

  1. Configure the basic settings under the Main tab.

  2. Click on the Virtual Hosts tab and configure the default settings.

  3. Under the Virtual Hosts tab, configure the Default Virtual Host.

  4. If you want to serve more than one URL or virtual host, add the additional virtual hosts.

  5. Configure the server settings under the Server tab.

  6. Configure the connections settings under the Performance Tuning tab.

  7. Copy all necessary files to the DocumentRoot and cgi-bin directories.

  8. Exit the application and select to save your settings.

  9. More read...http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/custom-guide/ch-httpdconfig.html

 

 

  • Step 1:
    Look in your directory under "/user/share/zoneinfo" and choose an available time zone. An example is "America/Los_Angeles."
  • Step 2:
    Browse to your directory "/usr/share/zoneinfo/your/zone," where "your" is the country and "zone" is the city that is most appropriate for your time zone.
  • Step 3:
    Replace "your/zone" with the time zone you chose in Step 1. An example is "/usr/share/zoneinfo/America/Los_Angeles."
  • Step 4:
    Enter the symbolic link "/etc/localtime" after the link in Step 2. An example is "/usr/share/zoneinfo/America/Los_Angeles/etc/localtime." This links your local time to your specified time zone