Profilo di Liang小猪和小狗从此过上了幸福的生活FotoBlogElenchi Strumenti Guida
01 giugno

6.1 牛牛节日快乐!

牛牛小东西的第一个儿童节,祝节日快乐,健康成长!
07 gennaio

盘点2007 (1) 关于工作

向来是反射弧超长的那类人,当所有人都开始展望2008的时候,我的2007似乎还没有过去,对着*.log.2008-01-07的无奈,不得不开始盘点2007
 
1)工作篇
丰收?歉收? 成功? 失败? 都是他妈的扯淡。工作的人说什么成功失败,不过是工作罢了。总想总结自己这一年学会了什么,学会了php,学会了java,可以玩转oracle,mysql, 各种各样的程序写了一个又一个,不眠不休的工作忙了一天又一天,真想骄傲的对自己说,真充实阿,学会了这么多东西?真的吗?扯淡,自己骗自己罢了,在这个技术狂飙的时代,这些东西只能让你做一块更合格的砖而已。 不过牢骚归牢骚,值得肯定的是,终于完成了从学生到民工的心理转变,明白什么是工作,即使有些事情一点也不感兴趣,也要装做自己很喜欢,努力的去做,直到最后自己都以为自己真的喜欢上它,不能不说是一种进步。耐得住寂寞,学会快乐,有她的鼓励,坚忍许多。好多人都喜欢说快乐的工作,学习这一点,花了一年,有点儿长,总算值得。
 
岁末年终,开始学习管理,还没有完全适应这种忙于协调和调研的工作方式,但终归是一种新的生活方式,更新奇也更刺激,看着outlook上一堆堆的未完成任务。显然,一切才刚刚开始。
 
题外话:听说,视频死了,死于2007岁末,比起夭折于2006的无线,这种狂舞于生命最灿烂一瞬的死亡,来得更加突然。有点儿冷,或许唇亡齿寒,或许遗憾没能在旋舞的最后疯狂中分一杯羹。机会稍纵即逝,我能抓住的,能有几个?
 
2007,什么也没有学到,只是学会了工作。2008呢?
06 gennaio

Linux Commands

zz from http://www.linuxguide.it/linux_commands_line_en.htm

 

COMMAND DESCRIPTION
 
