2010-12-21

LINUX INFO

Table of Contents

1 Commands

nnext the same level
pprevious
]next deeper
[previous
ttop
ddirectory
llast
rother way of last
Lhistory
mmenu
tabpositions in menu
freference
ssearch
iindex
ggo to node
nmove to the "next" node of this node
pmove to the "previous" node of this node
mpick menu item specified by name (or abbreviation), picking a menu item causes another node to be selected
dgo to the Info directory mode
<go to the top node of this file
>go to the final node in this file
[go backward one node, considering all nodes as forming one sequence
]go forward one node, considering all nodes as forming one sequence
tabmove cursor to next cross-reference or menu item
M-TABmove cursor to previous cross-reference or menu item
ffollow a cross reference. Reads name of reference
lmove back in history to the last node you were at/td>
rmove forward in history to the node you returned from after using l
Lgo to menu of visited nodes
Tgo to table of contents of the current Info file

2010-11-29

EMACS PYTHON MODE

C-c >indent right
C-c <indent left
M-/dynamic completion
C-M-icompletion
C-M-hmark class or function
C-c C-zpython interpreter
C-jgo to next indent line
C-c C-crun buffer
C-c C-rrun selected code
C-M-xrun current functionsy

2010-11-13

EMACS ORG MODE

MANIPULATION
[tab]expand
[Shift]-[tab]colapse
M-[left]/[right]nesting level
M-[up]/[down]change place on the same level
[Shift]-[left]/[right]task status | list type
[Shift]-[down]task priority
EDIT
C-c C-qadd/change tag
C-c C-x padd property
C-c C-x ddelete property
C-c C-eexport to another format
C-c C-cedit checkbox
C-c C-e tinstert default template
-----horizontal line
\\end of line (during export to html)
LINKS
C-c C-ledit link
C-c C-ofollow the link
[[link][description]]link
<<link>>target
[[target]]link to target
[[header]]link to header
DATE and TIME
C-c .add timestamp
[Shift]-[right]change timestamp
C-c C-dadd deadline time
C-c C-sadd schedule time
AGENDA
C-c aopen agenda
fforward week
bbackward week
.present day
C-c [add file to agenda
C-c ]remove from agenda
org-agenda-file variable
[space]press space in agenda window to go to event
ELEMENTS
[% | /]lists status
[ ]checkbox
[fn:1]footnote
TABLES
C-^sort table
| col1 | col2 | [tab]add table row
|-add horizontal line
M-[left] | [right] | [up] | [down] move column | row
[Shift]-M-[down]insert row above
[Shift]-M-[up]delete current row
[Shift]-M-[right]insert column
[Shift]-M-[left]delete column
insert vertical line at first row if want export to html
#+ATTR_HTML: border="1" rules="all" frame="all"border between cells during export to html
<nr>put in empty cell to set column width, you can set #+STARTUP: align parameter
calc
:=add forumla to the current field
:=vmean(@II..@III)vertical arythmetic mean from II to III horizontal line
:=vsum(@II..@III)vertical sum from II to III horizontal line
=add forumla to the whole column, if the field contains only ‘=’, the previously stored formula for this column is used
C-c ?find table current field coordinates
C-c }grid coordinates on/off
$1first column
@1first row
$-2third column from right to left
$+2third column from left to right
@Ifirst hline
@I..@IIrange from first hline to second hline
@1$21nd row, 2rd column
@-1$-3the field one row up, three columns to the left
@-I$2field just under hline above current row, column 2
@2$1..@4$36 fields between these two fields
@-1$-2..@-13 numbers from the column to the left, 2 up to current row
C-u C-c =install a new formula for the current field
C-c =edit the formula for the current field
C-c C-crecompute formula
C-u C-c *recompute all table
C-u C-c *recompute all table
#+TBLFM: @10$2=vsum(@II..@III)::@11$2=@2$2+@3$2compute multi formulas
#+TBLFM: $3=@-1+1::@2$3=1ordered nubmer list at 3rd col
EXPORT OPTION
     #+TITLE:       the title to be shown (default is the buffer name)
     #+AUTHOR:      the author (default taken from user-full-name)
     #+DATE:        a date, fixed, of a format string for format-time-string
     #+EMAIL:       his/her email address (default from user-mail-address)
     #+DESCRIPTION: the page description, e.g. for the XHTML meta tag
     #+KEYWORDS:    the page keywords, e.g. for the XHTML meta tag
     #+LANGUAGE:    language for HTML, e.g. ‘en’ (org-export-default-language)
     #+TEXT:        Some descriptive text to be inserted at the beginning.
     #+TEXT:        Several lines may be given.
     #+OPTIONS:     H:2 num:t toc:t \n:nil @:t ::t |:t ^:t f:t TeX:t ...
     #+LINK_UP:     the ``up'' link of an exported page
     #+LINK_HOME:   the ``home'' link of an exported page
     #+LATEX_HEADER: extra line(s) for the LaTeX header, like \usepackage{xyz}

