Useful shortcuts for vi editor

Wednesday, 28 January 2015

How to run a command when starts up SUSE linux system?

Please add below row into "/etc/init.d/boot.local" file as root system user.

# su - alper -c "/home/alper/bin/startup.sh"

Monday, 26 January 2015

What is SUID and GUID?

SUID (Set User ID on execution) and GUID (Group User ID on execution) that uses to give execution permission for running as owner of file.

example of activated suid 
passwd command;
ls -l /usr/bin/passwd
-rwsr-xr-x

example of activated guid 
wall command;
ls -l /usr/bin/wall
-r-xr-sr-x

info: "s" means that the file is activated for suid or guid.

to activate suid;
chmod u+s myfile.txt

to deactivate suid;
chmod u-s myfile.txt

to activate guid;
chmod g+s myfile.txt

to deactivate guid;
chmod g-s myfile.txt

You may also want to read this entry; http://ozsoyler.blogspot.com/2014/11/what-is-sticky-bit.html

Wednesday, 21 January 2015

How to list symbolic links in the current directory?

define a link;
ln -s myfolder/myfile.txt myshortcut

to see it in the list;
$ find . -type l -ls

result;
Jan 21 09:03 ./myshortcut-> myfolder/myfile.txt

to see inside of file via shortcut;
$ cat myshortcut
hello

Thursday, 8 January 2015

How to define logic volume for oracle server?

1st step: Define physical volume (pv)
# pvcreate -f /dev/sda4

to check it;

# pvdisplay

2nd step: Define volume group (vg)

# vgcreate -s 16 /dev/my_vg_ora /dev/sda4
s; 
-s 16 (--physicalextentsize; 16 mb physical extent size)

to activate it;

# vgchange -a y /dev/my_vg_ora

to check it;

# vgdisplay

3rd step: Define logic volume (lv)

lvcreate -L 1024 -n example01 /dev/my_vg_ora

to check it;
# lvdisplay

4th step: Assign data file to tablespace

to do this step please refer to this entry

to check it;
# select * from dba_data_files;

Thursday, 1 January 2015

Oracle Highlights

Administrator
Architecture
Database Versions

Monday, 29 December 2014

How to change ssh welcome message?

Execute below operations as root user.

1. vi /etc/ssh/sshd_config
# comment out Banner row
# no default banner path
Banner /etc/ssh/ssh-banner-message.txt

2. vi /etc/ssh/ssh-banner-message.txt
# add a new message to text file

3. service sshd restart
# restart ssh service to see banner message

Thursday, 18 December 2014

How to use to_date function?

e.g.
select to_date('2014-12-18','yyyy-mm-dd') from dual;
output: 12/18/2014

select to_date('2014-12-18 12:15','yyyy-mm-dd hh:mi') from dual;
output: 12/18/2014 12:15:00 PM

select to_date('2014-12-18 13:15:55','yyyy-mm-dd hh24:mi:ss') from dual;
output: 12/18/2014 1:15:55 PM

select to_date('2014-12-18','yyyy-mm-dd') - 7 from dual;
output: 12/11/2014

select to_char(to_date('2014-12-18','yyyy-mm-dd') + 30,'DAY') from dual;
output: SATURDAY

select to_char(to_date('2014-12-18','yyyy-mm-dd') + 365,'MONTH') from dual;
output: DECEMBER

Friday, 12 December 2014

[ADVICE] PowerMenu to use "Always On Top"

You may use PowerMenu tool for using "Always On Top" on the window.

Download: http://www.abstractpath.com/powermenu/

Thursday, 11 December 2014

Basic Calculator VBS example

MsgBox("Calculator!")
a=CInt(InputBox("First number:","Enter number"))
b=CInt(InputBox("Second number:","Enter number"))
c=a+b
msgbox(a & "+" & b & " = "&c)

How to run Visual Basic Script file in Windows?

Please follow the instructions:
  1. Run notepad 
  2. Copy below text into notepad
  3. Save as .vbs format
  4. Double click the file
