Aug 31, 2008

Arch 个人笔记

0.1. 安装Arch

  1. 下载iso,刻盘;或者下载Img,用winimage复制到U盘或者用dd命令。
  2. 启动,手动分区,注意不要删除你的数据。
  3. 挂载,不要挂错了
  4. 选择软件包,默认选择后再加选ntfs-3g和sudo,以及你的无线网卡。
  5. 安装软件包。时间很短,大概在1分钟不到。如果不是网络安装的话。
  6. 配置系统。基本不用改,可以以后再改。可能需要改的是rc.conf,设置你的主机名,上网方式。还有就是要修改一下locale,去掉en_US.utf-8的注释
  7. 安装grub,重启。最好重启,不要直接装软件,不然你可能会发现,最后并没有安装。
Welcome to Myblog

0.2. 配置Arch

这个是根据我的笔记本来写的,不过可以参考

useradd -m -s /bin/bash username
passwd username
添加用户并设置密码。
pacman -S xorg
安装X,但是可以选择,不必全部安装。
pacman -S hwd catalyst
安装硬件检测工具和显卡驱动
pacman -S synaptics
安装笔记本触摸板驱动
pacman -S alsa-utils
安装声卡驱动 装好之后需要运行alsaconf来配置声卡,并且需要把alsa放在daemon里面.
pacman -S gnome gdm gnome-terminal gnome-power-manager gnome-system-tools
安装gnome桌面,你也可以有选择的安装,比如最后的epiphany浏览器可以不装
pacman -S fcitx vim
Once you have installed. You'd better install vim first. Because you can not edit if you don't set gbk encoding. You can put "set fileencodings=utf8,gbk" in ~/.vimrc. And then you can run the command "vim .fcitx/config". And then you maybe want to put the following into .profile. setup XIM environment, needn't if use SCIM as gtk-immodules
---------------------------------
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=xim
export QT_IM_MODULE=xim
fcitx &
---------------------------------
pacman -S ccsm compiz-decorator-gtk compiz-plugins-extra
安装compiz及其相关的东西
pacman -S sudo
安装sudo,首先你要在root下运行visudo,然后反注释掉#%wheel ALL这一行. 然后运行gpasswd -a username wheel
pacman -S alacarte
Gnome菜单编辑器
pacman -S firefox opera amule liferea pidgin
各类网络工具
pacman -S file-roller unrar
Gnome的菜单编辑器
pacman -S smplayer codecs
看电影的东西 ──全能播放器
pacman -S gedit
用不惯vim的另一选择
pacman -S hal
自动挂载U盘等作用────不是很清楚 你需要把hal加入到daemon中,并且加入该组 usermod -aG hal username 可能你还需要加入其他组 usermod -aG audio,video,floppy,lp,optical,network,storage,wheel,dbus,hal username
pacman -S gpicview mirage
两个简单快速的看图软件,mirage功能多点
pacman -S rdesktop vino
rdesktop :命令行远程桌面 rdesktop -f 192.168.0.1 vino:图形化的远程桌面

0.3. Arch的备份与重装

0.3.1. Arch的备份

这里介绍的是用tar来备份与恢复系统
tar cvpzf /media/E/backup.tgz --exclude=/proc --exclude=/home --exclude=/mnt --exclude=/sys --exclude=/media /
可以根据自己的需要来修改,保存到back.sh里面,加入执行权限。 注意在执行该命令时,最好把/boot/grub/menu.lst里面的内容修改一下,因为在arch下,是用uuid来确定分区,可以改成sda5 ...这样以后重新划分区也可以成功启动。 同样把/etc/fstab里面的uuid也改掉,不然在不匹配的时候,是进不去系统的。 然后在root下,执行back.sh命令。

0.3.2. Arch的重装

恢复的时候需要进入linux,不知道livecd可不可以,没试过,我是直接装了一遍arch,注意可能你需要安装ntfs-3g,不然进不去。 然后执行tar xvpfz /media/E/backup.tgz -C / 这个命令不会删除根分区下back.tgz里没有的东西。

可能遗留的问题,你不能修改你的密码。此时需要在root下执行pwconv,然后即可改密码 passwd username


0.4. Tips Of Arch

  1. 复制命令
    • cp /home/user/doc.txt{,.bak} 同一目录备份
    • cp /home/user/doc.txt{,.bak} ~/ 复制同一目录下的文件到其他地方
  2. 安装字体
    • cp font.ttf /usr/share/fonts/myfonts/ 复制字体
    • cd alt+. alt+.表示按下alt健和.健,会直接转换为上个命令最后的内容
    • mkfontdir ;mkfontscale ;fc-cache ./ 刷新字体
  3. 关闭显示器
    • 执行命令xset dpms force off
    • 可以添加该命令到compiz里面,用快捷键来代替

Arch 代理设置

Welcome to Myblog

0.1. Arch:Pacman的代理设置

