### 删除Linux版Adobe Reader的方法

Linux版的Adobe Reader的启动速度太慢了，每次打开pdf文档的时候都不得不通过右键来选择使用Fedora自带的阅读器，有点麻烦，因此打算把它删除。我的Adobe Reader是通过AdobeReader.bin来安装的，尝试了yum remove acroread和rpm -e acroread都无效，很是郁闷。连Add/Remove Software都找不到该package，因此也不能通过这种方法删除了。

/opt/Adobe/Reader9/bin下有一个UNINSTALL 脚本，只要使用root帐号执行./UNINSTALL就可以了。

# List of Solaris commands for process management

## Commands

apptrace – for tracing library calls
dtrace – debugger, new in version 10
pargs – get list of arguments and environment variables with which process was started
pfiles – list of file descriptors, associated with process
pgrep – get the PID's of processes by name i.e. Something like ps -efl|grep -v grep|grep process_name
pkill – send signal to process. For example pkill -9 init :-P
pldd – list dynamic libraries, associated with process, similar to ldd for executable
plockstat – see list of locked by process files. Lock can be mutex i.e. exclusive and reader/writer for shared access
pmap – get memory map (segments) of process
preap – try to kick-off zombie process
prstat – fullscreen view of processes sorted by different criteria, similar to Linux top command
prun – continue hold with pstop process
ps - print process information and status. In Solaris exist SYSV and BSD variants, respectively /usr/bin/ps and /usr/ucb/ps
psig – list signals that can be handled by process
pstack – get backtrace stack of process for debugging purposes
pstop – temporary hold process
ptree - print the tree of processes
pwait – wait till process finish
pwdx – list working directory for process, like pwd command
truss – for tracing user/library/system calls and signals

## Examples

apptrace