System information
arch show architecture of machine
uname -r show used kernel version
dmidecode -q show hardware system components - (SMBIOS / DMI)
hdaparm -i /dev/hda displays the characteristics of a hard-disk
hdparm -tT /dev/sda perform test reading on a hard-disk
cat /proc/cpuinfo show information CPU info
cat /proc/interrupts show interrupts
cat /proc/meminfo verify memory use
cat /proc/swaps show file(s) swap
cat /proc/version show version of the kernel
cat /proc/net/dev show network adpters and statistics
cat /proc/mounts show mounted file system(s)
lspci -tv display PCI devices
lsusb -tv show USB devices
date show system date
cal 2007 show the timetable of 2007
date 041217002007.00  set date and time - MonthDayhoursMinutesYear.Secondi
clock -w
save changes on BIOS
linux commands line v1.0 - LinuxGuide.it
Shutdown, Restart of a system and Logout
shutdown -h now shutdown system
init 0
shutdown -r hours:minutes & planned shutdown of the system
shutdown -c cancel a planned shutdown of the system
shutdown -r now reboot
reboot
logout leaving session
linux commands line v1.0 - LinuxGuide.it
Files and Directory
cd /home enter to directory '/ home'
cd .. go back one level
cd ../.. go back two levels
cd go to home directory
cd ~utente go to home directory
cd - go to previous directory
pwd show the path of work directory
ls view files of directory
ls -F view files of directory
ls -l show details of files and directory
ls -a show hidden files
ls *[0-9]* show files and directory containing numbers
lstree show files and directories in a tree starting from root
mkdir dir1 create a directory called 'dir1'
mkdir dir1 dir2 create two directories simultaneously
mkdir -p /tmp/dir1/dir2 create a directory tree
rm -f file1 delete file called 'file1'
rmdir dir1 delete directory called 'dir1'
rm -rf dir1 remove a directory called 'dir1' and contents recursively
rm -rf dir1 dir2 remove two directories and their contents recursively
mv dir1 new_dir rename / move a file or directory
cp file1 file2 copying a file
cp dir/* . copy all files of a directory within the current work directory
cp -a /tmp/dir1 . copy a directory within the current work directory
cp -a dir1 dir2 copy a directory
ln -s file1 lnk1  create a symbolic link to file or directory
ln file1 lnk1 create a physical link to file or directory
touch -t 0712250000 fileditest modify timestamp of a file or directory - (YYMMDDhhmm)
linux commands line v1.0 - LinuxGuide.it
File search
find / -name file1 search file and directory into root filesystem from '/'
find / -user user1 search files and directories belonging to 'user1'
find /home/user1 -name *.bin search files with '. bin' extension within directory '/ home/user1' 
find /usr/bin -type f -atime +100 search bynary files are not used in the last 100 days
find /usr/bin -type f -mtime -10 search files created or changed within 10 days
find / -name *.rpm -exec chmod 755 {} ; search files with '.rpm' extension and modify permits
find / -name *.rpm -xdev search files with  '.rpm' extension ignoring removable partitions as cdrom, pen-drive, etc.…
locate *.ps find files with the '.ps' extension - first run 'updatedb' command
whereis halt show location of a binary file, source or man
which halt show full path to a binary / executable
linux commands line v1.0 - LinuxGuide.it
Mounting a Filesystem
mount /dev/hda2 /mnt/hda2 mount disk called hda2 - verify existence of the directory '/ mnt/hda2'
umount /dev/hda2 unmount disk called hda2 - exit from mount point '/ mnt/hda2' first
fuser -km /mnt/hda2 force umount when the device is busy
umount -n /mnt/hda2 run umount without writing the file /etc/mtab - useful when the file is read-only or the hard disk is full
mount /dev/fd0 /mnt/floppy mount a floppy disk
mount /dev/cdrom /mnt/cdrom mount a cdrom / dvdrom
mount /dev/hdc /mnt/cdrecorder mount a cdrw / dvdrom
mount /dev/hdb /mnt/cdrecorder mount a cdrw / dvdrom
mount -o loop file.iso /mnt/cdrom mount a file or iso image
mount -t vfat /dev/hda5 /mnt/hda5 mount a Windows FAT32 file system
mount /dev/sda1 /mnt/usbdisk mount a usb pen-drive or flash-drive
mount -t smbfs -o username=user,password=pass //winclient/share /mnt/share mount a windows network share
linux commands line v1.0 - LinuxGuide.it
Disk Space
df -h show list of partitions mounted
ls -lSr |more show size of the files and directories ordered by size
du -sh dir1 estimate space used by directory 'dir1'
du -sh * | sort -rn  show size of the files and directories sorted by size
rpm -q -a --qf '%10{SIZE}\t%{NAME}\n' | sort -k1,1n show space used by rpm packages installed sorted by size (fedora, redhat and like)
dpkg-query -W -f='${Installed-Size;10}\t${Package}\n' | sort -k1,1n show space used by deb packages installed sorted by size (ubuntu, debian and like)
linux commands line v1.0 - LinuxGuide.it
Users and Groups
groupadd group_name create a new group
groupdel group_name delete a group
groupmod -n new_group_name old_group_name rename a group
useradd -c "Nome Cognome" -g admin -d /home/user1 -s /bin/bash user1 create a new user belongs "admin" group
useradd user1 create a new user
userdel -r user1 delete a user ( '-r' eliminates home directory)
usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1 change user attributes
passwd change password
passwd user1 change a user password (only by root)
chage -E 2005-12-31 user1 set deadline for user password
pwck check correct syntax and file format of '/etc/passwd'  and users existence
grpck check correct syntax and file format of '/etc/group'  and groups existence
newgrp group_name log in to a new group to change default group of newly created files
linux commands line v1.0 - LinuxGuide.it
Permits on File - use "+" to set permissions and "-" to remove
ls -lh show permits
ls /tmp | pr -T5 -W$COLUMNS divide terminal into 5 columns
chmod ugo+rwx directory1 set permissions reading (r), write (w) and (x) access to users owner (u) group (g) and others (o)
chmod go-rwx directory1 remove permits reading (r), write (w) and (x) access to users group (g) and others (or
chown user1 file1 change owner of a file
chown user1 -R directory1 change user owner of a directory and all the files and directories contained inside
chgrp gruppo1 file1 change group of files
chown user1:gruppo1 file1 change user and group ownership of a file
find / -perm -u+s view all files on the system with SUID configured
chmod u+s /bin/file_eseguibile set SUID bit on a binary file - the user that running that file gets same privileges as owner
chmod u-s /bin/file_binario disable SUID bit on a binary file
chmod g+s /home/public set SGID bit on a directory - similar to SUID but for directory
chmod g-s /home/public disable SGID bit on a directory
chmod o+t /home/comune set STIKY bit on a directory - allows files deletion only to legitimate owners
chmod o-t /home/comune disable STIKY bit on a directory
linux commands line v1.0 - LinuxGuide.it
Special Attributes on file - use "+" to set permissions and "-" to remove
chattr +a file1 allows write opening of a file only append mode
chattr +c file1 allows that a file is compressed / decompressed automatically by the kernel
chattr +d file1 makes sure that the program ignores Dump the files during backup
chattr +i file1 makes it an immutable file, which can not be removed, altered, renamed or linked
chattr +s file1 allows a file to be deleted safely
chattr +S  file1 makes sure that if a file is modified changes are written in synchronous mode as with sync
chattr +u file1 allows you to recover the contents of a file even if it is canceled
lsattr show specials attributes
linux commands line v1.0 - LinuxGuide.it
Archives and compressed files
bunzip2 file1.bz2 decompress a file called 'file1.bz2'
bzip2 file1 compress a file called 'file1'
gunzip file1.gz decompress a file called 'file1.gz'
gzip file1 compress a file called 'file1'
gzip -9 file1 compress with maximum compression
rar a file1.rar test_file create an archive rar called 'file1.rar'
rar a file1.rar file1 file2 dir1 compress 'file1', 'file2' and 'dir1' simultaneously
rar x file1.rar decompress rar archive
unrar x file1.rar decompress rar archive
tar -cvf archive.tar file1 create a uncompressed tarball
tar -cvf archive.tar file1 file2 dir1 create an archive containing 'file1', 'file2' and 'dir1'
tar -tf archive.tar show contents of an archive
tar -xvf archive.tar extract a tarball
tar -xvf archive.tar -C /tmp extract a tarball into / tmp
tar -cvfj archive.tar.bz2 dir1 create a tarball compressed into bzip2
tar -xvfj archive.tar.bz2 decompress a compressed tar archive in bzip2
tar -cvfz archive.tar.gz dir1 create a tarball compressed into gzip
tar -xvfz archive.tar.gz decompress a compressed tar archive in gzip
zip file1.zip file1 create an archive compressed in zip
zip -r file1.zip file1 file2 dir1 compress in zip several files and directories simultaneously
unzip file1.zip decompress a zip archive
linux commands line v1.0 - LinuxGuide.it
RPM Packages - Fedora, Red Hat and like
rpm -ivh package.rpm install a rpm package
rpm -ivh --nodeeps package.rpm install a rpm package ignoring dependencies requests
rpm -U package.rpm upgrade a rpm package without changing configuration files
rpm -F package.rpm upgrade a rpm package only if it is already installed
rpm -e package_name.rpm remove a rpm package
rpm -qa show all rpm packages installed on the system
rpm -qa | grep httpd show all rpm packages with the name "httpd"
rpm -qi package_name obtain information on a specific package installed
rpm -qg "System Environment/Daemons" show rpm packages of a group software
rpm -ql package_name show list of files provided by a rpm package installed
rpm -qc package_name show list of configuration files provided by a rpm package installed
rpm -q package_name --whatrequires show list of dependencies required for a rpm packet
rpm -q package_name --whatprovides show capability provided by a rpm package
rpm -q package_name --scripts show scripts started during installation / removal
rpm -q package_name --changelog show history of revisions of a rpm package
rpm -qf /etc/httpd/conf/httpd.conf verify which rpm package belongs to a given file
rpm -qp package.rpm  -l show list of files provided by a rpm package not yet installed
rpm --import /media/cdrom/RPM-GPG-KEY import public-key digital signature
rpm --checksig package.rpm verify the integrity of a rpm package
rpm -qa gpg-pubkey verify integrity of all rpm packages installed
rpm -V package_name check file size, permissions, type, owner, group, MD5 checksum and last modification
rpm -Va check all rpm packages installed on the system - use with caution
rpm -Vp package.rpm verify a rpm package not yet installed
rpm2cpio package.rpm | cpio --extract --make-directories  *bin* extract executable file from a rpm package
rpm -ivh /usr/src/redhat/RPMS/`arch`/package.rpm install a package built from a rpm source
rpmbuild --rebuild package_name.src.rpm build a rpm package from a rpm source
linux commands line v1.0 - LinuxGuide.it
YUM packages updater - Fedora, RedHat and like
yum install package_name download and install a rpm package
yum update update all rpm packages installed on the system
yum update package_name upgrade a rpm package
yum remove package_name remove a rpm package
yum list list all packages installed on the system
yum search package_name find a package on rpm repository
yum clean packages clean up rpm cache erasing downloaded packages
yum clean headers remove all files headers that the system uses to resolve dependency
yum clean all remove from the cache packages and headers files
linux commands line v1.0 - LinuxGuide.it
DEB packages - Debian, Ubuntu and like
dpkg -i package.deb install / upgrade a deb package
dpkg -r package_name remove a deb package from the system
dpkg -l show all deb packages installed on the system
dpkg -l | grep httpd show all rpm packages with the name "httpd"
dpkg -s package_name obtain information on a specific package installed on system
dpkg -L package_name show list of files provided by a package installed on system
dpkg --contents package.deb show list of files provided by a package not yet installed
dpkg -S /bin/ping verify which package belongs to a given file
linux commands line v1.0 - LinuxGuide.it
APT packages updater - Debian, Ubuntu e like
apt-get install package_name install / upgrade a deb package
apt-cdrom install package_name install / upgrade a deb package from cdrom
apt-get update update all deb packages installed on system
apt-get remove package_name remove a deb package from system
apt-get check verify correct resolution of dependencies
apt-get clean clean up cache from packages downloaded
linux commands line v1.0 - LinuxGuide.it
View file content
cat file1 view the contents of a file starting from the first row
tac file1 view the contents of a file starting from the last line
more file1 view content of a file along
less file1 similar to 'more' command but which allows backward movement in the file as well as forward movement
head -2 file1 view first two lines of a file
tail -2 file1 view last two lines of a file
tail -f /var/log/messages view in real time what is added to a file
linux commands line v1.0 - LinuxGuide.it
Text Manipulation
cat file_test | [operation: sed, grep, awk, grep, etc] > result.txt syntax to elaborate the text of a file, and write result to a new file
cat file_originale | [operazione: sed, grep, awk, grep, etc] >> result.txt syntax to elaborate the text of a file and append result in existing file
grep Aug /var/log/messages look up words "Aug" on file '/var/log/messages'
grep ^Aug /var/log/messages look up words that begin with "Aug" on file '/var/log/messages'
grep [0-9] /var/log/messages select from file '/var/log/messages' all lines that contain numbers
grep Aug -R /var/log/* search string "Aug" at directory '/var/log' and below
grep Aug /var/log/messages write result of a search within a file
sed 's/stringa1/stringa2/g' example.txt replace "string1" with "string2" in example.txt
sed '/^$/d' example.txt remove all blank lines from example.txt
sed '/ *#/d; /^ *$/d' example.txt remove comments and blank lines from example.txt
echo 'esempio' | tr '[:lower:]' '[:upper:]' convert from lower case in upper case
sed -e '1d' result.txt eliminates the first line from file example.txt
sed -n '/stringa1/p' view only lines that contain the word "string1"
sed -e 's/ *$//' example.txt remove empty characters at the end of each row
sed -e 's/stringa1//g' example.txt remove only the word "string1" from text and leave intact all
sed -n '1,5p;5q' example.txt view from 1th to 5th row
sed -n '5p;5q' example.txt view row number 5
sed -e 's/00*/0/g' example.txt replace more zeros with a single zero
cat -n file1 number row of a file
cat example.txt | awk 'NR%2==1' remove all even lines from example.txt
echo a b c | awk '{print $1}' view the first column of a line
echo a b c | awk '{print $1,$3}' view the first and third column of a line
paste file1 file2 merging contents of two files for columns
paste  -d  '+' file1 file2 merging contents of two files for columns with '+' delimiter on the center
sort file1 file2 sort contents of two files
sort file1 file2 | uniq sort contents of two files omitting lines repeated
sort file1 file2 | uniq -u sort contents of two files by viewing only unique line
sort file1 file2 | uniq -d sort contents of two files by viewing only duplicate line
comm -1 file1 file2 compare contents of two files by deleting only unique lines from 'file1'
comm -2 file1 file2 compare contents of two files by deleting only unique lines from 'file2'
comm -3 file1 file2 compare contents of two files by deleting only the lines that appear on both files
linux commands line v1.0 - LinuxGuide.it
Character set and Format file conversion
dos2unix filedos.txt fileunix.txt convert a text file format from MSDOS to UNIX
unix2dos fileunix.txt filedos.txt convert a text file format from UNIX to MSDOS
recode ..HTML < page.txt > page.html convert a text file to html
recode -l | more show all available formats conversion
linux commands line v1.0 - LinuxGuide.it
Filesystem Analysis
badblocks  -v  /dev/hda1 check bad blocks in disk hda1
fsck  /dev/hda1 repair / check integrity of linux filesystem on disk hda1
fsck.ext2  /dev/hda1 repair / check integrity of ext2 filesystem on disk hda1
e2fsck  /dev/hda1 repair / check integrity of ext2 filesystem on disk hda1
e2fsck -j /dev/hda1 repair / check integrity of ext3 filesystem on disk hda1
fsck.ext3  /dev/hda1 repair / check integrity of ext3 filesystem on disk hda1
fsck.vfat  /dev/hda1 repair / check integrity of fat filesystem on disk hda1
fsck.msdos  /dev/hda1 repair / check integrity of dos filesystem on disk hda1
dosfsck  /dev/hda1 repair / check integrity of dos filesystems on disk hda1
linux commands line v1.0 - LinuxGuide.it
Format a Filesystem
mkfs /dev/hda1 create a filesystem type linux on hda1 partition
mke2fs /dev/hda1 create a filesystem type linux ext2 on hda1 partition
mke2fs -j /dev/hda1 create a filesystem type linux ext3 (journal) on hda1 partition
mkfs -t vfat 32 -F /dev/hda1 create a FAT32 filesystem
fdformat  -n /dev/fd0 format a floppy disk
mkswap /dev/hda3 create a swap filesystem
linux commands line v1.0 - LinuxGuide.it
SWAP filesystem
mkswap /dev/hda3 create a swap filesystem
swapon /dev/hda3 activating a new swap partition
swapon /dev/hda2 /dev/hdb3  activate two swap partitions
linux commands line v1.0 - LinuxGuide.it
Backup
dump -0aj -f /tmp/home0.bak /home  make a full backup of directory '/home'
dump -1aj -f /tmp/home0.bak /home  make a incremental backup of directory '/home'
restore -if /tmp/home0.bak restoring a backup interactively
rsync -rogpav --delete /home /tmp synchronization between directories
rsync -rogpav -e ssh --delete /home ip_address:/tmp  rsync via SSH tunnel
rsync -az -e ssh --delete ip_addr:/home/public /home/local synchronize a local directory with a remote directory via ssh and compression
rsync -az -e ssh --delete /home/local ip_addr:/home/public synchronize a remote directory with a local directory via ssh and compression
dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr 'dd of=hda.gz' make a backup of a local hard disk on remote host via ssh
tar -Puf backup.tar /home/user make a incremental backup of directory '/home/user'
( cd /tmp/local/ && tar c . ) | ssh -C user@ip_addr 'cd /home/share/ && tar x -p' copy content of a directory on remote directory via ssh
( tar c /home ) | ssh -C user@ip_addr 'cd /home/backup-home && tar x -p'  copy a local directory on remote directory via ssh
tar cf - . | (cd /tmp/backup ; tar xf - ) local copy preserving permits and links from a directory to another
find /home/user1 -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parents find and copy all files with '.txt' extention from a directory to another
find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > log.tar.bz2 find all files with '.log' extention and make an bzip archive
dd if=/dev/hda of=/dev/fd0 bs=512 count=1 make a copy of MBR (Master Boot Record) to floppy
dd if=/dev/fd0 of=/dev/hda bs=512 count=1 restore MBR from backup copy saved to floppy
linux commands line v1.0 - LinuxGuide.it
CDROM
cdrecord -v gracetime=2 dev=/dev/cdrom -eject blank=fast -force clean a rewritable cdrom
mkisofs /dev/cdrom > cd.iso create an iso image of cdrom on disk
mkisofs /dev/cdrom | gzip > cd_iso.gz create a compressed iso image of cdrom on disk
mkisofs -J -allow-leading-dots -R -V "Label CD" -iso-level 4 -o ./cd.iso data_cd create an iso image of a directory
cdrecord -v dev=/dev/cdrom cd.iso burn an ISO image
gzip -dc cd_iso.gz | cdrecord dev=/dev/cdrom - burn a compressed ISO image
mount -o loop cd.iso /mnt/iso mount an ISO image
cd-paranoia -B rip audio tracks from a CD to wav files
cd-paranoia -- "-3" rip first three audio tracks from a CD to wav files
cdrecord --scanbus scan bus to identify the channel scsi
linux commands line v1.0 - LinuxGuide.it
Networking - LAN and WiFi
ifconfig eth0 show configuration of an ethernet network card
ifup eth0 activate an interface 'eth0'
ifdown eth0 disable an interface 'eth0'
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 configure IP Address
ifconfig eth0 promisc configure 'eth0' in promiscuous mode to gather packets (sniffing)
dhclient eth0 active interface 'eth0' in dhcp mode
route -n show routing table
route add -net 0/0 gw IP_Gateway configura default gateway
route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1 configure static route to reach network '192.168.0.0/16'
route del 0/0 gw IP_gateway remove static route
echo "1" > /proc/sys/net/ipv4/ip_forward activate ip routing
hostname show hostname
host www.linuxguide.it lookup hostname to resolve name to ip address and viceversa
ip link show show link status of all interfaces
mii-tool eth0 show link status of 'eth0'
ethtool eth0 show statistics of network card 'eth0'
netstat -tup show all active network connections and their PID
netstat -tupl show all network services listening on the system and their PID
tcpdump tcp port 80 show all HTTP traffic
iwlist scan show wireless networks
iwconfig eth1 show configuration of a wireless network card
linux commands line v1.0 - LinuxGuide.it
Microsoft Windows networks - SAMBA
nbtscan ip_addr netbios name resolution
nmblookup -A ip_addr netbios name resolution
smbclient -L ip_addr/hostname show remote shares of a windows host
smbget -Rr smb://ip_addr/share like wget can download files from a host windows via smb
mount -t smbfs -o username=user,password=pass //winclient/share /mnt/share mount a windows network share
linux commands line v1.0 - LinuxGuide.it
IPTABLES - firewall
iptables -t filter -L show all chains of filtering table
iptables -t nat -L show all chains of nat table
iptables -t filter -F clear all rules from filtering table
iptables -t nat -F clear all rules from table nat
iptables -t filter -X delete any chains created by user
iptables -t filter -A INPUT -p tcp --dport telnet -j ACCEPT allow telnet connections to input
iptables -t filter -A OUTPUT -p tcp --dport http -j DROP block HTTP connections to output
iptables -t filter -A FORWARD -p tcp --dport pop3 -j ACCEPT allow POP3 connections to forward chain
iptables -t filter -A INPUT -j LOG --log-prefix "DROP INPUT" logging sulla chain di input  Logging on chain input
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE configure a PAT (Port Address Traslation) on eth0 masking outbound packets
iptables -t nat -A PREROUTING -d 192.168.0.1 -p tcp -m tcp --dport 22 -j DNAT --to-destination 10.0.0.2:22 redirect packets addressed to a host to another host
linux commands line v1.0 - LinuxGuide.it
Monitoring and debugging
top display linux tasks using most cpu
ps -eafw displays linux tasks
ps -e -o pid,args --forest displays linux tasks in a hierarchical mode
pstree  mostra un albero dei processi sistema Shows a tree system processes
kill -9 ID_Processo force closure of the process and finish it
kill -1 ID_Processo force a process to reload configuration
lsof -p $$ display a list of files opened by processes
lsof /home/user1 displays a list of open files in a given path system
strace -c ls >/dev/null display system calls made and received by a process
strace -f -e open ls >/dev/null display library calls
watch -n1 'cat /proc/interrupts' display interrupts in real-time
last reboot show history reboot
lsmod display kernel loaded
free -m displays status of RAM in megabytes
smartctl -A /dev/hda monitoring reliability of a hard-disk through SMART
smartctl -i /dev/hda check if SMART is active on a hard-disk
tail /var/log/dmesg show events inherent to the process of booting kernel
tail /var/log/messages show system events
linux commands line v1.0 - LinuxGuide.it
Other useful commands
mkbootdisk --device /dev/fd0 `uname -r` create a boot floppy
gpg -c file1 encrypt a file with GNU Privacy Guard
gpg file1.gpg decrypt a file with GNU Privacy Guard
wget -r www.example.com download an entire web site
wget -c www.example.com/file.iso download a file with the ability to stop the download and resume later
echo 'wget -c www.example.com/files.iso' | at 09:00 start a download at any given time
ldd ssh show shared libraries required by ssh program
alias hh='history' set an alias for a command - hh = history
 