0.1.1. 一级代理上网

  • 执行 export http_proxy="http://username:passwd@192.168.1.2:8080" 其中192.168.1.2 换成你的代理,8080 换成代理端口。
  • 如果需要ftp的话,export ftp_proxy="http://username:passwd@192.168.1.2:8080"
  • pacman 使用代理需要注释掉 pacman.conf 里面的 wget那行.
  • 可以使用sudo http_proxy="http://usename:passwd@192.168.1.2:8080" pacman -S xxx
  • 还可以这样用 http_proxy="http://127.0.0.1:8088" yaourt xxx   这个需要二级代理
  • 如果需要自动加载代理设置,需要把上面的两个命令写到.bashrc里面,或者alias

0.1.2. 二级代理上网

  • 下载desproxy这个软件,可以在sourceforge上下载。
  • 编译安装desproxy。
  • 执行export PROXY_USER=yourname:passwd
  • 再执行/usr/local/bin/desproxy 二级代理Ip 二级代理端口 一级代理IP 一级代理端口 本地端口
  • 运行desproxy后,指定代理为127.0.0.1:自己指定的本地端口,这样就可以了

Aug 30, 2008

Linux Command

转自 from http://www.linuxguide.it/linux_commands_line_en.htm

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.Seconds
clock -w
save date changes on BIOS

Shutdown, Restart of a system and Logout
shutdown -h now shutdown system
init 0
telinit 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

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)

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 binary 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 / -xdev -name *.rpm 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

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

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)

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

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

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

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

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

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

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

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

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

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
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

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.1 - 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

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

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

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

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

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.1 - 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

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

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

Other useful commands
apropos ...keyword display a list of commands that pertain to keywords of a program , useful when you know what your program does, but you don't know the name of the command
man ping display the on-line manual pages for example on ping command
whatis ...keyword displays description of what a program does
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

Aug 28, 2008

搬家:)

这两天的搬家——累

学校的住宿条件,无话可说,连个冷水洗澡都不好洗。

搬家的前一天,连睡觉都不好睡 !


Aug 26, 2008

去学校了...

回家快一个月了,明天终于要回学校了,还有一大堆旧书没卖,烦啊。。。

Arch排除某个软件升级

pacman -Su --ignore pkgname

或者在pacman.conf中设置IgnorePkg字段。

有时候升级显卡时会很惨,所以有必要排除一些东西。

Aug 24, 2008

我的Gvim配置

"我的.gvimrc 根据win的合成,比较适合win操作,比如CTRL+C or X是拷贝剪切。

set fencs=utf-8,gbk