# apptrace man
-> man      -> libc.so.1:int atexit(int (*)() = 0xd27d6bfc)
<- man      -> libc.so.1:atexit()
-> man      -> libc.so.1:int atexit(int (*)() = 0x8054e8c)
<- man      -> libc.so.1:atexit()
-> man      -> libc.so.1:void __fpstart(void)
<- man      -> libc.so.1:__fpstart() = 0xd251fc94
-> man      -> libc.so.1:access(0x8055984, 0x1, 0x8047e30) ** NR
-> man      -> libc.so.1:char * setlocale(int = 0x6, const char * = 0x8055980 "")
<- man      -> libc.so.1:setlocale() = 0xd25002ed
-> man      -> libc.so.1:char * setlocale(int = 0x5, const char * = 0x0 <NULL>)
<- man      -> libc.so.1:setlocale() = 0xd25002ed
-> man      -> libc.so.1:strcpy(0x80669e8, 0xd25002ed, 0x8047e30) ** NR
-> man      -> libc.so.1:int strcmp(const char * = 0x805597c "C", const char * = 0x80669e8 "C")
<- man      -> libc.so.1:strcmp()
-> man      -> libc.so.1:char * textdomain(const char * = 0x8055968 "SUNW_OST_OSCMD")
<- man      -> libc.so.1:textdomain() = 0x80683e0
-> man      -> libc.so.1:strcpy(0x80665e8, 0x8055960, 0x8047e30) ** NR
-> man      -> libc.so.1:char * getenv(const char * = 0x8054fc0 "MANPATH")
<- man      -> libc.so.1:getenv()
-> man      -> libc.so.1:strrchr(0x8047e98, 0x2f, 0x8047e30) ** NR
-> man      -> libc.so.1:int strcmp(const char * = 0x8047e98 "man", const char * = 0x8054fb8 "apropos")
<- man      -> libc.so.1:strcmp() = 0xc
-> man      -> libc.so.1:int strcmp(const char * = 0x8047e98 "man", const char * = 0x8055958 "whatis")
<- man      -> libc.so.1:strcmp() = 0xfffffff6
-> man      -> libc.so.1:int strcmp(const char * = 0x8047e98 "man", const char * = 0x8055944 "catman")
<- man      -> libc.so.1:strcmp() = 0xa
-> man      -> libc.so.1:int getopt(int = 0x1, char *const * = 0x8047de4, const char * = 0x8066420 "FfkrP:M:T:ts:lad")
<- man      -> libc.so.1:getopt() = 0xffffffff
-> man      -> libc.so.1:char * gettext(const char * = 0x8055838 "usage:        man [-] [-adFlrt] [-M path] [-T macro-package ] [ -s  section ] name ...
man [-M path] -k keyword ...
man [-M path] -f file ...")
<- man      -> libc.so.1:gettext() = 0x8055838
-> man      -> libc.so.1:int fprintf(FILE * = 0x8067610, const char * = 0x8054f7c "%s
", void * = 0x8055838, ...)
usage:  man [-] [-adFlrt] [-M path] [-T macro-package ] [ -s section ] name ...
man [-M path] -k keyword ...
man [-M path] -f file ...
<- man      -> libc.so.1:fprintf() = 0x88
-> man      -> libc.so.1:exit(0x2, 0x8047e30, 0x8047da0) ** NR


in the above example you can clearly see library calls as fprintf(), strcmp(), getenv(), etc.

pargs

# pargs 558
558:    /usr/lib/sendmail -Ac -q15m
argv[0]: sendmail: Queue runner@00:15:00 for /var/spool/clientmqueue



### Fedora 12升级Chromium遇到的问题及解决方法

[chromium]
name=Chromium Test Packages
baseurl=http://spot.fedorapeople.org/chromium/F$releasever/ enabled=0 gpgcheck=0  然后通过yum安装就可以了。 今天在Fedora People看到有新的chromium安装包出现，于是打算升级chromium。下载了所有的rpm包(忘记了最初是通过yum安装的)。安装时chromium, chromium-libs都能通过rpm -Uvh正常安装，可是升级v8时还是出了问题。想起以前的教训，打算先把v8完全卸载再安装，可是缺无法卸载，无论是通过rpm -e还是yum remove都不行。 这时想到了用yum upodate v8-*，结果却出现了“Package v8-devel-2.0.3-1.20091209svn3443.fc12.i686.rpm is not signed”的错误。在网上找到一个办法，就是编辑 /etc/yum.conf ，把gpgcheck=1 改为 gpgcheck=0。不过这样做有潜在的风险，因此在安装完v8之后就立刻把gpgcheck重新设为1. 另外一个奇怪的问题是，打开Chromium时，浏览器打不开，而且SELinux总是报错： Summary: SELinux is preventing /usr/lib/chromium-browser/chromium-browser from loading /usr/lib/chromium-browser/libmedia.so which requires text relocation. Detailed Description: The chromium-browse application attempted to load /usr/lib/chromium-browser/libmedia.so which requires text relocation. This is a potential security problem. Most libraries do not need this permission. Libraries are sometimes coded incorrectly and request this permission. The SELinux Memory Protection Tests (http://people.redhat.com/drepper/selinux-mem.html) web page explains how to remove this requirement. You can configure SELinux temporarily to allow /usr/lib/chromium-browser/libmedia.so to use relocation as a workaround, until the library is fixed. Please file a bug report. Allowing Access: If you trust /usr/lib/chromium-browser/libmedia.so to run correctly, you can change the file context to textrel_shlib_t. "chcon -t textrel_shlib_t '/usr/lib/chromium-browser/libmedia.so'" You must also change the default file context files on the system in order to preserve them even on a full relabel. "semanage fcontext -a -t textrel_shlib_t '/usr/lib/chromium-browser/libmedia.so'" Fix Command: chcon -t textrel_shlib_t '/usr/lib/chromium-browser/libmedia.so' Additional Information: Source Context unconfined_u:unconfined_r:unconfined_execmem_t:s0- s0:c0.c1023 Target Context system_u:object_r:lib_t:s0 Target Objects /usr/lib/chromium-browser/libmedia.so [ file ] Source chromium-browse Source Path /usr/lib/chromium-browser/chromium-browser Port <Unknown> Host bonn.yang Source RPM Packages chromium-4.0.273.0-0.1.20091216svn34775.fc12 Target RPM Packages chromium-libs-4.0.273.0-0.1.20091216svn34775.fc12 Policy RPM selinux-policy-3.6.32-56.fc12 Selinux Enabled True Policy Type targeted Enforcing Mode Enforcing Plugin Name allow_execmod Host Name bonn.yang Platform Linux bonn.yang 2.6.31.6-166.fc12.i686.PAE #1 SMP Wed Dec 9 11:00:30 EST 2009 i686 i686 Alert Count 11 First Seen Wed 23 Dec 2009 09:38:16 PM CST Last Seen Wed 23 Dec 2009 10:28:36 PM CST Local ID b1f55f28-145d-48dd-9d71-6fb7fe6a57c8 Line Numbers Raw Audit Messages node=bonn.yang type=AVC msg=audit(1261578516.240:27332): avc: denied { execmod } for pid=2946 comm="chromium-browse" path="/usr/lib/chromium-browser/libmedia.so" dev=sda2 ino=277322 scontext=unconfined_u:unconfined_r:unconfined_execmem_t:s0-s0:c0.c1023 tcontext=system_u:object_r:lib_t:s0 tclass=file node=bonn.yang type=SYSCALL msg=audit(1261578516.240:27332): arch=40000003 syscall=125 success=no exit=-13 a0=8ff8000 a1=63000 a2=5 a3=bf899bf0 items=0 ppid=1 pid=2946 auid=500 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 tty=(none) ses=1 comm="chromium-browse" exe="/usr/lib/chromium-browser/chromium-browser" subj=unconfined_u:unconfined_r:unconfined_execmem_t:s0-s0:c0.c1023 key=(null)  试了半天也没能在SELinux中设好libmedia.so的permission（有人说只要把libmedia.so的permission设为permissive就可以）。后来在一个法语的网页上(http://tuxmaya.wordpress.com/2009/12/21/nuevos-paquetes-de-chormium-en-fedora/ )发现了这样一条命令来取消 SELinux 对 /usr/lib/chromium-browser/下的所有.so文件的permission 的检查。 chcon -t texrel_shlib_t /usr/lib*/chromium-browser/*.so 另外，该网页(http://forums.fedoraforum.org/showthread.php?t=237029 )上也提到了这种方法。 设置之后，chromium就可以正常工作了。这篇博文就是用chromium来写的。 PS: 写完博文后在SELinux的错误信息中发现了fix的方法： hcon -t textrel_shlib_t '/usr/lib/chromium-browser/libmedia.so' semanage fcontext -a -t textrel_shlib_t '/usr/lib/chromium-browser/libmedia.so' 实在是太粗心了，当时竟然没有仔细看…… 谨记这一教训！ ### Fedora 12安装Android SDK # Fedora 12安装Android SDK ### 1. 下载Android SDK ### 由于android网站国内不能直接访问， 请通过以下网址下载 http://androidappdocs.appspot.com/index.html http://dl.google.com/android/android-sdk-windows-1.6_r1.zip Mac OS X (intel)： http://dl.google.com/android/android-sdk-mac_x86-1.6_r1.zip ADT Plugin for Eclipse 0.9.3： http://dl.google.com/android/ADT-0.9.3.zip ophone develop ：http://www.ophonesdn.com/ android developer： http://www.anddev.org/ ### 2. 添加Android SDK 运行android后，在选择Available Packages时遇到错误消息： Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml, reason: HTTPS SSL error. You might want to force download through HTTP in the settings. 解决方法是： • 创建配置文件： ~/.android/androidtool.cfg，在该文件中添加一行 sdkman.force.http=true （该方法无效） • 打开"Settings" 选项并选中misc section "force https:// ... sources to be fetched using http://..." ，重启android. (点击Save后没有反应，重启后发现该选项并没有选中，无效) • export GDK_NATIVE_WINDOWS=true before running android sdk manager. It fixes both the save button and the install button for me. （该方法可行） ### 3. 为Eclipse安装ADT插件 安装ADT的方法Installing and Updating ADT 遇到的问题：During installation, there's an error about requiring org.eclipse.wst.sse.ui. 下面是我的经验： The Google Plugin for Eclipse depends on other specific Eclipse components, such as WST. Your installation of Eclipse may not yet include all of them, but they can be easily installed by following these instructions. #### Eclipse 3.5 (Galileo) 1. Select Help > Install New Software... 2. Click the hyperlink for Available Software Sites. 3. Ensure there is an update site named Galileo. If this is not present, click Add... and enter http://download.eclipse.org/releases/galileo for the Location.（在这一步，添加完Galileo之后，最好能安装一下这个site的可用的关键更新） 4. Now go through the installation steps; Eclipse should download and install the plugin's dependencies. 完成上面的步骤之后，Google App Engine和 Web Toolkit插件就被安装到了Eclipse。此时你仍然需要按照http://androidappdocs.appspot.com/sdk/eclipse-adt.html所陈述的步骤再安装ADT并配置SDK。 如果按照上述方法仍然无法安装ADT，最好通过System->Administration->Add/Remove Software彻底删除Eclipse，删除$HOME/.eclipse文件夹，更新操作系统，然后重装Eclipse。如果选择自己下载Eclipse,运行时很可能会遇到"JVM terminated. Exit Code=-1"的问题。因此还是建议通过Add/Remove Software或者yum install eclipse安装。重新安装完eclipse,再按照上述步骤先安装GAE和GWT，然后安装ADT。

ADT成功安装后，在Eclipse的Window->Preferences中，可以找到Android这一项：

### Fedora升级/安装Chromium(Chrome)总结

尽管Linux版Chrome浏览器还没有正式发布，Fedora早已官方支持Google的Chromium了。Fedora社区会定期build最新的稳定版Chromium，可以在http://spot.fedorapeople.org/chromium/下载到。当然也可以下载Google 每天build的二进制版Chromium，不过就是这些都不一定稳定：http://build.chromium.org/buildbot/snapshots/

v8-1.3.16-1.20091027svn3152.fc11.i586.rpm

v8-devel-1.3.16-1.20091027svn3152.fc11.i586.rpm

chromium-4.0.227.0-0.1.20091027svn30269.fc11.i586.rpm
安装时需要先安装v8,然后是v8-devel，最后安装chromium。如果要升级的话，最好先把老版本的删除，然后再安装新版本的chromium。
删除的时候按照和安装时相反的顺序，先删除chromium,再删除v8-devel,最后删除v8。

### 【总结】Linux下C开发，怎么做成库文件，又怎么引用这个库文件？

1. 共享库

gcc -shared -fPIC -Wmyfun.c -0 libmy.so

-fIPC 表示“位置无关代码”（Position Independent Code),可不加;
-W 表示输出警告信息,可不加;
库文件的命名要按照libxxxx.so的格式;

gcc xxx.c -0 xxx.out -lmy
-l 表示设定要连接的库(libmy.so,输my便可)

2. 静态库

3. 动态库

### Shell中直接调用perl命令

The  -e option is handy for quick Perl operations
from the command line. Want to change all instances of "oldstring" in
Wiffle.bat to "newstrong"? Try

perl -i.old -p -e "s/ oldstring/ newstrong/g" wiffle.bat

This says: "Take each line of  Wiffle.bat (-p); store the original in Wiffle.old (-i); substitute all instances of  oldstring with newstrong (-e); write the result (-p) to the
original file (-i)."

Other PERL command line options are:

Perl 5 Command-Line Switches

 Option Arguments Purpose Notes -0 octal character code Specify record separator Default is newline (/n) -a none Automatically spli recordst Used with -n or or -p -c none Check syntax only Do not execute -d none Run script using Perl debugger If Perl debugging option was included when Perl was installed -D flags Specify debugging behavior See table 2 -e command Pass a command to Perl from the command line Useful for quick operations -F regular expression If -a used Expression to split by default is white space -i extension Replace original file with results Useful for modifying contents of files -I directory Specify location of include files -l octal character code Drop newlines when used With -n and -p and use designated character as line- termination character -n none Process the script using each specified file as an argument Used for performing the same set of actions on a set of files -p none Same as -n but each line is printed -P none Run the script through the C preprocessor before Perl compiles it -s none Enable passing of arbitrary switches to Perl Use -s -what -ever to have the Perl variables $what and$ever defined within your script -S none Tell Perl to look along the path for the script -T none Use taint checking; don't evaluate expressions supplied on the command line -u none Make Perl dump core after compiling your script; intended to allow for generation of Perl executables Very messy; wait for the Perl compiler -U none Unsafe mode; overrides Perl's natural caution Don't use this! -v none Print Perl version number -w none Print warnings about script syntax Extremely useful, especially during development

### Tcl中调用Awk命令

exec awk '/{print /"blah/"/}' temp.fil

exec awk "/somePattern/ {print /$0}" someFile 或者 exec awk {/somePattern/ {print$0}}  someFile

### 但是我按照这篇文章的介绍，在Solaris 9下设置crontab的文件时，老是报错

\$ crontab chkbjservers.cron
MAILTO=xxx@xxxxx.com
crontab: error on previous line; unexpected character found in line.
crontab: errors detected in input, no crontab file generated.

30 7 * * 1 /bld/xxxx/mytool/chkbjserver.sh|cat chkbjserver.out|mailx -s "Shared memory checked result in BJ COOL" xxxx@xxxxxxx.com

=========================================================================

### What is a cronjob, and how do I use it?

The cron daemon is a long running process that executes commands at specific dates and times. To schedule one-time only tasks with cron, use at or batch. For commands that need to be executed repeatedly (e.g. hourly, daily or weekly), use crontab, which has the following options:

 crontab filename Install filename as your crontab file. crontab -e Edit your crontab file. crontab -l Show your crontab file. crontab -r Remove your crontab file. MAILTO=user@domain.com Emails the output to the specified address.

The crontab command creates a crontab file containing commands and how often cron should execute them. Each entry in a crontab file consists of six fields, specified in the following order:

minute(s) hour(s) day(s) month(s) weekday(s) command(s)

The fields are separated by spaces or tabs. The first five are integer patterns and the sixth is the command to be executed. The following table briefly describes each of the fields.

Field Value Description
minute 0-59 The exact minute that the command sequence executes.
hour 0-23 The hour of the day that the command sequence executes.
day 1-31 The day of the month that the command sequence executes.
month 1-12 The month of the year that the command sequence executes.
weekday 0-6 The day of the week that the command sequence executes. Sunday=0, Monday = 1, Tuesday = 2, and so forth.
command Special The complete command sequence variable that is to be executed.

Each of the patterns from the first five fields may either be an asterisk (*) (meaning all legal values) or a list of elements separated by commas. An element is either a number or two numbers separated by a minus sign (meaning an inclusive range). Note that the specification of days may be made by two fields (day of the month and day of the week). If both are specified as a list of elements, both are followed. For example:

MAILTO=user@domain.com
0 0 1,15 * 1 /big/dom/xdomain/cgi-bin/scriptname.cgi

The cron daemon would run the program scriptname.cgi in the cgi-bin directory on the first and fifteenth of each month, as well as on every Monday. To specify days by only one field, the other field should be set to *. For example:

MAILTO=user@domain.com
0 0 * * 1 /big/dom/xdomain/cgi-bin/scriptname.cgi

The program would then only run on Mondays.

If a cron job specified in your crontab entry produces any error messages when it runs, they will be reported to you via email.

You may create crontab files in notepad (being sure to upload them in ASCII) or you may create them within telnet by simply typing:

mcedit cronfile.txt

For more information, consult the man pages. man pages are the directions and tutorials available to you right at the command line from within telnet. Type any of the following lines to open the relevant tutorials:

man 5 crontab {enter}
man 1 crontab {enter}
man cron {enter}
man at {enter}
man batch {enter}
man 1 cron {enter}

Note:
Your crontab file must end with a line feed - in other words, make sure to press [Enter] after the last line in the file.

### Try It!

Now that you have read an overview of Cron, test your skills by following the steps below. Once completed you should have a cron file of your own!

Step 1: Create a simple text file using Notepad or any simple text editor that contains the following text:

MAILTO=yourusername@yourdomain.com {Enter}
58 23 * * * /big/dom/xdomain/cgi-bin/yourscript.pl
{Enter}

Notes for Step 1

1. You may create this file using your CNC File Manager by navigating to the /big/dom/xdomain/ directory and clicking 'Create New File' or any other simple text editor such as Notepad.
2. {Enter} should not actually be typed. [Enter] means hit the {Enter} (return) key to begin the next line and to add a blank line feed at the end of the last line of your Cron File. It is important to always remember to do this.
3. MAILTO: Replace the email address with a valid email address of your own. This will ensure that when your cronruns, that any output from the script, such as error message, will be emailed to you.
4. The second line tells your server when to run this script. In this example, the script will be run at 11:58 PM Eastern Time every day of the year.
5. It is very important that you double check the script path to ensure it is correct and remember the file names are CaSe SeNsiTive.

Step 2: Name the text file. (Example: cronfile.txt)
The cronfile name may be replaced with any name you choose. For instance if you are running a Cron to trigger an email reminder script it could be called reminder.txt. Many choose to simply call it cronfile.txt.

Step 3: Upload the file in ASCII.
Any standard FTP client or your account's CNC upload feature will work for this. It must be uploaded in ASCII mode and it is recommended that it be placed in your /big/dom/xdomain/ directory. It may be placed anywhere in your account but to prevent browser access (security risks) it is strongly recommended to place it above your /www directory.

Step 4: Telnet into your account and issue the following command:

crontab /big/dom/xdomain/cronfile.txt

The above tells the server's crontab where the file is located and that you wish to make it active. Make sure the path to the file is the actual path to where the file was placed. If successful you will be returned to the command bash line, if not an error will be displayed)

IMPORTANT NOTES

Removing/Stopping the Cron: Deleting the cronfile.txt file from your account will not stop the cron. You may remove this file at any time, since the server's crontab already has the contents, and the cron will still run after you have made it active.

To turn the cron off you must Telnet into your account and issue the following command:

The crontab -r will deactivate the cronjob and remove the file contents from the server.

Security Note: If the script the cron is setup to run is in the /cgi-bin/ or /www/ directory it may be run at anytime by anyone with browser access. If the crontab is all that should run the script and you do not want the public to be able to run the script, then you will need to place the script in a directory above the /cgi-bin/ and /www/ directories such as:/big/dom/xdom/user/cronscripts/scriptname

### Fedora安装Expect

./configure --withtclinclude=/usr/local/src/tcl8.6b1/generic

configure成功。于是输入make,正式编译，结果又发现了如下错误：

exp_main_exp.c:32: error: ‘Tcl_Interp’ has no member named ‘result’
exp_main_exp.c:33: warning: incompatible implicit declaration of built-in function ‘exit’
make: *** [exp_main_exp.o] Error 1