Search posterous

Search all posts and users. Type a name, type a favorite song title, whatever! See what comes up.
  

More posterous blogs











More recommended blogs »

Here are posterous posts filed under odoc...

bharathi says...

sysctl -- Configure kernel parameters at run-time

Summary:
Linux Kernel has number of parameters, which can be modified to get best performance out of the system. sysctl can be used to view and modify thous kernel parameters value from the command prompt. All the kernel parameters are mapped in the /proc/sys/ folder.

Examples:

 
$ sysctl -a -- List all currently available parameters.
 
$ sysctl vm.swappiness -- Show the name and value of a parameter.
 
$ sysctl -n vm.swappiness -- Show only the value. 
 
$ sysctl -N vm.swappiness -- Show only the name. 
 
$ sysctl -e vm.unknown -- Do not show the error message. 
 
# sysctl -p mysysctl.txt -- Load new setting values from a file. 
 
# sysctl -w vm.swappiness=25 -- Modify the parameter value.

Alternate way to view and modify the kernel parameters:

 
$ cat /proc/sys/vm/swappiness -- Show the value of this parameter. 
 
# echo 25 > /proc/sys/vm/swappiness -- Modify the parameter value. 

Read: man sysctl

Filed under: odoc

bharathi says...

dmidecode -- DMI Table Decoder

Summary:
dmidecode is a tool for dumping a computer’s DMI or SMBIOS table contents in a human-readable format. This table contains a detailed description of the system’s hardware components. It is very helpful to retrieve the device information without probing the actual hardware. SMBIOS stands for System Management BIOS, while DMI stands for Desktop Management Interface. Both standards are tightly related and developed by the DMTF (Desktop Management Task Force). The records in DMI table will have the following fields: Handle, Type, Size, Value.

Examples:

 
$ dmidecode -- Error. Need super user permission. 
 
# dmidecode -- Dump the whole table on the screen. 
 
# dmidecode -q -- Show Active and standard values only. 
 
# dmidecode -s bios-vendor -- Show the value for the KEYWORD. 
 
# dmidecode -t bios -- Show entries belong to this TYPE. 
 
# dmidecode -u -- Dump the table in hex format. 

Read: man dmidecode

Filed under: odoc

bharathi says...

lshal -- List HAL devices

Summary:

lshal is a utility for displaying devices in the Hardware Abstraction Layer(HAL) device database. This DB maintains the list of devices, that are connected to the system in real-time.

Examples:

 
$ lshal -- List all HAL devices info in long and detailed format. 
 
$ lshal -l -- Same as above. 
 
$ lshal -s -- List all HAL devices info in short format (Only the 
Unique Device Identifier - UDI). 
 
$ lshal -st -- List the devices info in short and tree format.
 
$ lshal -m -- Monitor the HAL devices and show the state changes.
 
$ lshal -u computer -- Show the info of a specific device or UDI. 

Read: man lshal

Filed under: odoc

bharathi says...

apt-get -- Debian Package handling tool

Summary:

apt-get is a powerful package handling tool used in the Debian Distribution. It has in-build capability to resolve the conflicts and dependencies.

Examples:

 
# apt-get update -- Update the Pkg lists from the repositories. 
 
# apt-get install pkgName -- Install the new package from the 
repositories with all dependencies. 
 
# apt-get upgrade -- Install newest version of the all packages,
which are currently installed in the system. 
 
# apt-get dist-upgrade -- Same as above. But with advanced conflict
resolution capability. 
 
# apt-get remove pkgName -- Remove the package. But won't remove
the config files. 
 
# apt-get --purge remove pkgName -- Remove the packet and it's
config files. 

Read: man apt-get

Debian Mirrors in India: http://ftp.iitm.ac.in/linux/ AND
http://mirror.cse.iitk.ac.in/

Filed under: odoc

bharathi says...

grep -- (Global Regular Expression Print) Print lines matching a pattern