set guifont=YaHei Consolas Hybrid 11
map ff :!txt2tags -t html % ; opera %<.html<CR>
colorscheme zellner
set whichwrap=b,s,l,h,<,>,[,] "使得h,l可以换行移动
"tab mappings 注释
map <M-1> 1gt
map <M-2> 2gt
map <M-3> 3gt
map <M-4> 4gt
map <M-5> 5gt
map <M-6> 6gt
map <M-7> 7gt
map <M-8> 8gt
map <M-9> 9gt
map <M-`> :tabnew<CR>
"断行设置
set lbr
set fo+=mB "亚洲语言断行支持
"文本编辑设定
set sw=4 "自动缩进4
set ts=4 "自动缩进4
"图形界面设置


" Set options and add mapping such that Vim behaves a lot like MS-Windows
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2006 Apr 02#

" bail out if this isn't wanted (mrsvim.vim uses this).
if exists("g:skip_loading_mswin") && g:skip_loading_mswin
finish
endif

" set the 'cpoptions' to its Vim default
if 1 " only do this when compiled with expression evaluation
let s:save_cpo = &cpoptions
endif
set cpo&vim

" set 'selection', 'selectmode', 'mousemodel' and 'keymodel' for MS-Windows
behave mswin

" backspace and cursor keys wrap to previous/next line
set backspace=indent,eol,start whichwrap+=<,>,[,]

" backspace in Visual mode deletes selection
vnoremap <BS> d

" CTRL-X and SHIFT-Del are Cut
vnoremap <C-X> "+x
vnoremap <S-Del> "+x

" CTRL-C and CTRL-Insert are Copy
vnoremap <C-C> "+y
vnoremap <C-Insert> "+y

" CTRL-V and SHIFT-Insert are Paste
map <C-V> "+gP
map <S-Insert> "+gP

cmap <C-V> <C-R>+
cmap <S-Insert> <C-R>+

" Pasting blockwise and linewise selections is not possible in Insert and
" Visual mode without the +virtualedit feature. They are pasted as if they
" were characterwise instead.
" Uses the paste.vim autoload script.

exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']

imap <S-Insert> <C-V>
vmap <S-Insert> <C-V>

" Use CTRL-Q to do what CTRL-V used to do
noremap <C-Q> <C-V>

" Use CTRL-S for saving, also in Insert mode
noremap <C-S> :update<CR>
vnoremap <C-S> <C-C>:update<CR>
inoremap <C-S> <C-O>:update<CR>

" For CTRL-V to work autoselect must be off.
" On Unix we have two selections, autoselect can be used.
if !has("unix")
set guioptions-=a
endif

" CTRL-Z is Undo; not in cmdline though
noremap <C-Z> u
inoremap <C-Z> <C-O>u

" CTRL-Y is Redo (although not repeat); not in cmdline though
noremap <C-Y> <C-R>
inoremap <C-Y> <C-O><C-R>

" Alt-Space is System menu
if has("gui")
noremap <M-Space> :simalt ~<CR>
inoremap <M-Space> <C-O>:simalt ~<CR>
cnoremap <M-Space> <C-C>:simalt ~<CR>
endif

" CTRL-A is Select all
noremap <C-A> gggH<C-O>G
inoremap <C-A> <C-O>gg<C-O>gH<C-O>G
cnoremap <C-A> <C-C>gggH<C-O>G
onoremap <C-A> <C-C>gggH<C-O>G
snoremap <C-A> <C-C>gggH<C-O>G
xnoremap <C-A> <C-C>ggVG

" CTRL-Tab is Next window
noremap <C-Tab> <C-W>w
inoremap <C-Tab> <C-O><C-W>w
cnoremap <C-Tab> <C-C><C-W>w
onoremap <C-Tab> <C-C><C-W>w

" CTRL-F4 is Close window
noremap <C-F4> <C-W>c
inoremap <C-F4> <C-O><C-W>c
cnoremap <C-F4> <C-C><C-W>c
onoremap <C-F4> <C-C><C-W>c

" restore 'cpoptions'
set cpo&
if 1
let &cpoptions = s:save_cpo
unlet s:save_cpo
endi
" An example for a gvimrc file.
" The commands in this are executed when the GUI is started.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2001 Sep 02
"
" To use it, copy it to
" for Unix and OS/2: ~/.gvimrc
" for Amiga: s:.gvimrc
" for MS-DOS and Win32: $VIM_gvimrc
" for OpenVMS: sys$login:.gvimrc

" Make external commands work through a pipe instead of a pseudo-tty
"set noguipty

" set the X11 font to use
" set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1

set ch=2 " Make command line two lines high

set mousehide " Hide the mouse when typing text

" Make shift-insert work like in Xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>

" Only do this for Vim version 5.0 and later.
if version >= 500

" I like highlighting strings inside C comments
let c_comment_strings=1

" Switch on syntax highlighting if it wasn't on yet.
if !exists("syntax_on")
syntax on
endif

" Switch on search pattern highlighting.
set hlsearch

" For Win32 version, have "K" lookup the keyword in a help file
"if has("win32")
" let winhelpfile='windows.hlp'
" map K :execute "!start winhlp32 -k <cword> " . winhelpfile <CR>
"endif


endif

Arch个人笔记──txt2tags 版(t2t)

Arch个人笔记
风中林立
%%date(%m-%d-%Y)
%!encoding:UTF-8
%! Target : html
%! Options : --toc --css-inside -n
%! Options : --css-sugar
%! Style : css/moin.css

%!preproc: '(?i)(myblog)' '[1 http://fzll.blogspot.com]'
% The ^ need to be escaped by
%!postproc(html): ^^(.*?)^^ <sup>1</sup>
%postproc(html): ,,(.*?),, <sub>1</sub>
%!postproc(html): ,,(.*?),, <BR><strong><span >1</span></strong>
%!postproc(html): @@(.*?)@@ <div class="text" style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: rgb(196, 225, 255) none repeat scroll 0% 0%; border: 2px solid rgb(191, 208, 217); color: black; font-family: 'bitstream vera sans mono',monaco,Arial,Verdana,Helvetica,serif; margin: 8px; padding: 0px;">1</div>
% use custom tags: {{#FF0000 Good morning}} -> <font color=#FF0000>Good morning</font>
%!PostProc(html) : '{{(.*?)s(.*?)}}' '<font color=1>2</font>'
% define 'darkyellow' to be #8F8F00
%!PostProc(html) : '<font color=darkyellow>' '<font color=#8F8F00>'
%!PostProc(html) : '<font color=blue>' '<font color=#3333ff>'
%!postproc(html): \\ <BR>
%include(html):''blog.t2t.html''

==安装Arch==
+ 下载iso,刻盘;或者下载Img,用winimage复制到U盘或者用dd命令。
+ 启动,手动分区,注意不要删除你的数据。
+ 挂载,不要挂错了
+ 选择软件包,默认选择后再加选ntfs-3g和sudo,以及你的无线网卡。
+ 安装软件包。时间很短,大概在1分钟不到。如果不是网络安装的话。
+ 配置系统。基本不用改,可以以后再改。可能需要改的是rc.conf,设置你的主机名,上网方式。
+ 安装grub,重启。最好重启,不要直接装软件,不然你可能会发现,最后并没有安装。


| {{#638d2e Welcome to Myblog}}
--------------------------------------------------------
==配置Arch==

//**这个是根据我的笔记本来写的,不过可以参考**//

: ,,useradd -m -s /bin/bash username ,,
: ,,passwd username,,
添加用户并设置密码。
: ,,pacman -S xorg,,
安装X,但是可以选择,不必全部安装。
: ,,pacman -S hwd catalyst,,
安装硬件检测工具和显卡驱动
: ,,pacman -S synaptics,,
安装笔记本触摸板驱动
: ,,pacman -S alsa-ultis,,
安装声卡驱动
装好之后需要运行**alsaconf**来配置声卡,并且需要把alsa放在daemon里面.
: ,,pacman -S gnome gdm gnome-terminal gnome-pow er-manager gnome-system-tools,,
安装gnome桌面,你也可以有选择的安装,比如最后的epiphany浏览器可以不装
: ,,pacman -S fcitx vim,,
Once you have installed. You'd better install vim first.
Because you can not edit if you don't set gbk encoding.
You can put "set fiecs=utf8,gbk" in ~/.vimrc. \
And then you can run the command "vim .fcitx/config".\
And then you maybe want to put the following into .profile.\
setup XIM environment, needn't if use SCIM as gtk-immodules\
```
---------------------------------
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=xim
export QT_IM_MODULE=xim
fcitx &
---------------------------------
```
: ,,pacman -S ccsm compiz-decorator-gtk compiz-plugins-extra,,
安装compiz及其相关的东西
: ,,pacman -S sudo,,
安装sudo,首先你要在root下运行{{blue visudo}},然后反注释掉{{blue #%wheel ALL}}这一行.\
然后运行{{blue gpasswd -a username wheel}}
: ,,pacman -S alacarte,,
Gnome菜单编辑器
: ,,pacman -S firefox opera amule liferea pidgin,,
各类网络工具
: ,,pacman -S file-roller unrar,,
Gnome的菜单编辑器
: ,,pacman -S smplayer codecs,,
看电影的东西 ──全能播放器
: ,,pacman -S gedit,,
用不惯vim的另一选择
: ,,pacman -S hal,,
自动挂载U盘等作用────不是很清楚\
你需要把hal加入到daemon中,并且加入该组\
{{blue usermod -aG hal username}}\
可能你还需要加入其他组\
{{blue usermod -aG audio,video,floppy,lp,optical,network,storage,wheel,dbus,hal username}}
: ,,pacman -S gpicview mirage,,
两个简单快速的看图软件,mirage功能多点
: ,,pacman -S redesktop vino,,
redesktop :命令行远程桌面 {{blue rdesktop -f 192.168.0.1}}\
vino:图形化的远程桌面


-------------------------------------------------------
==Arch的备份与重装==
===Arch的备份===
: 这里介绍的是用tar来备份与恢复系统
@@tar cvpzf /media/E/backup.tgz --exclude=/proc --exclude=/home --exclude=/mnt --exclude=/sys --exclude=/media /@@
可以根据自己的需要来修改,保存到back.sh里面,加入执行权限。\
注意在执行该命令时,最好把/boot/grub/menu.lst里面的内容修改一下,因为在arch下,是用uuid来确定分区,可以改成sda5 ...这样以后重新划分区也可以成功启动。\
同样把/etc/fstab里面的uuid也改掉,不然在不匹配的时候,是进不去系统的。\
然后在root下,执行back.sh命令。\



===Arch的重装===
恢复的时候需要进入linux,不知道livecd可不可以,没试过,我是直接装了一遍arch,注意可能你需要安装ntfs-3g,不然进不去。\
然后执行tar xvpfz /media/E/backup.tgz -C / \
这个命令不会删除根分区下back.tgz里没有的东西。\


可能遗留的问题,你不能修改你的密码。此时需要在root下执行{{blue pwconv}},然后即可改密码 {{blue passwd username}} \

--------------------------------------------------------
==Tips Of Arch==
+ 复制命令
- {{blue cp /home/user/doc.txt{,.bak} }}同一目录备份
- {{blue cp /home/user/doc.txt{,.bak} ~/ }}复制同一目录下的文件到其他地方
+ 安装字体
- {{blue cp font.ttf /usr/share/fonts/myfonts/ }}复制字体
- {{blue cd alt+.}} alt+.表示按下alt健和.健,会直接转换为上个命令最后的内容
- {{blue mkfontdir ;mkfontscale ;fc-cache ./ }} 刷新字体
+ 关闭显示器
- 执行命令{{blue xset dpms force off}}
- 可以添加该命令到compiz里面,用快捷键来代替

autohotkey快捷键与暂停

#MaxThreadsPerHotkey 3 ;不知道什么作用,不过有用
#z:: ; Win+Z hotkey (可以改成自己喜欢的 ^!p ctrl+alt+p).
#MaxThreadsPerHotkey 1 ;同样有用
if KeepWinZRunning ; This means an underlying thread is already running the loop below.
{
  KeepWinZRunning := false ; 如果想执行完循环的内容 Signal that thread's loop to stop.
  return ; End this thread so that the one underneath will resume and see the change made by the line above.
}
; Otherwise:
KeepWinZRunning := true
Loop 1
{
  ; The next two lines are the action you want to repeat (update them to suit your preferences):
  run notepad
  Sleep 3000
  run cmd
  ; But leave the rest below unchanged.
 if not KeepWinZRunning ; The user signaled the loop to stop by pressing Win-Z again.
  break ; Break out of this loop.
}
KeepWinZRunning := false ; Reset in preparation for the next press of this hotkey.
return ;表示这个快捷键的作用到此处结束,如果注释,则会继续执行下面的命令
#d::msgbox,hi
#p::Pause ;可以把不想被执行的快捷键定义放在后面,此时可以按快捷键执行。
#c::
run calc
run cmd
return

autoHotkey 暂停脚本执行

loop 10{
run, notepad
sleep,2000
}
#n::Pause

按win+n即可暂停

Aug 23, 2008

Gvim设置

这里介绍得不错

vim and gvim的某些设定

有些东西放在plugins里面效果比synatx好,尽管它也是语法加亮。比如txt2tags.vim 。另外在arch下,vim和gvim不是共用配置文件的。

~/.gvimrc的某些设定:

set fencs=utf-8,gbk
set guifont=YaHei\ Consolas\ Hybrid\ 11
map ff :!txt2tags -t html % ; opera %<.html
colorscheme zellner
set whichwrap=b,s,l,h,<,>,[,]" for h,j can move in the lines  
"tab mappings
map 1gt
map 2gt
map 3gt
map 4gt
map 5gt
map 6gt
map 7gt
map 8gt
map 9gt
map :tabnew
set lbr
set sw=4  
set ts=4  
set mousemodel=popup

Metapixel

Prepare
metapixel-prepare -r srcdir destdir

The -r option makes it so photos in subdirectories are included

Or

metapixel-prepare -r source destination --width=48 --height=48

This copies all images from the “source” folder, (recursively) searching into every folder within, and dumps every image it finds into the “destination” folder after resizing them into 48×48 pixel images. 

Do
metapixel --metapixel source.jpg output.png --library destdir

Or

metapixel --metapixel input.jpg output.png --library destination --scale=35 --distance=500

This takes input.jpg and increases the output size by 35 times (i.e. REALLY BIG IMAGE), uses the library destination and does not repeat any images found in the library closer than 500. It’ll spit output.png after a little while. If you don’t care about repeating images, removing the distance flag will result in MUCH, MUCH faster generation times.

Aug 22, 2008

Linux系统的备份与恢复

这里介绍的是用tar来备份与恢复系统
tar cvpzf /media/E/backup.tgz --exclude=/proc --exclude=/home --exclude=/mnt --exclude=/sys --exclude=/media /

可以根据自己的需要来修改,保存到back.sh里面,加入执行权限。
注意在执行该命令时,最好把/boot/grub/menu.lst里面的内容修改一下,因为在arch下,是用uuid来确定分区,可以改成sda5 ...这样以后重新划分区也可以成功启动。
同样把/etc/fstab里面的uuid也改掉,不然在不匹配的时候,是进不去系统的。
然后在root下,执行back.sh命令。

恢复的时候需要进入linux,不知道livecd可不可以,没试过,我是直接装了一遍arch,注意可能你需要安装ntfs-3g,不然进不去。
然后执行tar xvpfz /media/E/backup.tgz -C /
这个命令不会删除根分区下back.tgz里没有的东西。

可能遗留的问题,你不能修改你的密码。此时需要在root下执行pwconv,然后即可改密码 passwd username

中国大学生的宿舍何时小康

也许新的校区还能够真正住的较为舒服,而那些老的校区又怎么如何住人?

不说别的,就说我的学校。在老校区内,很多宿舍的女生是8人一间,一间的大小应该是刚好放下一个大桌子,8张床,然后留下40cm的过道吧,一层楼只有一个大厕所。连最好的男生宿舍,连个放衣服的衣橱都没有。这不得不让人觉得学校设施垃圾,学校设施垃圾,校长也...;校长...,教育部...;教育部..., 领导...

貌似这与我们的奔小康相违背,难道大学生就不是这个号召里面的民众?有时候真的不能觉得人才流失便是那些人才的原因,想想国家又真的给了我们什么?我不知道有哪一个小学真的不用交学费,而且往往越是穷的地方越是高。教育是国家之根本,想想日本50年的飞跃,感觉惭愧!

再次向那些不能承受学费之重的人们表示深深同情,向那些在大学里住着"难民窟"的明日之星表示深深同情!

sourceforge下载速度——慢

sourceforge这么一个优秀的站点,为何老是封锁呢?现在能访问了,不过下载速度实在是慢,用迅雷下载不到2k,浏览器直接下载能达到5k,郁闷的只好在迅雷上加了个日本的代理,能达到25k,不过也要下个1小时,要是以前2分钟就搞定了。郁闷...

又搞到个有密码的日本代理,这个快:http://www.ipfree.cn/

Aug 14, 2008

Test Shedule

How to do?

如何挑选发行版——续

挑选自己中意的发型版,关键还是要自己亲自尝试一下你可能中意的几个发行版。
别人说好不见得是真好,自己用的爽那才是真的。
不过不建议用虚拟机安装,虚拟机很多东西都反映不出来。
当然安装时要做好数据备份工作,另外很多发行版都有硬盘安装的方法,可以尝试一下,但一定要注意备份好数据。

每个发行版用一段时间,自己形成一定的认识:

  • 这个易用吗(如果你对易用性很注重)?
  • 这个能学到更多东西吗(注重学习技术的)
  • 这个美观吗?(注重面子的)
  • 这个快速吗?(注重效率的)
  • 设计理念帅吗?(唯美的哲学派)
    ....

不论为了哪种原因选择都无可厚非,毕竟是你在用。
根据以上几点,自己选择一个最喜欢的便可以了。
自己觉得好,管别人怎么说呢!
尚未接触即将准备linux的朋友们,你们觉得是不是呢?
当然可能你没有很多时间来尝试很多发行版,这时候适当的参考一下前人的意见可以帮你缩小范围。
最后,祝你们都找到自己的心仪的linux。当然重新回归Windows的,也不是什么丢人的事,不要在意。

漂亮的组合壁纸



成熟与韵味


别致桌面

一些别致的桌面


Aug 13, 2008

硬盘安装ubuntu 8.04 (NTFS)

Windows下安装可以下个grub4dos其实只需要把glrdr拷到系统根目录下即可
编辑menu.lst文件并放在根目录
title Ubuntu 8.04 LiveCD
find --set-root /ubuntu804.iso
kernel /casper/vmlinuz boot=casper find_iso=/ubuntu804.iso
initrd /casper/initrd.gz

另外修改boot.ini加入一句:

c:\grldr ="Grub"

U盘启动也可以,只需有个grub.exe即可,进入dos后输入grub即可,menu.lst也是如此。
用虚拟光驱加载ubuntu镜像,拷贝整个cpaser目录(一定要整个目录)拷贝到iso盘的根目录。另外把.disk目录也拷贝到那里。另外iso镜像名要和menu.lst里的文件名一样!并把iso镜像也放在根目录下!
然后重启选择进入grub即可,接着便是等待加载,要一段时间,一分钟左右。
以后便是正常的安装了!

8.10的貌似有点变化,看新写的吧。

关于挑选Linux发行版

个人见解——如有差错,望指正。

如果是新手,推荐使用ubuntu,随着你的深入,ubuntu的缺点也会渐渐暴露出来,比如安装软件包爆慢——不是说下载,貌似ubuntu的下载最快。其后,随着你的捣鼓,ubuntu渐渐的死机,进不了系统,然后挂掉。接着你会重装,但是不久之后发现又挂掉。另外有一个重大缺点便是编译环境默认安装的不全,加之依赖关系复杂,对于装一些新的软件,比如Google gadget就非常费事。

时间长了之后,你可能会想到用用oss,或者fedora。但是貌似他们的livecd做的很差,光硬盘安装这一块就不如ubuntu,甚至oss的livecd装好之后还不能直接adsl,貌似还要上网下个软件才能adsl——我都不能adsl,你说说我怎么上网!另外oss很有可能装好就死机,重启还是死机!不知官方人员怎么会把这个老死机的发行版当正式版!用用fedora,你会发现跟ubuntu有种不一样的感觉,不过,也就那样,没有什么新异。

再后来,你受不了上面两个系统的死机或者软件包下载太慢,你此时便想寻求一个更好的系统,于是你走向了arch,一个小巧快速但又非常强大的系统。貌似arch的安装方法种类最多,你可以很容易的硬盘安装,网络安装,u盘安装,当然还有光盘。

arch的其他几个亮点,你也会渐渐发现:

  1. 启动快速,垃圾少。可以自己决定建设个什么样的linux,正如arch本意就是建筑!
  2. 软件比较新,ubuntuer看看自己的内核现在是什么版本,貌似还是24吧,arch已经26了
  3. 包管理很强大,很快速,安装软件基本上就是复制一下的时间,其实本来就是复制。
  4. 虽然官方软件包少,不过有了aur,软件似乎比任何发行版还多,尽管安装时要编译,不过几乎好的新软件都是先提供源码。
  5. wiki很强大,文章水平也很高。前两天就是靠wiki成功的休眠,而且是1g内存休眠到只有280M的swap上,其中还开了compiz
  6. 更重要的一点,你会比较容易的了解linux的文件配置。ubuntu也有很多需要配置,但是很少有核心的东西,貌似很少有人会提醒你看看rc.conf——貌似ubuntu没有,但是它的类似物几乎也很少有人看看。ubuntu的配置基本上都是些小块头。
  7. 再者,arch用户整体水平一般都比ubuntu,oss,fedora的整体水平高一点,如果你有问题,更容易解决。同样,你的水平也会渐渐高起来。
  8. 最后,你能很平稳的升级。

除了arch,debian貌似也很不错,gentoo也很好,lfs有点不适合普通级别的linuxer。

Aug 11, 2008

Two sexy girls


One of My lovest singer and girls

A sexy girl! Like milk!

WeeChat 使用

WeeChat是linux下的IRC软件,基于控制台

临时连接
/connect irc.oftc.net
/join #arch-cn

自动登入
/server add oftc irc.oftc.net
/set oftc.server_autoconnect = 1

其他
/server listfull        看有什么选项
/set oftc.server.....   按tab来设置
alt+数字键 是切换频道

在Arch中使用休眠

很多发行版并不能很好的的支持休眠功能,但是可以自己搞定这些。
  1. 首先安装hibernate-script.当然也可以安装pm-utils
    sudo pacman -S hibernate-script
  2. 安装uswsusp.其他linux发行版需要其他方法安装,可能软件仓库里面就有,没有的话直接下载源码编译。
    yaourt uswsusp
  3. 装好之后编辑/etc/suspend.conf
    sudo vi /etc/suspend.conf
    修改resume device 这一行为 resume device = /dev/sda3 (用你的swap的分区替换/dev/sda3)
    另外还可以激活compress=y这一行。这样便可易使用压缩,貌似速度会快点。
  4. 修改/etc/mkinitcpio.conf
    sudo vi /etc/mkinicpio.conf
    在最底下的HOOKS列表里面,替换resume为uresume,如果没有resume,则在filesystem的前面加入uresume,但要在sata之类的后面,保险的做法便是把uresume放在filesystem前一位。
  5. 重新建立内核。
    sudo mkinitcpio -k `uname -r` -g /boot/kernel26.img
  6. 执行休眠
    sudo s2disk
  7. 执行待机
    sudo s2ram
  8. Suspending with fglrx 
    Following addition to /etc/hibernate/suspend2.conf is required: 
    # For fglrx
    ProcSetting extra_pages_allowance 20000

但是你剩余的swap大小最好大于你使用的内存,可以小于总内存大小。

执行下列命令可以内存减少占用
sync; echo 3 > /proc/sys/vm/drop_caches

执行该命令不需要密码只需在visudo里面加入
yourname ALL = (ALL) NOPASSWD: /usr/sbin/s2disk
yourname ALL = (ALL) NOPASSWD: /usr/sbin/s2ram

详情请参考ArchWiki Suspend_To_Disk

Aug 10, 2008

Some Girls I like


That's enough for me to introduce!
Just enjoying it!
A girl who in the rain.That's beautiful!
Just Like It!
A girl think about something! I like her eyes!
I don't know why I choose her,just a just!

Cartoon Girls

What is she thinking now? Feeling what...

Stand in wind and rain alone, Is anybody here?

Slop Over

在这忧郁的背景中,流淌着一股清新脱俗的气质,淡雅的色调,更添此情!

Smile or not smile? A big eyes are looking at you! How do you feel, Happy or Sad?

A girls with back background! You can not see her clearly, but you must think she is beautiful and sexy! May she is not true, but still live in our dream!

Aug 9, 2008

Vim 剪贴版使用

在一般模式下输入:reg然后可以看到vim剪贴板里的东西。其中以"+开头的是系统剪贴板。因此要复制系统剪贴版里的东西只需"+p,而复制vim里的东西到系统剪贴板只需"+y

奥运传奇系列1──荷兰女飞人科恩


荷兰女飞人”布兰克尔斯.科恩。1948年,第14届夏季奥运会在英国伦敦举行,科恩已经是30岁的“半老徐娘”了,虽然青春年华已逝,但宝刀未老,她依然参加了四项比赛。第一天是100米比赛,这位年轻的老妈妈丝毫不逊色,枪声一响,疾步如飞,第一个到达终点,喜得第一金。而在80米跨栏比赛中,面对比自己几乎年轻10岁的名将莫雷德.加得纳,这位老妈妈有点胆怯了,她太紧张了,脑子轰轰作响,以至于连发令枪响都没有听到,直到对手跑了一米多远才开始奋起直追,最终还是以11秒2的成绩再夺一金。第二天,科恩又参加了女子200米预选赛,并以24秒3的成绩轻松夺冠。最后,这位“飞行的家庭主妇”在4人百米接力赛中又夺一枚金牌,为荷兰队获得冠军做出了非常重要的贡献。就这样,在短短的几天内,“女飞人”独揽四枚金牌。

Aug 8, 2008

One day One Girl

From Tomorrow I will show a girl everyday on my blog!

Coming soon!

Aug 7, 2008

一日九语

一日九语,算上这条便是十条了,该休息了。

It's time for rest!

今天七夕

七夕——相约在鹊桥边!

今日留下此笔,以记今日之过!

HotkeyP 简单易用强大的快捷键

相当强大的快捷键工具,你可以设置win+Q来启动你的QQ,Alt+M来窗口透明度30%,Alt+R来删除你的U盘....

主页

明天就要奥运了,期待中

废话不多说,祝奥运开幕式完美呈现!

一个非常棒的网络硬盘——联想网络硬盘

注册就会得到1G的容量,而且每天还增加10m,直到5G。

另外还有上传和下载客户端,单文件500k左右,可以直接上传下载文件和文件夹,还有文件目录结构。
联想在线数据

Tips of arch

  1. 复制命令
    • cp /home/user/doc.txt{,.bak} 同一目录备份
    • cp /home/user/doc.txt{,.bak} ./ 复制同一目录下的文件到其他地方

  2. 安装字体
    • cp font.ttf /usr/share/fonts/myfonts/ 复制字体
    • cd alt+. alt+.表示按下alt健和.健,会直接转换为上个命令最后的内容
    • mkfontdir ;mkfontscale ;fc-cache ./ 刷新字体

  3. 关闭显示器
    • 执行命令 xset dpms force off
    • 可以添加该命令到compiz里面,用快捷键代替

  4. Wiki链接

Arch To Be Using----Gnome

This is just for my notebook .But you can refer it.

useradd -m -s /bin/bash username
passwd username
 
They are for you to add noroot user.

pacman -S xorg
 But you did not select all the package! You can unselect the fonts.

pacman -S hwd catalyst
 The catalyst is the better drive for ati.
 Hwd is a easier tooler to generator xorg.conf.
 But if you install catalyst, you can use aticonfig.

pacman -S synaptics
 The drive for NoteBook Touch Pad.

pacman -S alsa-utils
 The sound.
 You may run the alsaconf to configure your sound drive.
 And also you maybe to run "gpasswd -a username audio"
 And you have to put "alsa" in the Daemon in the rc.conf.

pacman -S gnome gdm gnome-terminal gnome-power-manager gnome-system-tools
 And you also did not select all the package, such as epiphany----a browser for gnome.
 
pacman -S fcitx vim
 Once you have installed. You'd better install vim first. 
 Because you can not edit if you don't set gbk encoding.
 You can put "set fiecs=utf8,gbk" in ~/.vimrc.
 And then you can run the command "vim .fcitx/config".
 And then you maybe want to put the following into .profile.
 #setup XIM environment, needn't if use SCIM as gtk-immodules
 ---------------------------------
 export XMODIFIERS=@im=fcitx
 export GTK_IM_MODULE=xim
 export QT_IM_MODULE=xim
 fcitx &
 ---------------------------------
 
pacman -S ccsm compiz-decorator-gtk compiz-plugins-extra
 This is compizconfig setting manager!

pacman -S sudo
 And you have to run "visudo" by root.And uncomment the "#%wheel ALL ..."
 Just like "%wheel ALL ...". And then run "gpasswd -a username wheel".
 Now you can use sudo.

pacman -S alacarte
 A gnome menu editor!

pacman -S file-roller unrar
 The archieve manager and rar uncompression programme.

pacman -S firefox opera
 The internet browser!

pacman -S amule liferea pidgin
 Amule is the ed2k downloader.
 liferea is for you read rss.
 Pidgin is the instant messager!

pacman -S smplayer codecs
 The best moive player for you.
 And maybe you will install codecs-all instead of codecs. But I think codecs is just enough!

pacman -S gedit
 One graphical text editor for gnome!

pacman -S hal
 Add hal in the daemon.
 usermod -aG storage,wheel,dbus,hal username
 
 ---------------------
 some tips for group
 ---------------------------------------------------------------------------------- 
 usermod -aG audio,video,floppy,lp,optical,network,storage,wheel,dbus,hal username
 ----------------------------------------------------------------------------------

pacman -S gpicview mirage
 A simple image-viewer. Mirage is also a simple viewer but it can crop and do something else.

pacman -S rdesktop  vino
 Remote desktop for gnome.

Arch简略安装

  1. 下载iso,刻盘;或者下载Img,用winimage复制到U盘或者用dd命令dd if=arch.img of=/dev/sdb。
  2. 启动,手动分区,注意不要删除你的数据。
  3. 挂载,不要挂错了。
  4. 选择软件包,默认选择后再加选ntfs-3g和sudo,以及你的无线网卡。
  5. 安装软件包。时间很短,大概在1分钟不到。如果不是网络安装的话。
  6. 配置系统。基本不用改,可以以后再改。可能需要改的是rc.conf,设置你的主机名,上网方式。
  7. 安装grub,重启。最好重启,不要直接装软件,不然你可能会发现,最后并没有安装。

HP LaserJet 1020驱动安装Arch

首先安装cups和samba如果你需要共享windows的打印机

从AUR网上下载foo2zjs的PKGBUILD。

修改PKGBUILD里面的md5,设为空;然后修改"./getweb all"为"./getweb 1020"。

进入该目录执行makepkg。然后安装即可。

重启cups进入管理界面,添加打印机,URl填写为如下格式
smb://usename:passwd@192.168.0.2/HPLaserJ
没有密码可以这样   smb://192.168.0.2/HPLaserJ

驱动选择pid,然后在/usr/share/cups/models/选择hp 1020

至此应该就可以打印了。