解压cpio文件
cpio -idmv < filename.cpio
同样可以解压img文件:
cpio -idmv < filename.img
cpio 备份命令
备份:cpio -covB > [file|device] 将数据备份到文件或设备上
还原:cpio -icduv < [file|device} 将数据还原到系统中
常用参数:
-o :将数据copy到文件或设备上
-i :将数据从文件或设备上还原到系统中
-t :查看cpio建立的文件或设备内容
-c :一种比较新的portable format方式存储
-v :在屏幕上显示备份过程中的文件名
-B :让预设的blocks可以增加到5120bytes,默认是512bytes,这样可以使备份速度加快
-d :自动建立目录,这样还原时才不会出现找不到路径的问题
-u :更新,用较新的文件覆盖旧的文件
cpio常与find 配合使用
Linux版的Adobe Reader的启动速度太慢了,每次打开pdf文档的时候都不得不通过右键来选择使用Fedora自带的阅读器,有点麻烦,因此打算把它删除。我的Adobe Reader是通过AdobeReader.bin来安装的,尝试了yum remove acroread和rpm -e acroread都无效,很是郁闷。连Add/Remove Software都找不到该package,因此也不能通过这种方法删除了。
花了很长时间在这个网页上(http://ubuntuforums.org/showthread.php?t=1409179)看到的解决方法:
/opt/Adobe/Reader9/bin下有一个UNINSTALL 脚本,只要使用root帐号执行./UNINSTALL就可以了。
原文地址:http://it.toolbox.com/wiki/index.php/List_of_Solaris_commands_for_process_management
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不能用rpm安装了,安装时总是缺这少那,很是费劲,于是按照网上的方法,在/etc/yum.repos.d/下创建一个chromium.repo,内容如下:
[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'
实在是太粗心了,当时竟然没有仔细看…… 谨记这一教训!
http://androidappdocs.appspot.com/index.html
http://dl.google.com/android/android-sdk-windows-1.6_r1.zip
Windows: 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
Linux (i386): http://dl.google.com/android/android-sdk-linux_x86-1.6_r1.tgz
ADT Plugin for Eclipse 0.9.3: http://dl.google.com/android/ADT-0.9.3.zip
ophone develop :http://www.ophonesdn.com/
http://blog.csdn.net/vagrxie/archive/2009/08/04/4409464.aspx
android developer: http://www.anddev.org/
sdkman.force.http=true
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.
完成上面的步骤之后,Google App Engine和 Web Toolkit插件就被安装到了Eclipse。此时你仍然需要按照http://androidappdocs.appspot.com/sdk/eclipse-adt.html所陈述的步骤再安装ADT并配置SDK。
尽管Linux版Chrome浏览器还没有正式发布,Fedora早已官方支持Google的Chromium了。Fedora社区会定期build最新的稳定版Chromium,可以在http://spot.fedorapeople.org/chromium/下载到。当然也可以下载Google 每天build的二进制版Chromium,不过就是这些都不一定稳定:http://build.chromium.org/buildbot/snapshots/。
如果要安装Fedora社区的Chromium,需要下载v8, v8-devel和chromium,目前最新的版本是
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。
本文根据http://topic.csdn.net/u/20091026/10/0e913e37-e4a2-4504-bcc7-61af18a22dde.html?6487的回复总结而成。
1. 共享库
通常做成共享库的话,在编绎时加上-shared参数,并把链接生成的文件名命名libxxx.so,可以放在/usr/lib下
其他程序引用这个库时,在链接的时候加上-lxxx就可以了。
编辑好代码以后,编译时采用类似下面的命令可生成"共享库"(假如源文件是myfun.c):
gcc -shared -fPIC -Wmyfun.c -0 libmy.so
解释: -shared 生成共享库;
-fIPC 表示“位置无关代码”(Position Independent Code),可不加;
-W 表示输出警告信息,可不加;
库文件的命名要按照libxxxx.so的格式;
要引用这个库时:
gcc xxx.c -0 xxx.out -lmy
-l 表示设定要连接的库(libmy.so,输my便可)
2. 静态库
文件名:lib.c
先编译成目标文件 gcc -o mylib.o -c lib.c
然后创建静态库,将mylib.o放到libmylib.a中 ar rcs libmylib.a mylib.o
最后copy到库目录下/usr/lib cp libmylib.a /usr/lib/libmylib.a
在编写的时候直接调用其中的函数就是了,只不过在编译的时候要加入-l选项后面跟上库名
如 gcc -o test test.c -lmylib //mylib是前面创建的库的名称
3. 动态库
创建就是 gcc -fPIC -share -o mylib.so lib.c
调用也分两种方法
一种方法是 gcc -o test test.c ./libmylib.so (注意这里跟的是动态库的路径 )
第二种方法是使用动态库的函数 你man dlopen看下那几个函数看下就知道了就不多说了
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所能识别的操作符,因此在Tcl中使用Awk命令时不能用exec awk '/pattern/ {do_something}' file这种命令,即使在''前面加上/也不行。' ’ 可以被Bource Shell和其它shell识别,但是由于exec awk命令是在Tcl中解释的。
如果要在Tcl中执行awk命令,方法有两种:一是用“”代替' ',但是要考虑到需要把某些Tcl的特殊字符用/转义;二是用{}代替' '。比如语句
exec awk '/{print /"blah/"/}' temp.fil
应该写为:
exec awk "/somePattern/ {print /$0}" someFile
或者
exec awk {/somePattern/ {print $0}} someFile
$ 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.
后来查了Solaris的crontab的手册,发现Solaris的crontab不支持MAILTO,必须要用mailx之类的Unix邮件发送命令。另外,整个cron file只要一句话:minute(s) hour(s) day(s) month(s) weekday(s) command(s). 比如:
30 7 * * 1 /bld/xxxx/mytool/chkbjserver.sh|cat chkbjserver.out|mailx -s "Shared memory checked result in BJ COOL" xxxx@xxxxxxx.com
=========================================================================
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:
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:
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:
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:
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:
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.
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:
Notes for Step 1
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:
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