24 dicembre

又是一年德比日

又是先进一球,又是被反超,和半年前那场如出一辙
控制足球已经变成了散步足球,没有奔跑的能力,拿什么去和人争
或许真是目送这些老古董们走出圣西罗的时候了
苦不苦,想想96和95,自我解嘲一番,觉终归还是要睡的
洗洗睡了吧
 
 
02 giugno

测试邮件发送博客

嗯,可以同时发几个博客了,不错不错

08 maggio

准备转blogger了

最近打开msn space总是很慢,有时候干脆打不开,郁闷,准备在blogger上开一个新博了,
有时间就同步更新这里,没时间还是以那里为主了, 欢迎各位好友光临:)~
 
忽然想到,按照好友名单分类整理blog或许是个不错的功能,谁有类似的软件没有? colin的那个博鸽是不是可以?
03 aprile

没有愚人的愚人节

又是一年愚人节,除了被她小小的欺骗了一下,没有骗人,也没有被骗,出乎意料的平静,静到有点冷。圈子一点点的改变,直到一点触发,才惊觉物是人非,怅然。
 
周末去看了张国荣的纪念专场,纵横四海+霸王别姬。拷贝的质量很差,但是毕竟能在电影院中重温昔日的经典,已属难得,还强求什么呢?如老婆所说,张是一个漂亮的男人,特别是和发哥演对手戏的时候,才让你直到帅和漂亮是多么不同的两个词。而霸王别姬中的他已经彻底入魔,段小楼说程蝶衣:不疯魔,不成佛。程蝶衣可以说已经和虞姬这个角色契合到了极点,所谓人戏不分的境界。而张之于程,似乎也有几分这样的意味。很多人都感慨,人生如戏,那么在哪幕戏中演主角,似乎并不是十分重要。
 