you can put all above settings to one file and point at by:
#+SETUPFILE: ~/[filepath]
EXPORT TIPS
@<b>bold text@</b>use html tags
#+HTML: Literal HTML code for exportas above
#+BEGIN_HTML
All lines between these markers are exported literally
#+END_HTML
as above
! before export to pdf you must install rubber

EMACS DIRED MODE

M-x direddired mode
oopen file in split window horizontaly
enteropen file | enter dir
Ccopy file
Rrename file
Ddelete file
Zcompress file
Mchmod
Ochown
Gchgrp
mmark
uunmark
Uunmark all
grefresh
Asearch
^parent dir
tnew dir
qclose dir

EMACS

HELP:
C-h mcurent mode info
C-h kkey bind info
C-h asearch function
MAIN:
C-x C-cexit
C-/undo
[space] C-/redo
C-x C-bbuffer list
C-g | Esc Esc Esckeyboard quit
C-x bswitch between buffers
C-x C-wsave buffer as
C-x C-fopen file
C-u [nr] [arg]repeat argument [nr] times, default 4 times
SEARCH:
C-ssearch forward
C-rsearch backward
M-%find and repleace
BUFFERS:
C-x C-ssave all buffers
C-x ssave current buffer
C-x kkill buffer
C-x C-bshow buffer menu
BUFFER MENU:
dkill buffer
ssave buffer
xperform previously requested deletions and saves
uundo save and kill
%read only flag
*modify flag
qquit buffer menu
oopen buffer in another window
WINDOWS:
C-x 2horizontal window
C-x 3vertical window
C-x 0remove current window
C-x 1remove all other windows
C-x ochange window
C-x ^taller window
C-x }wider window
EDIT:
C-[space]select
C-[space] [space]unselect
M-wcopy the previously selected
C-wcut the previously selected
C-ypaste
C-a C-kdelete line
C-kdelete from cursor to the end of line
C-h bhelp key bindings
M-;comment/uncomment
M-g ggo to line
C-x r t [string]insert vertical column
C-x kkill region
Alt ;insert comment
C-x r tinsert character at every match line
C-x r kdelete first rectangle at match line(match upto next line field to delete)
INDENT:
C-u [num | -num] C-x [tab]indent previous selected region [num] of lines, minus means indent left
OTHER MODE:
M-x diredfile manager mode
M-x python-modepython mode

2010-10-22

ORACLE SQLNET

sqlnet.ora
trace_level_server=16 #turn on logging for server (4-USER,10-ADMIN,16-SUPPORT)
trace_level_client=16 #turn on logging for client
trace_directory_server=/tmp/oratrace #logfile dir
trace_directory_client=/tmp/oratrace
trace_file_client=cli #logfile name
trace_file_server=srv
trace_unique_client=true

2010-10-20

KERBEROS

2010-05-10

GIT

git config --list
git config --global user.name "dupa jas"
git config --global user.email fdsf@das.pl
git config --global core.editor vim
git config --global merge.tool diff
git help command
man git-command
git status
git init         #create git structure in .git directory

base commands:

git add . #add all files inside current directory to track git rm file #remove file git mv file1 file2 #move file git commit -a m "comment" #commit all without staged git commit -v #show changes to commit git commit --amend

branching:

git branch -a #list all branches, present with flag * git branch [branch_name] #create new branch git checkout [branch_name] #move to branch git checkout -b [branch_name] #create and move to new branch git checkout -- [file] git branch [branch_name] [hash|tag] #new branch branch_name from hash or tag git branch -d [branch_name] #remove branch git branch --merged git branch --no-merged

logging:

git log git log -1 #show last one commit git log -p -2 #show diff of two last commits git log --pretty=oneline|short|medium|full|fuller|email git log --pretty=format:"%h - %an, %ar : %s" git log --pretty=format:"%h %s" --graph git log --merged #only merged commits

diffs:

git diff #differences between tracking (working directory) and staged files git diff --staged #differences between staged and last commit git diff --cached #as above?

tagging:

git tag #show tags git tag -a v1 -m 'comment' #add new tag git show v1 git tag -a v1.1 hash #tag old commits

other:

git merge [branch_name] #ex inside master branch merging changes from branch branch_name git ls-files --stage #show files with hash in stage git hash-object [file] #make SHA1 hash for file git mergetool #choose merge tool .gitignore #file with list of ignoring files info/exclude #as above but for whole project

initialize git project on server without working directory:

mkdir project-01.git cd project-01.git git --bare init

initialize git project in local directory:

git init git add . git commit -m "initialize project"

initialize bare git project from current project;

- developer1: git clone --bare [current_project] [bare_project].git git remote add [alias] [path_to_bare_project] git remote set-head [alias] master - developer2: git clone [user]@[developer1_hostname]:[path_to_developer1_bare_project]

send to remote server

