- Prison Code Breaker Diary -

=> aka: Nhật Kí Code Tù

Categories

Showing posts with label Operating System. Show all posts

Opem XTerm and type

bash$ sudo passwd root

Then type a new password for root.
That's all!

STATIC LIBRARY (.a)

+ Compile

$ gcc -Wall -c *.c
+ Create library
$ ar -cvq libtest *.o
+ List files in library
$ ar -t libtest.a
+ Linking with library
$ gcc -o executable-name prog.c libtest.a
$ gcc -o executable-name prog.c -L/path/to/library-dir -ltest


Shared Object: DYNAMICALLY LINKED LIBRARY

+ Compile object
$ gcc -Wall -fPIC -c *.c
+ Create shared object
$ gcc -shared -Wl,-soname,libtest.so.1 -o libtest.so.1.0 -o *.o
+ Move library to destination
$ mv libtest.so.1.0 /path/to/lib-dir
+ Allow naming convention like -ltest
$ ln -sf /path/to/lib-dir/libtest.so.1.0 /path/to/lib-dir/libtest.so
+ Allow run-time binding to work
$ ln -sf /path/to/lib-dir/libtest.so.1.0 /path/to/lib-dir/libtest.so.1
+ Testing executable file dependencies
$ ldd executable-file


Reference: Yo-Linux

Oh yes, it took me time to search for this.
Here's the trick:


ps -o"%C" -p #PID

or simplified version

ps -opcpu -p #PID

The End :D

Would you like to have your command prompt like mine?













OK! Let's open Registry Editor (regedit.exe) utility for some add-ons.
First, export your current registry settings for the sake of your life (menu File->Export).
Then, access this key: Computer\HKLM\SYSTEM\CurrentControlSet\Control\SessionManager\Environment
Right click to create a new string value, name it PROMPT with value: "[JaPh]@$P~$P$$$P"
Then log-off or reboot to apply new settings to environment. You'll see the change in your command prompt, just like Unix-shell.

However, if you just want to have this style temporarily, means that for current session only, you need to use "prompt" utility to set up.
Example:


C:\> prompt [JaPh]@$P~$$$P

After session, everything changes back to default.

Here some special value if you want differences:

$A & (Ampersand)
$B | (pipe)
$C ( (Left parenthesis)
$D Current date
$E Escape code (ASCII code 27)
$F ) (Right parenthesis)
$G > (greater-than sign)
$H Backspace (erases previous character)
$L < (less-than sign) $N Current driveprompt [%USERNAME%@%COMPUTERNAME%$S~]$$
$P Current drive and path
$Q = (equal sign)
$S (space)
$T Current time
$V Windows XP version number
$_ Carriage return and linefeed
$$ $ (dollar sign)

Have fun!

Check it out: http://www.chromium.org/chromium-os/building-chromium-os

You can download the source and building your own. Give it a try!