最近压力很大,以致于常常走神,失眠也渐渐不期而至。希望能找个机会出去放松一下,住在紫竹院附近,却一直没能进去转转,但愿这个星期能够成行。
19 marzo

新的一周

又一个周末过去了,本打算好好休息一下,结果发现事情很多,只能马不停蹄的加班,终究还是没能出去走走。
 
家里dvd机坏了很久,拆开两次,试图修一下,未果。周末终于痛下决心,去苏宁抱了一个新的步步高回来。冲动往往没有好结果,新的dvd迅速抢占了本属于PS2的YPbPr接口,俺的生化危机只能去找可怜的av接口,模模糊糊,戚戚惨惨,倒是很符合画面要表现的感觉。昨天晚上第二次生化危机再次通关,这次总时间提高了到了13个小时,可是看到人家攻略上提到的2小时40分,汗颜。
 
新的一周,开始新的努力。在公司工作应该更积极一点儿,主动一点儿,总是等待不是好事。帮冯师兄弄的东西已经有了眉目,回头给他整理一下代码。VC版有太多文章没有整理了,今天晚上好像应该过去清理一下,既然做了这个版主,怎么也要负责一点儿的:) 想来事情还是蛮多的,加油啊加油! 立此存照,免得自己又忘了。
15 marzo