git remote add [alias] [user]@[server]:/[path on server to git project dir] #add remote alias git push origin master #push from master branch to origin alias git remote -v #check remote server git remote add [alias] user@server:path/project.git #add remote repo git remote show origin git remote rename file1 file2 git remote rm file git clone [url] #clonning repo, not checkout, with all history files etc. git clone git://url dir_name #clone with make local directory dir_name,track master on remote git clone http(s):// git clone user@server:/path #ssh clone with default alias origin creation etc. git clone --bare [project_path] [bare_project_path].git #create bare (without working dir) project from project with working dir git fetch [alias] #fetch data from remote server with alias to local branch (create pointer only), till last fetch or clone, git diff [alias] #compare differences git merge [alias] #merge differences git pull [alias] [local_branch] #as above 3 steps in 1 git remote -v #get remote alias git push [remote_alias] [branch_name] #send branch branch_name to remote repo git push [remote_alias] [branch_name]:[remote_branch_name] #as above with name change git push [remote_alias] :[branchname] #remove remote branch 

working dir-------staging area--------git dir

.git/objects #all content .git/refs #branches .git/HEAD #currently checked out .git/index #staging area (index)

2010-04-16

LINUX PASSWORD POLICY

1 Password strength:

  1. check pam module pam_cracklib.so in /lib/security
  2. edit /etc/pam.d/system-auth
    • password requisite pam_cracklib.so try_first_pass retry=3 minlen=8 dcredit=-1 ucredit=-1 lcredit=-1 ocredit=-1
      retryattempts to pick new password
      minlenmin password length
      ucreditupper case -1 means at least 1
      lcreditlower case
      ocreditspecial character
      dcreditdigit


2 Password duration:

  • For new accounts default settings are in /etc/login.defs
  • Settings for current accounts are in /etc/shadow but we edit by command chage

2.1 chage

chage -l [user]check settings for user
chage -E "YYYY-MM-DD" [user]set date when account expire, -1 means never
chage -M [nr] [user]set maximum number of days between password change from last password change, -1 means never expire
chage -d "YYYY-MM-DD" [user]set last password change
chage -W [nr] [user]number of days of warning before password expires
chage -i [nr] [user]set password inactive, when account is blocked after password expire

3 Password repeat history:

  • edit /etc/pam.d/system-auth
    • password sufficient pam_unix.so sha512 shadow nullok try_first_pass use_authtok remember=2
      remembernumber of password in history file /etc/security/opasswd


4 Login attempts:

  • check pam module pam_tally2.so in /lib/security
  • edit /etc/pam.d/system-auth
    • auth required pam_tally2.so deny=3 unlock_time=60 lock_time=5
      denynumber of attempts to log without deny
      unlock_timetime in sec when next login attempt perform
      lock_timetime in sec when delay every failed login attempt
    • all logs about login attempts are in /var/log/tallylog but we edit by command pam_tally2

4.1 pam_tally2

pam_tally2 -u [user]check failed login attempts
pam_tally2 -r -u [user]reset failed login attempts

2010-03-05

ORACLE AS

OPMNCTL (Oracle Process Management and Notification Server)
$ORACLE_AS_HOME/opmn/bin/opmnctl help
$ORACLE_AS_HOME/opmn/bin/opmnctl status help
$ORACLE_AS_HOME/opmn/bin/opmnctl status -l
$ORACLE_AS_HOME/opmn/bin/opmnctl stopall
$ORACLE_AS_HOME/opmn/bin/opmnctl startall

check AS version:
cat $ORACLE_AS_HOME/config/ias.properties | grep Version
$ORACLE_AS_HOME/OPatch/opatch lsinventory -detail

2010-02-12

ORACLE AWR

1 EM

  • Oracle Enterprise Manager => Advisor Central

2 DescAWR (Automatic Workload Repository)

  • Stats which are stored in tables WRH$ in SYSAUX tablespace

3 Prerequisities

  • STATISTICS_LEVEL = TYPICAL | ALL

4 Views

4.1 Memory:

  • DBA_HIST_SGA
  • DBA_HIST_PGASTAT
  • DBA_HIST_PGA_TARGET_DEVICE
  • DBA_HIST_SGASTAT
  • DBA_HIST_BUFFER_POOL_STAT
  • DBA_HIST_DB_CACHE_ADVICE
  • DBA_HIST_SHARED_POOL_ADVICE

4.2 Sql:

  • DBA_HIST_SQL_SUMMARY
  • DBA_HIST_SQLSTAT
  • DBA_HIST_SQL_PLAN

4.3 Other:

  • DBA_HIST_SYSSTAT
  • DBA_HIST_FILESTATXS
  • DBA_HIST_WR_CONTROL
  • DBA_HIST_SNAPSHOT
  • DBA_HIST_DATABASE_INSTANCE
  • DBA_HIST_ACTIVE_SESS_HISTORY

5 Snapshots

5.1 Check snapshots time collection

  • SELECT * FROM DBA_HIST_WR_CONTROL

5.2 Set snapshot retention

  • DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS ([retention - min],[interwal - min])

5.3 Run manual snapshot:

  • DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT();

5.4 Drop snapshot:

  • DBMS_WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE([low_id],[end_id]);

6 Reports

6.1 Generate AWR report:

  • $oracle_home/rdbms/admin/awrrpt.sql
  • $oracle_home/rdbms/admin/awrrpti.sql # with instance
  • ADDM reports (Automatic Database Diagnostic Monitor:
  • $oracle_home/rdbms/admin/addmrpt.sql