Linux中安全的`rm`方法


# add this to your ~/.bashrc file
trash()
{
for item in $@
do
mv $item /mnt/data/.RECYCLE/”`date ‘+%Y%m%d%H%M%S’`”-$item
done
}
alias del=’trash’

在终端下更新配置文件:

[root@localhost ~]# source ~/.bashrc

Advertisements

Difference between ${} and $() in bash


The syntax is token-level, so the meaning of the dollar sign depends on the token it’s in. The expression $(command) is a modern synonym for `command` which stands for process substitution; it means, run command and put its output here. So Continue reading “Difference between ${} and $() in bash”

NSS证书数据库管理工具


证书数据库工具是一个命令行实用程序,可以创建和修改Netscape Communicator cert8.db和key3.db数据库文件。 它还可以在cert8.db文件中列出,生成,修改或删除证书,并创建或更改密码,生成新的公钥和私钥对,显示密钥数据库的内容,或删除key3.db中的密钥对文件。密钥和证书管理过程通常开始于在密钥数据库中创建密钥,然后在证书数据库中生成和管理证书。 Continue reading “NSS证书数据库管理工具”

GCC中的环境变量LIBRARY_PATH和LD_LIBRARY_PATH


编译链接时的环境变量LIBRARY_PATH, LD_LIBRARY_PATH的官方说明:

LIBRARY_PATH

The value of LIBRARY_PATH is a colon-separated list of directories, much like PATH. When configured as a native compiler, GCC tries the directories thus specified when searching for special linker files, if it cannot find them using GCC_EXEC_PREFIX. Linking using GCC also uses these directories when searching for ordinary libraries for the -l option (but directories specified with -L come first).

LD_LIBRARY_PATH

A list of directories in which to search for ELF libraries at execution-time. The items in the list are separated by either colons or semicolons. Similar to the PATH environment variable. This variable is ignored in secure-execution mode.
Within the pathnames specified in LD_LIBRARY_PATH, the dynamic linker expands the tokens $ORIGIN, $LIB, and $PLATFORM (or the versions using curly braces around the names) as described above in Rpath token expansion. Thus, for example, the following would cause a library to be searched for in either the lib or lib64 subdirectory below the directory containing the program to be executed:
$ LD_LIBRARY_PATH='$ORIGIN/$LIB' prog
(Note the use of single quotes, which prevent expansion of $ORIGIN and $LIB as shell variables!)

Continue reading “GCC中的环境变量LIBRARY_PATH和LD_LIBRARY_PATH”