今天是315

和老婆一起看了中央台的315晚会,里面揭露的侵权事件,件件让人寒心。想起前日看到Teddy的博客中对千百年来勾心斗角的厌恶,忽然觉得自己也对这个充满尔虞我诈的世界悲观起来。继续和老婆讨论所谓的80后的问题,我们几乎是没有信仰的一代人,这很可悲。在这片精神的废墟上成长,注定性格上的脆弱和内心的寂寞,拜金,叛逆,摇摆不定,不过是表现形势而已。
 
感慨归感慨,坚强还是要自己慢慢学会,没有的信仰也要自己去找。
 
今天终于搞定了database的均衡问题,心情相当不错,明天做一点儿优化工作,整理一下文档,这个项目基本上就收工了:)
 
 
14 marzo

泡面的味道

她去参加同事生日报告,未归。
 
在公司完满的解决了session跨域的问题,看看手机,已然8点多了。带着家里寄来的包裹,匆匆的赶着回家。路上听着出租车上无聊的广播节目,总是纳闷,为什么会有那么多人发短信参与呢?人最害怕的终归是无聊二字。望着窗外熟悉的景物,忽然会有一种陌生的感觉,仿佛自己是第一次来到这座城市。日复一日,单调的节奏下,锐气慢慢消退,压力却从不曾减少。梦里惊醒的次数日渐增多,转日却不再记得缘由。透支未来,对自信者是一种激励,对怯懦者是一种折磨,于我,二者兼有。
 