Summary:
`grep' searches the input files for lines containing a match to a given pattern list. Grep has a no .of useful options, character classes and support regular expressions.

Examples:

 
$ grep -i bharathi Midas.txt -- Print the lines which contains the 
string "bharathi" in the Midas.txt file.
 
$ grep -v bharathi ILUGC.txt -- Print the line which is not the
string "bharathi".
 
$ grep -A 2 "ram" file -- Along with matching line, prints the next
2 lines. 
 
$ grep -B 2 "siva" file -- Along with matching line, prints the
previous 2 lines. 
 
$ grep -C 2 "rupa" file -- Along with matching line, prints the 
previous and next 2 lines. 
 
$ grep -n "vijay" file -- Print the matching lines with its
line number. 
 
$ grep -c "Linux" file -- Prints count of match. 
 
$ grep -w "is" file -- Match the whole word only. Match "is",
but not "this". 
 
$ grep "^A" file -- Prints the line starting with A. 
 
$ grep "Z$" file -- Prints the line with ending letter Z. 
 
$ grep '^[012]' file -- Prints the line starting with 0/1/2. 
 
$ grep -E "Linux|Unix" file -- Print the lines containing "Linux"
or "Unix". 

Read : info grep / egrep / fgrep

Filed under: odoc

bharathi says...

ulimit - Control the resources available to processes

Summary :
ulimit, Bash Built-in Command, provides fine control over the amount of resources (Virtual Mem, Max no .of process, Core file size,..) available to any processes started by the shell. Except for -t, which is in seconds, -p, which is in increments of 512 bytes, and -u, which is an unscaled number of processes, all other values are in 1024-byte increments.

For example, if the maximum no. of user process is set to 5, then that user can't run more then 5 process.

Examples :

 
$ ulimit -a -- Show All current limits. 
 
$ ulimit -n -- Show max open files limit. 
 
$ ulimit -t -- Show max CPU time limit. 
 
$ ulimit -c -- Show core file size. 
 
$ ulimit -c 6000 -- Set new core file size. 
 
$ ulimit -u 60 -- Set max no .of processes per user to 60. 
It will protect the system from shell booms. 

Read : info bash

Filed under: odoc

bharathi says...

sort - Sort lines of text files

Summary :
Sort the file contents based on options given to it. By default the output is showed in the display.

Examples :

 
$ sort -- Take the input from stdin, sort and output in stdout. 
 
$ sort myfile -o myoutput -- Sort the myfile content and store
it in "myoutput". 
 
$ sort -b myfile -- Ignore the leading blanks and sort. 
 
$ sort -br myfile -- Same as above but in reverse order. 
 
$ sort -c myfile -- Only Check whether myfile is already sorted 
 
$ sort -f myfile -- Ignore the case and sort (a == A) 
 
$ sort -u myfile -- Sort and output only unique lines 
 
$ sort -n myfile -- Numerically sort the content. 
 
$ sort -g myfile -- Same as above. It understand more complex 
notations like +, -, NaN, infinity, expo. 
 
$ sort -M months -- Month sort (Jan < Feb <..< Dec). 
 
$ sort -t : -k 2,2n -k 5.3,5.4 myfile -- Sort numerically on the 
2nd field and resolve ties by sorting alphabetically on the 3rd
and 4th characters of field 5. Use `:' as the field delimiter. 

Read : man sort

Filed under: odoc

bharathi says...

tail - Output the last part of files.

Summary :
Print the last 10 lines of each FILE to stdout. With more than one FILE, precede each with a header giving the file name.

Examples :

 
$ tail myfile -- Show only the last 10 Lines. 
 
$ tail f1 f2 -- Show the last 10 lines from 2 files with
small header. 
 
$ tail -vn 6 myfile -- Show only last 6 Lines with header. 
 
$ tail -c 24 myfile -- Show only last 24 Bytes. 
 
$ tail -q myfile -- Don't show headers. 
 
$ tail --retry myfile -- Keep retrying to open myfile. 
 
$ tail -f maillog -- Output appended data as the file grows.
Useful to monitor logs. 
 
$ tail -f -s 10 maillog -- Once in every 10s update the output. 
 
$ tail -f --pid=600 myfile -- Terminate tail after the process
with PID 600 dies. 

Read : man tail

Filed under: odoc

bharathi says...

shutdown -- Bring the system down (Need Root privilege)

Summary :

Shutdown brings the system down in a proper and secure way. All logged-in users are notified that the system is going down, and login is blocked. All processes are first notified that the system is going down by the signal SIGTERM. Runlevel 0 is used to halt the system, run level 6 is used to reboot the system.

Examples :

 
# shutdown 12:00 -- Shutdown at 12:00 
 
# shutdown +10 -- Shutdown after 10min 
 
# shutdown now -- Immediate shutdown (now == +0) 
 
# shutdown -t 10 -- Wait 10 Sec after warn the user 
 
# shutdown -k -- Don't really shutdown; only warn 
 
# shutdown -r -t 5 -- Reboot after shutdown 
 
# shutdown -h -t 5 -- Halt after shutdown 
 
# shutdown -f now -- Skip fsck (File System Check) on reboot 
 
# shutdown -F now -- Force fsck on reboot 
 
# shutdown -c -- Cancel the already waiting shutdown process. 

Read : man shutdown

Filed under: odoc

bharathi says...

head - Output the 1st part of files.

Summary :
Print first 10 lines of each FILE to stdout. With more than one FILE, precede each with a header giving the file name. With no FILE, or when FILE is -, read stdin.

Examples :

 
$ head -- Read 10 lines from stdin and dump to stdout 
 
$ head myfile -- Show 1st 10 lines of the file. 
 
$ head f1 f2 -- Show 1st 10 lines of file f1 and f2 with header.
 
$ head -q f1 f2 -- same as above But with-out header. 
 
$ head -n 5 myfile -- Show 1st 5 lines only. 
 
$ head -c 15 myfile -- Show 1st 15Bytes only. 
 
$ head -c 15k myfile -- Show 1st 15KB only. 

Read : man head

Filed under: odoc