How to mount a directory from Windows to VirtualBox?
Wednesday, December 18, 2013
Pre-requisite:
You must have installed the "Guest Additions" before you can configure this drive mounting.
This blog shall contain all the tips in using unix, windows, linux, programming tricks in perl, c++, scripting like awk, sed and etc. This shall be consider as a technical blog.
Pre-requisite:
You must have installed the "Guest Additions" before you can configure this drive mounting.
Posted in Linux, VirtualBox by Alex Yap | 0 comments
Email this postTo run a process in the background:
[command] &
To suspend a foreground process and place it in the background, use the following steps:
Posted in Unix by Alex Yap | 0 comments
Email this postIf you wanted to customize your .profile, .bashrc or .bash_profile, visit this link, awesome references:
http://stefaanlippens.net/my_bashrc_aliases_profile_and_other_stuff
or
http://www.linuxfromscratch.org/blfs/view/6.3/postlfs/profile.html
Changing directory colors:
http://www.geekgumbo.com/2011/11/04/changing-the-directory-color-in-the-bash-shell/
Posted in bash, Unix by Alex Yap | 0 comments
Email this postWondering how to use vlookup to search for a value?
Scenario 1:
Search a target cell to find out the existance from another column.
Posted in MS Excel by Alex Yap | 0 comments
Email this postPosted in bash, Unix by Alex Yap | 0 comments
Email this posteg:
>[/current/dir] >
>
>I'd like it to be:
>[/current/dir]
edit your .profile
export PS1=[`hostname`:'$PWD]^V^J
>'
where ^V is control-V and ^J is control-J to accomplish this.
Posted in Unix by Alex Yap | 0 comments
Email this postIf you saw a lot of ^M character in your code, reason being is ^M is the character in DOS if you create the file in Windows.
If you transfer the DOS file into unix, you will see lots of ^M in your file and it is very irritating indeed.
You can do a simple magic in vi by
:%s/[crtl-v ctrl-m//g
meaning,
%s - substitute
[ctrl-v ctrl-m] - create the ^M character
// - empty
g - replace globally
Posted in Unix, vi by Alex Yap | 0 comments
Email this postI always find it difficult to digest the filesize from the ls -al command. For instance, after ls -al, the output give me filesize in bytes.
Gosh, then I have to start calculating it by taking last 4 digits, slowly count upwards like 1K, 10K, 100K, 1MB, 10MB, 100MB and so on so forth.
For instance:
this output:
-rw-r--r-- 1 walrus dba 137207094 Jul 8 23:12 config.2008032519.s
137207094 is how much?
going with my method of counting upwards, it gives me 137MB roughly.
Is it correct? WRONG. Hell wrong
The above is bits only. Bear in mind, 1 KB = 1024 bits, 1 MB = 1024 KB and so on so forth
[ Source ]
1 bit = a 1 or 0 (b)
4 bits = 1 nybble (?)
8 bits = 1 byte (B)
1024 bytes = 1 Kilobyte (KB)
1024 Kilobytes = 1 Megabyte (MB)
1024 Megabytes = 1 Gigabyte (GB)
1024 Gigabytes = 1 Terabyte (TB)
The correct calculation is 137207094 / 1024 (bits) / 1024 (KB) = 130.8 MB
Starting in Solaris 10, we have a new option in ls command.
: /u01/apps/WatchMark/FlexPM/classic/vendor/Lucent/ECP/ftpIN/in>uname -a
SunOS lxserver 5.10 Generic_118833-36 sun4u sparc SUNW,Sun-Fire-V445
ANCIENT WAY:
ls -al
total 270388
drwxr-xr-x 2 walrus dba 1024 Jul 8 23:14 .
drwxr-xr-x 11 walrus dba 512 Jun 17 01:49 ..
-rw-r--r-- 1 walrus dba 137207094 Jul 8 23:12 config.2008032519.s
-rw-r--r-- 1 walrus dba 451989 Jul 8 23:12 config.2008032519.split0.bz
cons: hard to read filesize and output distorted
NEW WAY:
ls -alh
total 269060
drwxr-xr-x 2 flexpm dba 1.0K Jul 8 23:12 .
drwxr-xr-x 11 flexpm dba 512 Jun 17 01:49 ..
-rw-r--r-- 1 flexpm dba 131M Jul 8 23:12 config.2008032519.s
-rw-r--r-- 1 flexpm dba 441K Jul 8 23:12 config.2008032519.split0.sm.gz
pros:
- more readable format in terms of file size
- contents are properly aligned.
cons:
- need to type extra 'h' at the end of ls command
Posted in Unix by Alex Yap | 0 comments
Email this postHow to use regular expression (regex) in grep or vi?
If you need to search for a pattern of "string" or "character" in a file / many files, you will need to use regular expression (regex) either in vi editor or in grep command. But how? See below:
using vi:
- press '/' for searching
- for instance, i wanted to search for CL000, CL001, CL002, ie: the pattern is CLXXX follow by digit.
- syntax:
/^CL[0-9]*
^ - start of pattern
* - zero or more digit
using unix grep command:
- grep CL[0-9]
Posted in Unix, vi, vim by Alex Yap | 0 comments
Email this postQuestion: How to change oracle user password?
Answer:
The syntax is:
alter user [user_name]
identified by [new_password] ;
user_name is the user whose password you wish to change.
new_password is the new password to assign.
For eg:Posted in Oracle, SQL by Alex Yap | 0 comments
Email this postHow to find out the machine IP or full address name that reside in your network?
Answer: Use 'traceroute' command in unix
For eg: You wanted to find a machine call "walrus" in your network
: /home/LX>traceroute walrus
traceroute to walrus.kl.lxcorp.com (10.101.110.74), 30 hops max, 40 byte packets
1 walrus.kl.lxcorp.com (10.101.110.74) 1.168 ms 0.373 ms 0.230 ms
machine IP: 10.101.110.74
machine name: walrus.kl.lxcorp.com
Posted in Network, Unix by Alex Yap | 0 comments
Email this postUse 'uname -a' command
: /etc>uname -a
SunOS shark 5.8 Generic_117350-59 sun4u sparc SUNW,Sun-Fire-V440
SunOS - machine's OS
shark - machine hostname
5.8 - SunOS version (Solaris 5.8 means Solaris 8)
sparc - machine type
Posted in Unix by Alex Yap | 0 comments
Email this postUse the command 'ifconfig -a'
: /etc>ifconfig -a
lo0: flags=1000849
inet 127.0.0.1 netmask ff000000
ce0: flags=1000843
inet 9.100.90.140 netmask fffffe00 broadcast 9.100.90.255
The highlighted IP (9.100.90.140) above is the IP of the machine.
Posted in Unix by Alex Yap | 0 comments
Email this postRun vim (full path /usr/misc/bin/vim)
Type :tj
You are there!
Tips
:tj[ump]
Jump to the tag directly when there is only one match
:tn[ext]
Jump to next matching tag
:tp[revious]
Jump to previous matching tag
:tf[irst]
Jump to first matching tag
:tl[ast]
Jump to last matching tag
:po[p] (or Ctrl+T)
Jump to older entry in tag stack
:ta[g]
Jump to newer entry in tag stack
:tags
Show the contents of the tag stack. The active entry is marked with a '>'
:tj /^get
Lists all the tags that starts with "get"
:tj /norm
Lists all the tags that contain "norm", including "id_norm"
:ts
Notes
*By default, Cltr+] is escape character for telnet. You can disable it through
Windows DOS: telnet -e ''
Unix: telnet -E
You should use dtterm (/usr/dt/bin/dtterm) to enable vim to support color mode
Posted in ctags, Unix, vim by Alex Yap | 0 comments
Email this postMany of you wondering how to generate ctags and configure it to use with Vim? Here, you at the right place.
What is ctags?
According to ctags sourceforge.
Ctags generates an index (or tag) file of language objects found in source files that allows these items to be quickly and easily located by a text editor or other utility. A tag signifies a language object for which an index entry is available (or, alternatively, the index entry created for that object).Below is 6 (six) simple steps to generate the ctags and use it with your vim.
Tag generation is supported for the following languages:
Assembler, AWK, ASP, BETA, Bourne/Korn/Zsh Shell, C, C++, COBOL, Eiffel, Fortran, Java, Lisp, Lua, Make, Pascal, Perl, PHP, Python, REXX, Ruby, S-Lang, Scheme, Tcl, Vim, and YACC.
Posted in ctags, sourceforge, vim by Alex Yap | 0 comments
Email this postMany of you might want to capture the screen output of the unix console for references later or wanted to show the output to another counterpart.
This command is particularly useful in 2 scenarios:
1. During a training, where instructor do a demo using the endless list of command that you have difficulty to remember and jotting down.
At many instances, even you can jot down the command you might not even able to remember what is the output of the command.
Put it this way, many of us, learn from example. Hence being able to capture the screen output is very important.
2. If you are a student and you need to show your program output to your lecturer. Use this command.
THE COMMAND IS:
script
CTRL+D to exit the script command
=========== For Instance =========
$ script script.out
Script started, file is script.out
$ date
Tue Mar 17 17:04:07 SGT 2009
$ time
real 0m0.00s
user 0m0.00s
sys 0m0.00s
$ ^D
Script done, file is script.out
$ cat script.out
Script started on Tue Mar 17 17:04:03 2009
$ date
Tue Mar 17 17:04:07 SGT 2009
$ time
real 0m0.00s
user 0m0.00s
sys 0m0.00s
$ ^D
script done on Tue Mar 17 17:04:11 2009
$
So simple, right ......
Posted in Unix by Alex Yap | 0 comments
Email this post