乐乐仿佛知道它今天会有一条新的领带,所以迫不急待的把旧的一条弄脏,顺带送我满手的腥臊气。在没有灯光的楼道里,不慎踩到它受过伤的脚,发出一声嘶叫,一腔怒气化为乌有。毕竟,三角形是最稳定的结构,这个家,因为它的存在,少了很多针锋相对,多了许多的和谐。也许是我对它太凶,即使现在家里只有我们两个,它仍然傻傻的趴在外间门旁,等候她的归来。她说我将来亲子关系会很成问题,我也渐渐开始担心起来。
 
在学校的时候我是宿舍里最喜吃泡面的,每次熄灯后,总要吃碗泡面,才肯睡去。还常常诱惑江表,小木一起过这种极度不健康的生活方式。结婚之后似乎再也没有吃过正儿八经的泡面,即使吃方便面,也是她动手煮的。难得今天有机会自己用最简单的方式泡一碗,康师傅,红烧牛肉,几乎是最经典的方便面。味道依旧,却没有了当初的食欲,胃已经习惯了她的手艺,经不起我粗糙的折磨,抗议不止。时光入水,改变又岂只是我的胃?
 
和师弟抱怨了一阵生活的压力,忽然觉得轻松很多。很多时候,压力客观摆在那里,你总是躲躲闪闪,不敢正视它。而一旦坦然面对,就会发现,担心也不会让它减少分毫,不如切实走好脚下的路。有时候想想,自己还是太幼稚,但能够坦然的面对生活,谁又能时时刻刻的做到呢?
 
希望明天能够搞定database的均衡!
 
 
13 marzo

熬夜加班

凌晨1点,刚刚赶好明天要交给老大的一份报告,疲惫的身体却无法催眠毫无睡意的大脑。昨天看生死搭档,何冰说,一个人到了年纪,睡觉也是很奢侈的一件事情,不知道我将来是不是也会这样。
 
周六终于打穿了生化危机4,可恨的盗版盘在最后的关键时刻频繁重启,气恼中,几乎将手柄摔烂。结婚大半年,脾气似乎好了很多,不在与人争辩,也很少愤青,最多在打游戏的时候对自己发发脾气,当作解闷。看小说,看到双眼充斥着血丝,打游戏,打到拇指上长出水泡,磨出老茧。最后,还得无聊二字。计划中的很多事情还都没有做,2007的第一季已经渐进尾声。前日,m说要开始学车,开始准备买房了;江表房子已经弄好,住进了北苑;徐璐更是当上了爹,每日在换洗尿布中学习人生的真谛。每个人都有自己的路,也都在努力的走着,很好。
 
上周去上海,本来计划去看看godsix和rongy,结果人算不如天算,没能成行,又是一桩遗憾。最近情绪颇为低落,不知为何,开玩笑说,其实自己蛮有文学青年的天赋,伤春悲秋。同样的境遇有时让人感到绝望,而有时却能让人发狂。对此,她似乎也有所察觉,又生出些许误会,于心不忍,却不知该如何解释,其实不过是一段低潮罢了,活着总是这样,有波峰就有波谷,就像female的生理期一样。潜龙在渊,蓄而不发,仔细思考未来的路,虽然依旧毫无头绪,总好过胡打乱闯。
 