Example VBS file:

Dim objFS, objFolder
Dim strDir
strDir = CStr(InputBox("Create a directory tool:","Input your new directory"))
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFS.CreateFolder(strDir)
WScript.Echo "I created the folder " & strDir & " using with this powerful tool!"
WScript.Echo "powered by ozsoyler.blogspot.com"
WScript.Quit

Wednesday, 10 December 2014

How to use secure copy in Linux Terminal?

To upload:
$ scp [desired files] [login_user]@[host]:/[remote path]
e.g.
$ scp *.txt alper@10.10.10.10:/home/alper/mynewtextfiles

To download:
$ scp [login_user]@[host]:/[remote path] [local directory] 
e.g.
scp alper@10.10.10.10:/home/alper/mynewtextfiles/* /home/alper2/mydirectory/ 

Tuesday, 9 December 2014

How to know hostname from IP in Terminal?

$ nmblookup -A <IP>
e.g. nmblookup -A 10.10.10.10

e.g. nmblookup -A $(who | awk -F\( '{ print $2}' |  rev | cut -c 2- | rev )

Monday, 8 December 2014

Alexa Rank

Global rank: 6,859,462

How to know system hardware and software information?

to get os version:
cat /etc/*release*

to get os kernel version:
cat /proc/version

to get cpu info:
# cat /proc/cpuinfo
or
# lscpu

to get ram info:
# cat /proc/meminfo

Wednesday, 3 December 2014

How to find full path of a program in Windows?

CMD> where ping
C:\Windows\System32\PING.EXE
CMD> where sqlplus
D:\instantclient_11_2\sqlplus.exe

Tuesday, 2 December 2014

What are taskmgr.exe keyboard shortcuts?

1st way: CTRL + ALT + DEL
2nd way: CTRL + SHIFT + ESC

Friday, 28 November 2014

What is Sticky Bit?

If sticky bit is active, that file can be only deleted by root or owner.

to activate;
chmod +t file.txt
-rw-r--r-T
to unactivate;
chmod -t file.txt
-rw-r--r--

You may also want to read this entry;
http://ozsoyler.blogspot.com/2015/01/what-is-suid-and-guid.html

Saturday, 22 November 2014

Useful shortcuts for vi editor

  • vi myfile.txt
    to open file with vi editor
  • vi + myfile.txt
    cursor goes to end of the file
  • vi +200 myfile.txt
    cursor goes to 200th row
  • :set list
    :set nolist

    see hidden characters or not
  • :set number
    :set nonumber
    see number of lines or not
  • :set paste
    activate paste option before get into insert mode (to resolve the commented lines problem)
  • :set nopaste
    deactivate paste option before get into insert mode
  • :[line_number]
    cursor goes to desired line
  • l, k, h, j
    cursor goes to right, up, left, down
  • w
    cursor goes to next word
  • b
    cursor goes to start of the current word
  • gg
    go top
  • shift + g
    go bottom
  • dd
    remove row
  • p
    paste the clipboard data
  • x
    remove one char
  • yy
    copy the row
  • u
    undo last operation
  • o
    add new row
  • :%d
    delete all lines
  • /hello
    find "hello" word
    n
    go to next searched word
    N
    go to previous searched word

How to unlock database user account?

Please run the sql lines in SQL Editor as "sys" user;

SQL> ALTER USER "alper" ACCOUNT UNLOCK;

Wednesday, 19 November 2014

What are RAID levels 0/1/5/10?

Level Minimum Disk Req. Performance Redundancy Suggestions
0 2 Excellent None Not recommended for critical systems
1 2 Good Excellent
5 3 Good Good Best cost effective option providing both performance and redundancy. Use this for DB that is heavily read oriented. Write operations will be slow.
10 4 Excellent Excellent If you can afford the dollar, this is the BEST option for any mission critical applications (especially databases).
Ref: http://www.thegeekstuff.com/2010/08/raid-levels-tutorial/