春天来了,或许该是出去锻炼的时候了,中午吃饭时,偶尔翻钱包,发现一张浩沙的健身卡,似乎很久没有去光顾了。苦笑的看看满身的赘肉,又一次下定决心,减肥。
 
看着房间里甜甜睡去的她和它,忽然觉得自己的路也不是那么难走。我也在努力的走,和她一起,想想,其实很好。
 
 
 
07 marzo

出差在上海

 
昨日中午接到通知,五个小时后已经在飞机上品尝没有鸡肉的鸡肉饭。偶尔认识了一个正在学汉语的美国哥们,侃得昏天黑地,尽管彼此都无法准确的理解对方,却也使乏味的旅途变得不那么单调。和一个新认识的同事住一个标准间,发现自己突然很喜欢聊天,或许是最近很少出来腐败的原因,好容易逮到机会,大侃特侃,凌晨两点才意犹未尽的去见周公,混不觉一日奔波的辛苦。
 
今天上海的天气还算不错,有点儿小风,但是太阳很好,从静安赶到张江,再折回人民广场,舟车劳顿中浪费了大半的时间和精力。洗手时忽然发现戒指遗忘在酒店,心中忐忑不安,精神恍惚。终于还是忍不住,告了假,回去找到戒指,方始心安。平时从来不带戒指出门,今天才发现,这枚戒指,依然是那么的珍贵。
 
据她说,乐乐很像我,脾气暴躁却性格温和,实在不明白这是怎样的矛盾统一。反正如果我是一只西施的话,那绝不会去招惹一只拉布拉多,爱情失败,身心俱伤,哈哈。
26 febbraio

热烈庆祝徐璐唐婧夫妇喜得贵子!

徐睿 八斤二两,我们宿舍的老大果然事事领先!祝小朋友茁壮成长:)
 

新年快乐

不知道是毕业的原因,还是成家的结果,这个春节突然特别想对所有的朋友们都说一声新年快乐
长大的人总喜欢怀旧,或许如老婆所说,我现在看起来像个小老头了,连心态也老了起来
连续的丢了两次手机,通讯录已经残缺不全,想尽方式给能看到的人一份祝福吧
祝我的所有朋友,猪年快乐,心想事成!
05 febbraio

一只执着的爱胡萝卜的聪明白兔 和 一只执着的爱胡萝卜的笨黑兔

1.
一只白兔去店里,问店主:请问有胡萝卜吗?
店主:没有.
第二天,白兔又去问店主:请问有胡萝卜吗?
店主:没有.
第三天,白兔又问:请问有胡萝卜吗?
店主怒答:没有没有!再来问有没有胡萝卜的话,我就用锤子把你牙敲掉!
白兔跑掉了.
第四天,白兔又跑来问:请问有锤子吗?
店主答:没有.
兔子紧接着问:那请问有胡萝卜吗……
 
这个故事告诉我们:
①永远不要忘记自己的初衷.
②永远不要回避达成目的的途中可能存在的危险与隐患.
③要明白即使解除了危机也未必一定可以达成目的.
 
2.
第五天,一只黑兔也来问店主:请问有胡萝卜吗?
店主:没有.
第六天,这只黑兔又问:请问有胡萝卜吗?
店主一言不发,回身去店里找了把榔头,敲掉了这只倒霉的黑兔的牙。
第七天,这只没了牙的黑兔捂着嘴巴来了,问道:请问有胡萝卜汁吗……

这个故事告诉我们:
①即使有人曾因此目的遭遇过不测,也值得亲身一试.
②要懂得前车可鉴,避免不必要的伤害.
③既然为此付出了惨重的代价,那就将自己的需求进行到底吧.
④既然固态的胡萝卜和液态的胡萝卜都是胡萝卜,成功不也是这样么?
17 dicembre

忙碌的一年

周末,m和yangf在家中做客,偶尔说起,才想到转眼下周又是一个圣诞,紧接着又是一个happy new year,不得不感慨时间过的太快,又是一年匆匆而过,转眼又是做一年总结的时候了。还没想好今天总结些什么,唯一的感觉就是忙碌,几乎没有时间用脑子来想自己是在做什么,只是不停的做一件又一件必须去做的事情,回头看来,原来做了这么多大事。买房,装修,毕业,结婚,工作,旅游......
 
许多事情开始变化,比如几乎不再看漫画,比如很少去踢球,比如看小说的时间越来越少,比如开始认真地考虑职业规划
许多事情依然没变,比如我的体重,比如享受美食的快乐,比如依然喜欢和一帮同学聚在一起,比如我对小猪的感觉
 
忙碌的一年很值得纪念,或许白发苍苍的时候回顾这一生,这是最有意义的一年,当然,也可能是被我遗忘的一年
 
花一点时间,去整理这一年,给自己一个交待。
 
06 dicembre

流氓软件

刚刚在msn的焦点消息上看到微软捅出来一个国内十大流氓软件,仔细一看,似乎除了HDTBar之外,偶都中过n次的说
现在的流氓软件的确做得比较讨厌,而且还有一帮无聊的人居然还把这些东西打成合集,到处传播,上次不小心中了一个61个
流氓软件的大合集,用了n种专杀工具才搞定的。
 
不过话说回来,流氓软件如何定义这个问题也比较难解决,前两天写了一个bho,让自己的ie个性化一点儿,结果朋友一装上就说我这个是病毒,是流氓软件原因很简单,bho嘛,不就是流氓软件咯。想想不由得一阵苦笑,bho本来是微软为了大家更方便的定制个人爱好的ie准备的编程接口结果现在却成了过街老鼠人人喊打,真是冤啊,比窦娥还冤。
 
很多好用的工具其实都是双刃剑,bho就是如此。用来定制自己的ie,添加自己需要的实用功能,非常方便,可是如果用到歪路上,就会让你苦不堪言。说到底,还是用自己的bho踏实,btw:刚刚又用safe360查了一遍,不知道什么时候又被baidu搜霸给流氓了,佩服!
 
/**********************************************************************/
 
 
微软昨公布中国十大流氓软件名单
◇字体:[大 中 小]  发表评论 来源:北京青年报(06/12/06 03:31) 
  本报讯 昨天,记者从在新西兰奥克兰举行的国际反病毒大会AVAR2006上获悉,美国微软公司安全研究响应小组正式发布了“亚太地区间谍软件的情况对比”报告,其中CNSMIN(3721)位居我国十大间谍软件的首位,而且其感染率也占整个间谍软件(“流氓软件”)的半数以上。
 
  微软公布的中国内地十大“流氓软件”排名如下:CNSMIN(3721)、CNNIC Chinese keywords(CNNIC关键字搜索)、Baidu.Sobar(百度搜霸)、Sogou(搜狗)、Baigoo(百狗)、DuduAccelerator(DUDU加速器)、Caishow(彩秀)、DMCast(桌面传媒)、HDTBar (一种网页工具条)、Real VNC(一种远程控制软件)。
05 dicembre

FLV Format

前面左子问AMF这个东西是干嘛的,说实话我也不知道Macromedia搞这么个东西干嘛......而且字节序还是little-endian的,读起来非常麻烦
上个星期看SWF的specification,这个星期看FLV的specification部分,发现FLASH开发组这帮人完全是在秀他们的设计能力,同时考验俺们这些读者的理解能力。(btw:从学校出来之后发现英语水平下降很快,sigh!)
 
flv文件的基本结构是
文件头 + tag1 + tag2 + ...tagN
 
文件头:
46 4c 56(FLV)+01(版本号)+05(tag类型标志位)+保留字节00+ 结束标记(00 00 09)+ 4个字节00 00 00 00
 
tag
tag类型(1字节,0x12为MetaData, 0x08为Audio,0x09为Video)+
tag大小三个字节 (搞不懂为啥一定要三个字节.....省空间也不是这么省的阿...) +
time stamp时间戳,三个字节(又一个三字节:()+
extend time stamp 扩展时间戳 一个字节 +
stream id 00 00 00不知道啥意思...+
tag内容
 
MetaTag内容
就是一个AMF包,用上面提到的AMFReader读取即可,很多文件都缺这个东西
 
AudioTag内容
1个字节的Audio标志(8个标志位居然都用上了...) + 具体音频数据
 
VideoTag内容
1个字节的Video标志(4bit桢类型,ft,微软拼音居然没有巾贞字,4bit编码类型)+视频数据
 
基本上就是这些东西了
 

AMF Reader

应左子要求,贴今天新写的一个AMF Reader用的头定义
本部分程序根据sourceforge上的soledit中的AMF模块修改
 
// Class automatically generated by Dev-C++ New Class wizard
#ifndef AMFITEM_H
#define AMFITEM_H
#include <iostream.h>
#include <string>
#include <vector>
class AMFItem;
enum AMFitemType {
 AMFNumber=0,
 AMFBool=1,
 AMFString=2,
 AMFObject=3,
 AMFNULL=5,
 AMFUndefined=6,
 AMFPointer=7,
 AMFArray=8,
 AMFEndOfBlock=9,
 AMFDate=11,
 AMFXML=15,
 AMFUNKNOWN=0xff
};
 
/*
* Generic AMF Item
*/

typedef std::vector<AMFItem*> AMFList;
typedef std::string AMF_STRING;
typedef struct tagAMFDateStruct {
 double date;
 short timezone;      
}AMFDateStruct;
class AMFItem
{
public:
 // class constructor
 AMFItem(AMFItem* pParent = NULL);
 // class destructor
 ~AMFItem();
 // pases the item
 bool parse(istream* stream);
 bool export(ostream* stream);
 
 AMFitemType GetitemType(); // returns the value of itemType
 AMF_STRING getTypeAsString(); // returns a string defining the type
 
private:
 // No description
 bool parseNumber(istream* stream);
 bool parseBool(istream* stream);
 bool parseString(istream* stream);
 bool parseObject(istream* stream);
 bool parseNull(istream* stream);
 bool parseUndefined(istream* stream);
 bool parseXML(istream* stream);
 bool parsePointer(istream* stream);
 bool parseECMAArray(istream* stream);
 bool parseDate(istream* stream);
 
 bool exportNumber(ostream* stream);
 bool exportBool(ostream* stream);
 bool exportString(ostream* stream);
 bool exportObject(ostream* stream);
 bool exportNull(ostream* stream);
 bool exportUndefined(ostream* stream);
 bool exportXML(ostream* stream);
 bool exportPointer(ostream* stream);
 bool exportECMAArray(ostream* stream);
 bool exportDate(ostream* stream); 
 
 
public: 
 // No description
 AMFitemType  m_iType;
 AMF_STRING  m_strName;
 AMFItem*  m_parent;
 //Data Segment 
 double   m_dataHolderDouble;
 bool   m_dataHolderBool;
 AMF_STRING  m_dataHolderString;
 short   m_dataHolderShort;
 AMFDateStruct m_dataHolderDate;
 AMFList   m_dataHolderObject;
};
#endif // AMFITEM_H