Tuesday, December 16, 2008

Avoid auto padding by PIC32 compiler for data structure

Using __attribute__((packed)) for variable and structure member.




typedef struct sDaq2ComAggregationRaw001
{
GSNTYPES_BYTE FeederAndPhase; //0x01:Va 0x02:Vb....
GSNTYPES_BYTE TimeStampCycles;
GSNTYPES_ULONG TimeStampSeconds;
GSNTYPES_DOUBLE llDft_Goertzel_Aggregation_SquareSumImgReal[CABLE_TRACKER_MAX_NUM_HARMONICS]; GSNTYPES_DOUBLE llSquareSumForAggregationLog;
GSNTYPES_DOUBLE llSquareSumPerCycleMaxOverLoggingInterval; //Optional to be logged.--advanced feature ToDo
GSNTYPES_DOUBLE llSquareSumPerCycleMinOverLoggingInterval; //Optional to be logged.--advanced feature ToDo

}
__attribute__((packed)) S_DAQ2COM_AGGREGATION_RAW_001;



typedef struct sDaq2ComAggregationRaw002
{
GSNTYPES_BYTE FeederAndPhase; //0x11:Feeder1PhaseA, 0x12:Feeder1PhaseB...0x41:Feeder4PhaseA
GSNTYPES_BYTE TimeStampCycles;
GSNTYPES_ULONG TimeStampSeconds;
GSNTYPES_DOUBLE llDft_Goertzel_Aggregation_SquareSumImgReal[CABLE_TRACKER_MAX_NUM_HARMONICS]; GSNTYPES_DOUBLE llSquareSumForAggregationLog;
GSNTYPES_DOUBLE llSquareSumPerCycleMaxOverLoggingInterval;
GSNTYPES_DOUBLE llSquareSumPerCycleMinOverLoggingInterval;
GSNTYPES_DOUBLE llActivePwrSumForAggregationLog; //

}
__attribute__((packed)) S_DAQ2COM_AGGREGATION_RAW_002;



typedef struct sStructureID
{
GSNTYPES_USHORT variation;
GSNTYPES_BYTE version;
GSNTYPES_BYTE type; //config, log, events. see E_StructType definition.

}__attribute__((packed)) S_StructureID;


typedef struct sRdHeadDataStorage
{
GSNTYPES_USHORT len; //is based on the struct ID,number bytes of record body,exclude record header.
S_StructureID structID;
}S_RecordHeadDataStorage;



typedef union sDataRecordBody
{
//The ptrDataBody could point to following data Structures.

S_COM_CONFIG_BLOCK_001 com_configuration_001;
S_COM_CONFIG_BLOCK_002 com_configuration_002;
S_DAQ_CONFIG_BLOCK_001 daq_configuration_001;
S_DAQ_CONFIG_BLOCK_002 daq_configuration_002;
S_DAQ2COM_AGGREGATION_RAW_001 daq2com_aggregation_raw_001;
S_DAQ2COM_AGGREGATION_RAW_002 daq2com_aggregation_raw_002;
S_DAQ2COM_AGGREGATION_RAW_003 daq2com_aggregation_raw_003;
S_DAQ2COM_EVENTS_RAW_001 daq2com_events_raw_001;
S_DAQ2COM_EVENTS_RAW_002 daq2com_events_raw_002;
S_DAQ2COM_EVENTS_RAW_003 daq2com_events_raw_003;
S_COM2EEP_AGGREGATION_REAL_001 com2eep_aggregation_real_001;
S_COM2EEP_AGGREGATION_REAL_002 com2eep_aggregation_real_002;
S_COM2EEP_AGGREGATION_REAL_003 com2eep_aggregation_real_003;
S_COM2EEP_EVENTS_REAL_001 com2eep_events_real_001;
S_COM2EEP_EVENTS_REAL_002 com2eep_events_real_002;
S_COM2EEP_EVENTS_REAL_003 com2eep_events_real_003;

}U_DataRecordBody;


typedef struct sDataRecord
{
S_RecordHeadDataStorage rdHead;
U_DataRecordBody rdDataBody;

}__attribute__((packed)) S_DataRecord;

Monday, December 1, 2008

Basic linux command list under Fedora

SHOW PERL VERSION
SHOW LINUX KERNEL VERSION
SHOW WHETHER LINUX KERNEL SOURCE CODE ARE INSTALLED
cscope
SHOW PERL VERSION
[q.yang@localhost lpc3250]$ perl -v
SHOW LINUX KERNEL VERSION

[q.yang@localhost lpc3250]$ uname -r

SHOW WHETHER LINUX KERNEL SOURCE CODE ARE INSTALLED

[q.yang@localhost sierra_drv_1.7.32]$ rpm -qa|grep kernel
kerneloops-0.12-1.fc9.i386
kernel-devel-2.6.27.25-78.2.56.fc9.i686
kernel-2.6.25-14.fc9.i686
kernel-headers-2.6.27.25-78.2.56.fc9.i386
kernel-2.6.27.25-78.2.56.fc9.i686
kernel-firmware-2.6.27.25-78.2.56.fc9.noarch

[q.yang@localhost sierra_drv_1.7.32]$ rpm -qa|grep kernel |grep devel
kernel-devel-2.6.27.25-78.2.56.fc9.i686

[q.yang@localhost sierra_drv_1.7.32]$ rpm -qa|grep kernel |grep headers
kernel-headers-2.6.27.25-78.2.56.fc9.i386

[root@localhost sierra_drv_1.7.32]# yum install kernel-devel-2.6.25-14.fc9.i686
Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package kernel-devel.i686 0:2.6.25-14.fc9 set to be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================
Package Arch Version Repository Size
====================================================================================================================
Installing:
kernel-devel i686 2.6.25-14.fc9 fedora 5.1 M

Transaction Summary
====================================================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 5.1 M
Is this ok [y/N]: y
Downloading Packages:
kernel-devel-2.6.25-14.fc9.i686.rpm | 5.1 MB 00:21
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : kernel-devel 1/1

Installed:
kernel-devel.i686 0:2.6.25-14.fc9

Complete!


/*********************************/
/* Vi Relevant */
/* Created: 2007-Aug-16 THU */
/* Update: 2007-Aug-20 MON */
/* */
/* v0.0.0.1 added Yum relevant commands 2008-SEP-26 FRI */
/* v0.0.0.2 added vnc relevant commands 2008-SEP-27 SAT */
/* v0.0.0.3 added svn relevant commands 2008-OCT-01 WED */
/**********************************************************************/



DISPLAY DISK USAGE
------------------------------------------------------------------
[q.yang@localhost ~]$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
6063688 5204096 551576 91% /
/dev/sda6 194442 18921 165482 11% /boot
tmpfs 224740 96 224644 1% /dev/shm
gvfs-fuse-daemon 6063688 5204096 551576 91% /home/q.yang/.gvfs
[q.yang@localhost ~]$ su
Password:
[root@localhost q.yang]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
6063688 5204100 551572 91% /
/dev/sda6 194442 18921 165482 11% /boot
tmpfs 224740 96 224644 1% /dev/shm
[root@localhost q.yang]#



WHICH LINUX KERNEL TO BOOT
------------------------------------------------------------
[root@localhost kernel]# cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,5)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=2
timeout=5
splashimage=(hd0,5)/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.27.25-78.2.56.fc9.i686)
root (hd0,5)
kernel /vmlinuz-2.6.27.25-78.2.56.fc9.i686 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.27.25-78.2.56.fc9.i686.img
title Linux (2.6.25-14.fc9.i686)
root (hd0,5)
kernel /vmlinuz-2.6.25-14.fc9.i686 ro root=UUID=916c799e-4ae5-4820-8de6-0bbc5b7b8968 rhgb quiet
initrd /initrd-2.6.25-14.fc9.i686.img
title Win2000
rootnoverify (hd0,0)
chainloader +1

[root@localhost kernel]# ll /boot/
total 12767
-rw-r--r-- 1 root root 86348 2008-05-01 20:34 config-2.6.25-14.fc9.i686
-rw-r--r-- 1 root root 90947 2009-06-19 02:57 config-2.6.27.25-78.2.56.fc9.i686
drwxr-xr-x 3 root root 1024 2010-06-04 02:19 efi
drwxr-xr-x 2 root root 1024 2010-06-07 14:42 grub
-rw------- 1 root root 3294836 2010-06-04 02:21 initrd-2.6.25-14.fc9.i686.img
-rw------- 1 root root 3326324 2010-06-07 14:42 initrd-2.6.27.25-78.2.56.fc9.i686.img
drwx------ 2 root root 12288 2010-06-04 02:11 lost+found
-rw-r--r-- 1 root root 892575 2008-05-01 20:34 System.map-2.6.25-14.fc9.i686
-rw-r--r-- 1 root root 976362 2009-06-19 02:57 System.map-2.6.27.25-78.2.56.fc9.i686
-rwxr-xr-x 1 root root 2088288 2008-05-01 20:34 vmlinuz-2.6.25-14.fc9.i686
-rwxr-xr-x 1 root root 2227280 2009-06-19 02:57 vmlinuz-2.6.27.25-78.2.56.fc9.i686




FIND COMMAND USAGE
-----------------------------
Only find current directory without search sub-dir using '-maxdepth 1'
[q.yang@localhost ProjProgrammingTest]$ find ./include/ -maxdepth 1 -name '*' |grep .h
./include/Misc.h
./include/CommsLinkSessionManager.h
./include/Gpio.h
./include/GsnDataTypes.h
./include/DeviceTcpTx.h
./include/CommsMain.h
./include/Stack61850.h
./include/StackSpac.h
./include/StackDnp3.h
./include/StackGserver.h


[qyang@pc6de4 ~/ns-allinone-2.28]$ find . -name "n?.*" -print under tcsh&bash
./tk8.4.5/library/msgs/nl.msg
./lib/tk8.4/msgs/nl.msg
./ns-2.28/ns-tutorial/ns.html
./ns-2.28/diffusion3/lib/nr/nr.cc
./ns-2.28/diffusion3/lib/nr/nr.o
./ns-2.28/diffusion3/lib/nr/nr.hh
./ns-2.28/doc/ns.bib
./ns-2.28/ns.1

find . -wholename './.metadata' -prune -o -print //exclude certain directory
find . ! -name '*.class' //exclude certain file pattern

[q.yang@localhost ProjProgrammingTest]$ find ./include/ -maxdepth 1 -name '*.h' -exec wc {} \;
line words characters
42 87 968 ./include/Misc.h
131 414 4487 ./include/CommsLinkSessionManager.h


DELETE ALL FOLDERS WITH CERTAIN NAME PATTERN
---------------------------------------------------
[q.yang@localhost ltib-qs]$ find . -noleaf -name '.svn' -exec rm -r -f {} \;

FIND STRING IN ALL CERTAIN FILES
------------------------------------------------------------
First one can show line number
[q.yang@localhost ltib-qs]$ fd "*.*con*" -print0 | xargs -0 grep MODLIST -rn
./config/profile/swang.config:301:CONFIG_SYSCFG_MODLIST=""
./config/profile/swang-poc.config:307:CONFIG_SYSCFG_MODLIST=""
./config/platform/phy3250/ChkGsnMake_Config.config:455:CONFIG_SYSCFG_MODLIST=""
./config/platform/phy3250/GsnMake.config:455:CONFIG_SYSCFG_MODLIST=""
./config/platform/phy3250/GsnMake.config.old:455:CONFIG_SYSCFG_MODLIST=""
./config/platform/phy3250/.config:455:CONFIG_SYSCFG_MODLIST=""
./config/platform/phy3250/RoofsToNAND_Flash.config:455:CONFIG_SYSCFG_MODLIST=""

This cannot show line number but just the string result after search

[q.yang@localhost Documentation]$ grep endpoint . -r *.txt
./MSI-HOWTO.txt:PCI Express endpoints uses INTx emulation (in-band messages) instead
./input/yealink.txt:A: The sysfs files are located on the particular usb endpoint. On most
./sound/alsa/Audiophile-Usb.txt:parse_audio_endpoints function uses a quirk called
./sound/alsa/soc/dapm.txt:An endpoint is a start or end point (widget) of an audio signal within the
./sound/alsa/soc/dapm.txt:snd_soc_dapm_set_endpoint(codec, "Widget Name", 0);



FIND YUM PACKAGE BY KEY WORDS
---------------------------
[root@localhost q.yang]# yum search ppp


CHANGE ALL FOLDERS/FILES OWNERSHIP (user,group)
--------------------------------------------------
[q.yang@localhost ltib-qs]$ chown -c -R q.yang:q.yang .


LIST FILE SORTED BY TIME
------------------------------------------
[q.yang@localhost lpc3250]$ ls -lt ltib-qs/config/platform/phy3250/




//-------------------------------
//php+apache+msql installation
//
[root@QuentinFedoraHome q.yang]# rpm -qa | grep mysql
mysql-connector-java-3.1.12-5.fc9.i386
mysql-libs-5.0.51a-1.fc9.i386
[root@QuentinFedoraHome q.yang]# rpm -qa | grep httpd
httpd-tools-2.2.8-3.i386
httpd-2.2.8-3.i386
[root@QuentinFedoraHome q.yang]# rpm -qa | grep php
[root@QuentinFedoraHome q.yang]#



//------------------------------
//Svn relevant commands
//




Now, you use svn merge to replicate your branch changes back into the trunk.
$ pwd
/home/user/calc-trunk
$ svn update # (make sure the working copy is up to date)
At revision 390.
$ svn merge --reintegrate http://svn.example.com/repos/calc/branches/my-calc-branch
--- Merging differences between repository URLs into '.':
U button.c
U integer.c
U Makefile
U .
$ # build, test, verify, ...
$ svn commit -m "Merge my-calc-branch back into trunk!"
Sending .
Sending button.c
Sending integer.c
Sending Makefile
Transmitting file data ..
Committed revision 391.

[q.yang@QuentinFedoraHome ~]$ ssh-keygen -b 1024 -t dsa -N passphrase -f
keyfileGenerating public/private dsa key pair.
Your identification has been saved in keyfile.
Your public key has been saved in keyfile.pub.
The key fingerprint is:
50:81:da:e8:e9:b1:11:ec:f6:89:ac:3c:cf:a8:bd:05 q.yang@QuentinFedoraHome
[q.yang@QuentinFedoraHome ~]$ ls -l keyfile*
-rw------- 1 q.yang q.yang 744 2008-10-01 17:20 keyfile
-rw-r--r-- 1 q.yang q.yang 614 2008-10-01 17:20 keyfile.pub

http://tortoisesvn.net/ssh_howto

[q.yang@QuentinFedoraHome ~]$ svn list file:///var/svn/repos_personal/Doc_Documents
[q.yang@QuentinFedoraHome ~]$ svn import ~/Doc_Documents file:///var/svn/repos_personal/Doc_Documents -m "Initial import"

[q.yang@QuentinFedoraHome Svn_Repositories]$ svn checkout svn://10.1.1.7/var/svn/repos_personal/

$ svnadmin create /var/svn/newrepos

//-------------------------------------------
//Samba
//

[root@QuentinFedoraHome q.yang]# service smb restart
Shutting down SMB services: [ OK ]
Starting SMB services: [ OK ]
[root@QuentinFedoraHome q.yang]# chkconfig smb on
[root@QuentinFedoraHome q.yang]# system-config-users

[root@QuentinFedoraHome q.yang]# yum install system-config-samba

system-config-services gui services management

//-------------------------------------------
// VNC server in linux
//

#chkconfig vncserver on

#service vncserver restart

VNCSERVERS="1:q.yang 2:m.xie"
VNCSERVERARGS[1]="-geometry 1024x768 "
VNCSERVERARGS[2]="-geometry 800x600 "


[root@QuentinFedoraHome q.yang]# vi /etc/sysconfig/vncservers

[q.yang@QuentinFedoraHome Code_Shells]$ vncserver -kill:2

[tchung@tchung101 tchung]$ sudo /sbin/service iptables restart restart firewall


[root@QuentinFedoraHome Code_Shells]# vi /etc/sysconfig/iptables change firewall


#rpm -q vnc vnc-server

//-------------------------------------------
//user management chgrp,chown,useradd,passwd,chmod
//

[root@QuentinFedoraHome q.yang]# groupadd admin
[root@QuentinFedoraHome q.yang]# groupadd master
[root@QuentinFedoraHome q.yang]# groupadd family
[root@QuentinFedoraHome q.yang]# groupadd users
groupadd: group users exists


[root@QuentinFedoraHome q.yang]# vi /etc/default/useradd
[root@QuentinFedoraHome q.yang]# vi /etc/group


CHANGE USER'S GROUP
------------------------
[root@QuentinFedoraHome q.yang]# usermod -g admin -G users,family,master q.yang


[root@QuentinFedoraHome svn]# chmod 711 -R repos_personal/
[root@QuentinFedoraHome svn]# ll repos_personal/db/
total 28
-rwx--x--x 1 root root 6 2008-10-03 09:20 current
-rwx--x--x 1 q.yang root 2 2008-09-28 23:22 format
-rwx--x--x 1 q.yang root 5 2008-09-28 23:22 fs-type
drwx--x--x 2 q.yang root 4096 2008-10-03 09:20 revprops
drwx--x--x 2 q.yang root 4096 2008-10-03 09:20 revs
drwx--x--x 2 q.yang root 4096 2008-10-03 09:20 transactions
-rwx--x--x 1 q.yang root 37 2008-09-28 23:22 uuid
-rwx--x--x 1 q.yang root 0 2008-09-28 23:22 write-lock
[root@QuentinFedoraHome svn]# man chown
[root@QuentinFedoraHome svn]# man chown
[root@QuentinFedoraHome svn]# chown -R q.yang repos_personal/
[root@QuentinFedoraHome svn]# ll repos_personal/db/
total 28
-rwx--x--x 1 q.yang root 6 2008-10-03 09:20 current
-rwx--x--x 1 q.yang root 2 2008-09-28 23:22 format
-rwx--x--x 1 q.yang root 5 2008-09-28 23:22 fs-type
drwx--x--x 2 q.yang root 4096 2008-10-03 09:20 revprops
drwx--x--x 2 q.yang root 4096 2008-10-03 09:20 revs
drwx--x--x 2 q.yang root 4096 2008-10-03 09:20 transactions
-rwx--x--x 1 q.yang root 37 2008-09-28 23:22 uuid
-rwx--x--x 1 q.yang root 0 2008-09-28 23:22 write-lock


[root@QuentinFedoraHome svn]# ll
total 8
drwx--x--x 7 q.yang root 4096 2008-09-28 23:22 repos_personal
drwxrwxr-x 7 q.yang root 4096 2008-09-28 22:48 repos_projects
[root@QuentinFedoraHome svn]# chgrp -R 100 repos_projects/
[root@QuentinFedoraHome svn]# ll
total 8
drwx--x--x 7 q.yang root 4096 2008-09-28 23:22 repos_personal
drwxrwxr-x 7 q.yang users 4096 2008-09-28 22:48 repos_projects


[root@bigdog /root]# useradd blarg add account
[root@bigdog /root]# passwd blarg set pwd or change pwd(when user logged in)


yum list updates
yum update update system
yum list selinux-policy*

[root@blackrock .vnc]# yum list selinux-policy*
Loaded plugins: refresh-packagekit
Installed Packages
selinux-policy.noarch 3.3.1-55.fc9 installed
selinux-policy-devel.noarch 3.3.1-55.fc9 installed
selinux-policy-targeted.noarch 3.3.1-51.fc9 installed
Available Packages
selinux-policy-mls.noarch 3.3.1-51.fc9 updates

[root@blackrock /]# more ~topping/.vnc/blackrock.orb.org:1.log




:file ;display current file name
:set wrap ;wrap text
:set nowrap ;don't wrap text when display
:set winwidth ;set where to wrap text when editing file

cp [-drsu] u is used for update of file used for backup

/etc/rc.d/init.d ./smb start ./smb stop ./smb restart
$cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswd ; then delete all other password lines
smbpasswd -a QuentinYANG ; add samba password for user QuentinYANG
testparm ;test samba service from smb.conf
smbclient -L localhost ;list samba service on localhost or other ip address

ifconfig eth0 10.0.0.23

df -h list disk occupacy infor
du -s
rpm -q -a > /home/packages.log
rpm -ivf --nodeps --force
grep hp /home/packages.log
grep instance . -R -recursive searching subdirectories
grep -i -r --include=*.txt Q: ~/Doc_PdfTxtHtm/ -i means ignor the case, --include, --exclude=PATTERN means can search only some files with such a PATTER
grep timer . -r *.java (is a simple way to serch some text pattern like "timer" in all *.java files of all subdirectories)
egrep -i 'Average | x ' ~/driver_heartbeat_debug_01.log '|' means, match either pattern, here we have to use egrep for extend searching
egrep "id\(\<$NodeId\>|\<$NodeId2\>|\<$NodeId3\>" temp.log > temp1.log
rpm -e scim scim-tables scim-chewing
rpm -q scim -i


nmap -v 130.130.10.126
/sbin/ifconfig list ip address
route

ps -aux | grep pdf list all process
kill 19862 kill process with pid

ls -D all
ll -cX ./Doc_PdfTxtHtm/ -c means sort by file name, time,-X by file extention
ll -t ./Doc_PdfTxtHtm/ -t sort by file change time

# learn wht is the different of single quotation mark and double quotation mark
# and how to search two types of files with different extention name at the
# same time
echo "fd "*.*" |egrep '*.jpy|*.bsh'" >> ~/Doc_PdfTxtHtm/linux_commandlist.txt
fd *.* |egrep '*.jpy|*.bsh'
echo "fd '"*.*"' |egrep '*.jpy|*.bsh'" >> ~/Doc_PdfTxtHtm/linux_commandlist.txt
fd '*.*' |egrep '*.jpy|*.bsh'
echo "fd \"*.*\" |egrep '*.jpy|*.bsh'" >> ~/Doc_PdfTxtHtm/linux_commandlist.txt
fd "*.*" |egrep '*.jpy|*.bsh'
ln -s ~/Doc_PdfTxtHtm/link_list.txt .
mv -v * ~/MyMac/
fd *.jar -exec jar tvf {} \; |grep InputStreamReader
fd "*.java" -mtime -5
touch eclipseMyMac.tar
fd "*.java" -mtime -5 -exec tar -uvf eclipseMyMac.tar {} \;
grep "found neighbour:" . -r -n *.java // search string pattern in *.java files under all subdirectories and printout line number in that file as well
fd "*.java" -print0 | xargs -0 grep log -rn //search string pattern in files generated from file search result
find . -wholename './.metadata' -prune -o -print //exclude certain directory
find . ! -name '*.class' //exclude certain file pattern
fd "*.java" -mtime -8 -exec ls -all -ct {} \; // search files changed over last 8 days and list their time stamp and sorted by changed time

date +%g%m%d%H //06100123 yymmddhh date shell
#uname -r or #rpm -q kernel //list the kernel version

. logAnalysis.sh 16 ringInfo16135050_appcw1000.log | cut -d" " -f1 //cut -d define what symbole is used to seperate input string. -f define what field to print, 1st or 2nd after cutting.

. logAnalysis.sh 16 ringInfo16135050_appcw1000.log | cut -d" " -f1 | uniq -c | sort -rn
// uniq -c will count number of repeat times of same patten lines. sort -rn
// sort all lines according to the number of repeat times.

cscope
find /home/quentin/eclipse_workspace/MyMac/src/ -name "*.java" > ~/eclipse_workspace/MyMac/src/cscope.files

cscope -b
cscope -R

ctags -n -f cppcomplete.tags --fields=+ai --C++-types=+p * -L cscope.files
cvs -d /usr/local/newrepos init //create repository in path /usr/local/newrepos

cvs import -d -m "initial import into CVS from eclipse MyMac on Mimir" MyMacProj quentin start //-d option to keep modified time CVS_ROOT already set up, so import to CVS root directory, import files to repository, execute this command on top level of ur project folder which u want to add to repository

cvs checkout MyMacProj //check out one work copy in the folder u want to edit

cvs status ./src/jist/swans/app/AppRingschedule.java
cvs log ./src/jist/swans/app/AppRingschedule.java
cvs ci -m"back to the stage passing growth of tree"
cvs update

cvs -q tag Release-2006_09_30 // add tag to all files at their current version
cvs -q tag Release-2006_10_06-AdditiveRadioSNR
cvs tag Backup-2006_10_11-HalfwayStartScheduling ./src/jist/swans/mac/MacCsmaCa.java



cvs co -r Release-2006_09_30 MyMacProj //check out a work copy based on one tag "Release-2006_09_30"

cvs update -r Release-2006_09_30 // get a snapshot of one version with tag, without checkout all the files
cvs update -d // run update with the -d flag, telling it to bring down any new directories from the repository.
cvs update -P // prune useless directiories
cvs status ./src/driver/ringschedule.java //check on file status, u can see the Sticky Tag: Release-2006_09_30 (revision: 1.1.1.1)
cvs -q update -A ./src/driver/ringschedule.java // release the sticky state of one file so that get the latest version of this file

cvs -d:pserver:anon@jist.ece.cornell.edu:/cvs-jist login

cvs -d:ext:quentin@mimir.snrc.uow.edu.au:/home/quentin/CvsMyMac login
cvs -Q update -p -r 1.3 hello.c > hello.c //reverse to previous version

yarkon$ cvs add newfile.c //add files
yarkon$ cvs ci -m "added newfile.c" newfile.c

yarkon$ mkdir c-subdir
yarkon$ cvs add c-subdir

yarkon$ rm newfile.c //remove files
yarkon$ cvs remove newfile.c
yarkon$ cvs ci -m "removed newfile.c" newfile.c

yarkon$ rm file1 file2 file3 //remove directories
yarkon$ cvs remove file1 file2 file3
yarkon$ cvs ci -m "removed all files" file1 file2 file3
yarkon$ cd ..
yarkon$ cvs update -P

yarkon$ mv oldname newname //rename files
yarkon$ cvs remove oldname
yarkon$ cvs add newname
yarkon$ cvs ci -m "renamed oldname to newname" oldname newname

yarkon$ mkdir newdir //rename directories
yarkon$ cvs add newdir
yarkon$ mv olddir/* newdir
yarkon$ cd olddir
yarkon$ cvs rm foo.c bar.txt
yarkon$ cd ../newdir
yarkon$ cvs add foo.c bar.txt
yarkon$ cd ..
yarkon$ cvs commit -m "moved foo.c and bar.txt from olddir to newdir"
yarkon$ cvs update -P



ls . -R -D | grep /CVS | cut -d ":" -f1



////////////////////////////////////////////////////////////////////////
// Quentin study notes for unix
// focus on the command list in unix
// time History Author
// 6/9/2004 Created Quentin.YANG
// 17/8/2005 update in UOW Quentin.YANG
add vi guide;
// 18/8/2005 add web resource section Quentin.YANG
looking for LaTax-article
editing tool
// 25/8/2005 add linux config guide(CN)
// add Bash section
// add emacs section
// 20/6/2006 how to create own shell
//
//
// 29/6/2006 command combination list
///////////////////////////////////////////////////////////////////////

[root @test /root ]# cp [-drsu] [来源档] [目的档]
参数说明:
-d     :在进行 copy 的时候,如果是 copy 到 link 档案,若不加任何参数,则预设情
况中会将 link 到的源文件copy 到目的地,若加 -d 时,则 link 档案可原封不动的将 link 这个
快捷方式其拷贝到目的地!
-r     :可以进行目录的 copy 呦!
-s :做成连结档,而不 copy 之意!与 ln 指令相同功能!
-u, --update:如果来源档比较新,或者是没有目的档,那么才会进行 copy 的动作!可用于备
份的动作中


q: Rename directory? --wht unix command? A: just use mv
Q: wht is the difference between gzip and zip/unzip? //gzip -v -d abcd.gz
Alias? alias is set up in ~/.bashr
Q: How to recover files in Linux? How do use trash in linux?





如何查看硬件的芯片??
[root@linuxsir01 root]# lspci -v
要说明系统、版本以及内核的版本,用下面的命令来测试,
#uname –a

linux version:
/etc/redhat-release

新手有时对vi vim emacs 不太熟悉,这需要更适合新手用的文本编辑器。比如GNOME中的 gedit ,KDE中的kwrite或者kate等。
如果您用KDE或者GNOME,发行版中都有 gedit 或者kwrite,也应该有xedit 。
如果您是初学Linux,只是想找一些象Windows写字板那样简单功能的编辑器,leafpad 和mousepad足够用。如果在linux text模式下操作,不会用vi或者vim的情况下,用nano修改文件也是足够了。
本帖专为新手准备,希望能对初学Linux的弟兄有所帮助。


rpm -qa | grep vnc


把上面那些rpm都DOWN下来到一个文件夹。。。然后在控制台下输入:
#cd [你DOWN下RPM的文件夹]
#rpm -ivh *.rpm

rpm install, pacage management, refer to man rpm
这样全都OK了。。。。

兄弟,请看!
ftp://ftp.gtk.org/pub/gtk/v2.0/binary/old/RedHat-7.2/RPMS/i386/
rpm安装最简单。。。。。试一下吧。。有问题再发帖。。。
不要急,这就是学习。。。

--------------------------------------------------------------------------------

qepafrps02-06-21, 21:35
是呀,这里都是.rpm,不过很多呀,是不是还是把gtk,atk,glib,pango,这几个下了,一个一个的安呀,难道没有一个总的.rpm的那种吗?

========================= command combination list ===========================
$ls -all | less
$ls -all | grep .jar
$ls -all -R | grep .jar
$su temporary change user, default change to root so that having right to install software

=========== how to create own shell to backup personal files================



# fgrep bball etc/passwd
bball : x : 100 : 100 : William H. Ball , , , , : /home/bball : /bin/bash

==========Bash============================

bash的内建叁数很多,你可以自行"man bash"查一查。这里我只说明一些常用

及重要的。


PPID : 该bash的呼叫者process ID.


PWD : 目前的工作目录。


OLDPWD : 上一个工作目录。


HOSTTYPE : 机器种类。


OSTYPE : 作业系统名称。


PATH : 命令搜寻路径。



PATH="/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:."
发帖时间: 02-12-15, 02:58
查看系统环境变量的方法是用set,这是在bash下的。
[root@linuxsir01 root]# set
大熊宝宝说的也是一个方法,这个方法写入后,就不会使变量设置重新启动后丢失。
也可以这样做。。
改用户目录下的.bashrc
加入
PATH="$PATH:/tmp"




_____________________________________
请弟兄们发帖时要写个好标题,多谢!
签名不支持html和bbcode,请弟兄为了版面的整洁,请更改签名档,谢谢!
请各版版主及初学Linux的弟兄,请在您的签名写上机器的配置,以及您所用的系统(包装版本号,内核),谢谢。

Slackintosh 10.1+kernel-2.6.11.8+xfce-4.2.1.1
=====================================
帮助那些需要帮助的人── 吾师语录
世上没有踏不平的山,只有走不完的路!── 师兄语录


HOME : 目前使用者的home directory



Section=========emacs,==============================
C means Ctl key, M means Alt key;
control cursor C-p,C-n,C-b,C-f;M-f;(move by words) C-l center the text to your cursor;
C-a,C-e; move the start and end of one line;

C-h w command - to check which key bind to the command
;; C-h k key - to check which command the key bind to
;; C-j - run the lisp command(put the cursor at end)
;;
;; C-c C-t - change mode to hungry-state and auto-state
;; C-c C-a - change mode to auto-state
;; C-c C-d - change mode to hungry-state
;; C-c C-e - expand macro
;; C-c C-\ - add '\' at then end of the line
;; C-u C-s - regular expression search
;; C-x 5 2 - open new frame
;; C-x 5 0 - close new frame
;;
;; M-; - insert a comment
;; M-\ - fixup whitespace
;; M-/ - auto complete the word
;; M-l - downcase-word
;;
;; Mark the region, then
;;
;; C-x r k - kill rectangle
;; C-x r t - insert word in columns


C-x C-f :打开/新建文件
C-x S :保存所有缓冲区文件
C-x C-v:在当前缓冲区打开文件
C-x k :关闭当前缓冲区
C-x i : 在当前光标位置插入文件
M-x replace-string: 一次性替换字符串
M-x % : 循环替换。
C-s
C-r :查询

C-@ :设置标记,然后选取
C-w :相当于剪切。
M-w :相当于复制
C-y :粘贴
M-y : 循环粘贴。

C-o:开新行

C-f, C-b, C-p, C-n, M-f, M-b, C-v , M-v , C-l, M-< 移动。M->,


C - !, 一次性执行shell, M-x shell, 启动shell外壳。
M-x compile:编译程序。



Under cygwin, C-x,C-c does not work to exit emacs; have to press F10, then f,e to exit emacs; Also, C-h,C-t does not enter tutorial, Try to use F1 and then option ? then "t", emacs tutorial;



Section ======unix=========================================================
after ns2 install

----------------------------------------------------------------------------------

Please put /home/qyang/ns-allinone-2.28/bin:/home/qyang/ns-allinone-2.28/tcl8.4.5/unix:/home/qyang/ns-allinone-2.28/tk8.4.5/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.

IMPORTANT NOTICES:

(1) You MUST put /home/qyang/ns-allinone-2.28/otcl-1.9, /home/qyang/ns-allinone-2.28/lib,
into your LD_LIBRARY_PATH environment variable.
If it complains about X libraries, add path to your X libraries
into LD_LIBRARY_PATH.
If you are using csh, you can set it like:
setenv LD_LIBRARY_PATH
If you are using sh, you can set it like:
export LD_LIBRARY_PATH=

(2) You MUST put /home/qyang/ns-allinone-2.28/tcl8.4.5/library into your TCL_LIBRARY environmental
variable. Otherwise ns/nam will complain during startup.

(3) [OPTIONAL] To save disk space, you can now delete directories tcl8.4.5
and tk8.4.5. They are now installed under /home/qyang/ns-allinone-2.28/{bin,include,lib}

After these steps, you can now run the ns validation suite with
cd ns-2.28; ./validate

For trouble shooting, please first read ns problems page
http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive
for related posts.






gunzip,unzip,tar;if forget the option can use "$tar --help"
Ctr+C;terminate process;
edit ~/.bashrc,set your ENV;

try to find the path of some command by "where" only availabe under Tcsh
[qyang@pc6de4 ~]$ where is tcsh
---/bin/tcsh
[qyang@pc6de4 ~]$ pwd
/home/qyang
[qyang@pc6de4 ~]$ ls /
bin dev home lib misc opt root selinux tmp var
boot etc initrd lost+found mnt proc sbin sys usr
[qyang@pc6de4 ~]$ ls /bin
arch cpio env kill netstat sed traceroute
ash csh ex link nice setfont traceroute6
ash.static cut false ln nisdomainname setserial true
aumix-minimal date fgrep loadkeys pgawk sh umount
awk dd gawk login ping sleep uname
basename df gettext ls ping6 sort unicode_start
bash dmesg grep mail ps stty unicode_stop
bash2 dnsdomainname gtar mkdir pwd su unlink
bsh doexec gunzip mknod red sync usleep
cat domainname gzip mktemp rm tar vi
chgrp dumpkeys hostname more rmdir tcsh view
chmod echo igawk mount rpm touch ypdomainname
chown ed ipcalc mt rvi tracepath zcat
cp egrep kbd_mode mv rview tracepath6
[qyang@pc6de4 ~]$ emacs
[qyang@pc6de4 ~]$ wher is emacs
wher: Command not found.
[qyang@pc6de4 ~]$ where is emacs
---/usr/bin/emacs



Section--from /for_unix_beginner/-----
--% echo $OSTYPE
USER (your login name)
HOME (the path name of your home directory)
HOST (the name of the computer you are using)
ARCH (the architecture of the computers processor)
DISPLAY (the name of the computer screen to display X windows)
PRINTER (the default printer to send print jobs)
PATH (the directories the shell should search to find a command)
setenv; printenv or env; unsetenv; ENVIRONMENT variables are set using the command, displayed using the commands, and unset using the command
--% printenv | less show all values of these variables, type |less can not work in Cygwin

--% set | less To show all values of these variables, type |less can not work in Cygwin

--The C and TC shells uses two files called .login and .cshrc (note that both file names begin with a dot).Information in these files is used to set up your working environment.

% set history = 200
% echo $history
To PERMANENTLY set the value of history, you will need to add the set command to the .cshrc file
% nedit ~/.cshrc
% source .cshrc Save the file and force the shell to reread its .cshrc file buy using the shell source command

% "set path = ($path ~/units174/bin)" add it to the end of your existing path (the $path represents this) by issuing the command can't work under unix bash; can work after chang it to "export PATH=($PATH ~/units174/bin)"
% cd; pwd HINT: You can run multiple commands on one line by separating them with a semicolon.


Section----shortcut key--------
right click to paste;



Section=================----vi------------------
一、Unix编辑器概述

编辑器是使用计算机的重要工具之一,在各种操作系统中,编辑器都是必不可少的部件。Unix及其相似的ix操作系统系列中,为方便各种用户在各个不同的环境中使用,提供了一系列的ex编辑器,包括 ex, edit,ed 和vi.其中ex,edit,ed都是行编辑器,现在已很少有人使用,Unix提供他们的原因是考虑到满足各种用户特别是某些终端用户的需要。

值得庆幸的是,Unix提供了全屏幕的Vi编辑器,这使我们的工作轻松不少。不少DOS用户抱怨Vi编辑器不象DOS下的编辑器如edit那么好用,这是因为Vi考虑到各种用户的需要,没有使用某些通用的编辑键(在各个不同的终端机上他们的定义是不同的,在某些终端机上甚至没有这些键)。而是采用状态切换的方法,但这只是习惯的问题,一旦你熟练的使用上了vi你就会觉得它其实也很好用。虽然 Vi采用了状态切换的方法,但电脑的硬件及操作系统多种多样,某些电脑的键盘上没有特定的几个功能键!那麽不就有某些功能不能用了?这个问题在 Unix 系统上也一样,几乎各大电脑厂商都有自己的Unix 系统,而 vi 的操作方法也会随之有点出入。这里我们采用 PC 的键盘来说明 vi 的操作,但在具体的环境中还要参考相应的资料,这一点是值得注意的。

二、Vi入门

(一)、进入vi

在系统提示字符(如$、#)下敲入vi <档案名称>,vi 可以自动帮你载入所要编辑的文件或是开启一个新文件(如果该文件不存在或缺少文件名)。进入 vi 后萤幕左方会出现波浪符号,凡是列首有该符号就代表此列目前是空的。

(二)、两种模式

如上所述,vi存在两种模式:指令模式和输入模式。在指令模式下输入的按键将做为指令来处理:如输入a,vi即认为是在当前位置插入字符。而在输入模式下,vi则把输入的按键当作插入的字符来处理。指令模式切换到输入模式只需键入相应的输入命令即可(如a,A),而要从输入模式切换到指令模式,则需在输入模式下键入ESC键,如果不晓得现在是处於什麽模式,可以多按几次 [ESC],系统如发出哔哔声就表示已处于指令模式下了。

付:有指令模式进入输入模式的指令:

新增 (append)

a :从光标所在位置後面开始新增资料,光标後的资料随新增资料向後移动。

A: 从光标所在列最後面的地方开始新增资料。

插入 (insert)

i: 从光标所在位置前面开始插入资料,光标後的资料随新增资料向後移动。

I :从光标所在列的第一个非空白字元前面开始插入资料。

开始 (open)

o :在光标所在列下新增一列并进入输入模式。

O: 在光标所在列上方新增一列并进入输入模式。

(三)、退出vi

在指令模式下键入:q,:q!,:wq或:x(注意:号),就会退出vi。其中:wq和:x是存盘退出,而:q是直接退出,如果文件已有新的变化,vi会提示你保存文件而:q命令也会失效,这时你可以用:w命令保存文件后再用:q退出,或用:wq或:x命令退出,如果你不想保存改变后的文件,你就需要用:q!命令,这个命令将不保存文件而直接退出vi。

(四)、基本编辑

配合一般键盘上的功能键,像是方向键、[Insert] 、[Delete] 等等,现在你应该已经可以利用 vi 来编辑文件了。当然 vi 还提供其他许许多多功能让文字的处理更为方便。

何谓编辑?一般认为是文字的新增、修改以及删除,甚至包括文字区块的搬移、复制等等。先这里介绍 vi的如何做删除与修改。(注意:在 vi 的原始观念里,输入跟编辑是两码子事。编辑是在指令模式下操作的,先利用指令移动光标来定位要进行编辑的地方,然後才下指令做编辑。)

删除与修改文件的命令:

x: 删除光标所在字符。

dd :删除光标所在的列。

r :修改光标所在字元,r 後接著要修正的字符。

R: 进入取替换状态,新增文字会覆盖原先文字,直到按 [ESC] 回到指令模式下为止。

s: 删除光标所在字元,并进入输入模式。

S: 删除光标所在的列,并进入输入模式

其实呢,在PC上根本没有这麽麻烦!输入跟编辑都可以在输入模式下完成。例如要删除字元,直接按[Delete] 不就得了。而插入状态与取代状态可以直接用 [Insert] 切换,犯不著用什麽指令模式的编辑指令。不过就如前面所提到的,这些指令几乎是每台终端机都能用,而不是仅仅在 PC 上。
在指令模式下移动光标的基本指令是 h, j, k, l 。想来各位现在也应该能猜到只要直接用 PC 的方向键就可以了,而且无论在指令模式或输入模式下都可以。多容易不是。
当然 PC 键盘也有不足之处。有个很好用的指令 u 可以恢复被删除的文字,而 U 指令则可以恢复光标所在列的所有改变。这与某些电脑上的 [Undo] 按键功能相同。
三、附件:vi详细指令表
(一)、基本编辑指令:
新增 (append)

a :从光标所在位置後面开始新增资料,光标後的资料随新增资料向後移动。

A: 从光标所在列最後面的地方开始新增资料。

插入 (insert)

i: 从光标所在位置前面开始插入资料,光标後的资料随新增资料向後移动。

I :从光标所在列的第一个非空白字元前面开始插入资料。

开始 (open)

o :在光标所在列下新增一列并进入输入模式。

O: 在光标所在列上方新增一列并进入输入模式。

x: 删除光标所在字符。

dd :删除光标所在的列。

r :修改光标所在字元,r 後接著要修正的字符。

R: 进入取替换状态,新增文字会覆盖原先文字,直到按 [ESC] 回到指令模式下为止。

s: 删除光标所在字元,并进入输入模式。

S: 删除光标所在的列,并进入输入模式。

(二)、光标移动指令:
由於许多编辑工作是藉由光标来定位,所以 vi 提供许多移动光标的方式,这个我们列
几张简表来说明(这些当然是指令模式下的指令):

指令 说明  功能键
0 移动到光标所在列的最前面 [Home]
$  移动到光标所在列的最後面 [End]
[CTRL][d] 向下半页  [PageDown]
[CTRL][f] 向下一页
[CTRL][u] 向上半页
[CTRL][b] 向上一页 [PageUp]

指令 说明
H 移动到视窗的第一列
M 移动到视窗的中间列
L 移动到视窗的最後列
b 移动到下个字的第一个字母
w 移缴细鲎值牡谝桓鲎帜?nbsp; 
e 移动到下个字的最後一个字母
^ 移动到光标所在列的第一个非空白字元

指令 说明 
n- 减号移动到上一列的第一个非空白字元前面加上数字可以指定移动到以上 n 列
n+ 加号移动到下一列的第一个非空白字元前面加上数字可以指定移动到以下 n 列
nG 直接用数字 n 加上大写 G 移动到第 n 列
指令 说明
fx
往右移动到 x 字元上
Fx 往左移动到 x 字元上 
tx 往右移动到 x 字元前
Tx 往左移动到 x 字元前
; 配合 f&t 使用,重复一次
, 配合 f&t 使用,反方向重复一次
/string 往右移动到有 string 的地方
?string 往左移动到有 string 的地方
n  配合 /&? 使用,重复一次
N  配合 /&? 使用,反方向重复一次

指令 说明 备注
n(
左括号移动到句子的最前面句子是以前面加上数字可以指定往前移动 n 个句子 ! . ? 三种符号来界定
n) 右括号移动到下个句子的最前面前面加上数字可以指定往後移动 n 个句子 ! . ? 三种符号来界定
n{  左括弧移动到段落的最前面 段落是以段落间的空白列界定
n} 前面加上数字可以指定往前移动 n 个段落右括弧移动到下个段落的最前面前面加上数字可以指定往後移动 n 个段落 段落是以段落间的空白列界定


(三)、更多的编辑指令
这些编辑指令非常有弹性,基本上可以说是由指令与范围所构成。例如 dw 怯缮境噶?nbsp;d 与范围 w 所组成,代表删除一个字 d(elete) w(ord) 。
指令列表如下:
d 删除(delete)
y 复制(yank)
p 放置(put)
c 修改(change)
范围可以是下列几个:
e 光晁谖恢玫礁米值淖钺嵋桓鲎帜?br> w 光标所在位置到下个字的第一个字母
b 光标所在位置到上个字的第一个字母
$ 光标所在位置到该列的最後一个字母
0 光标所在位置到该列的第一个字母
) 光标所在位置到下个句子的第一个字母
( 光标所在位置到该句子的第一个字母
} 光标所在位置到该段落的最後一个字母
{ 光标所在位置到该段落的第一个字母
说实在的,组合这些指令来编辑文件有一点点艺术气息。不管怎麽样,它们提供更多编辑文字的能力。值得注意的一点是删除与复制都会将指定范围的内容放到暂存区里,然後就可以用指令 p 贴到其它地方去,这是 vi 用来处理区段拷贝与搬移的办法。
某些 vi 版本,例如 Linux 所用的 elvis 可以大幅简化这一坨指令。如果稍微观察一下这些编辑指令就会发现问题其实是定范围的方式有点杂,实际上只有四个指令罢了。指令 v 非常好用,只要按下 v 键,光标所在的位置就会反白,然後就可以移动光标来设定范围,接著再直接下指令进行编辑即可。对於整列操作, vi 另外提供了更方便的编辑指令。前面曾经提到过删除整列文字的指令 dd 就是其中一个;cc 可以修改整列文字;而 yy 则是复制整列文字;指令 D 则可以删除光标到该列结束为止所有的文字。
(四)、文件操作指令
文件操作指令多以 : 开头,这跟编辑指令有点区别。
:q 结束编辑(quit)
:q! 不存档而要放弃编辑过的文件。
:w 保存文件(write)其後可加所要存档的档名。
:wq 即存档後离开。
zz 功能与 :wq 相同。
:x 与:wq相同

-----------------------






========cygwin=================

发帖时间: 05-05-08, 23:53

谢谢,楼上指点。
1楼说的那个没有看到
2楼的方法试过了。最快的是ftp://ftp.cise.ufl.edu
当然我不是全部试过,不过ping了20个肯定不只。这个最快只有200多ms的延时。我是电信的。
大家以后可以试试。
度我也试过了爽,我2M带宽下载速度达到100K接近。^_^~!!!!大家试试吧。
~~~~5分钟后,我又来了。装好了。^_^
这里的热情让我激动不已。




uname -a returns following output:
CYGWIN_NT-5.0 PCS734 1.3.5(0.47/3/2) 2001-11-13 23:16 i686 unknown
--install the ns under cygwin must under bash;


Please put /home/ns2/ns-allinone-2.28/bin:/home/ns2/ns-allinone-2.28/tcl8.4.5/unix:/home/ns2/ns-allinone-2.28/tk8.4.5/unix into your PATH; so that u will be able to run itm/tclsh/wish/xgraph.

important notices:

1. must put /home/ns2/ns-allinone-2.28/otcl-1.9, /home/ns2/ns-allinone-2.28/lib into your LD_LIBRARY_PATH variable;if it complains about X libraries, add path to your X libraries into LD_LIBRARY_PATH.
using csh, can set it like: setenv LD_LIBRARY_PATH
using sh, set like this: export LD_LIBRARY_PATH=

2. must put /home/ns2/ns-allinone-2.28/tcl8.4.5/library into ur TCL_LIBRARY env variable. otherwise, ns/nam will complain during startup

3. optional, to save disk space, u can delete directories tcl8.4.5 and tk8.4.5 installed under /home/ns2/ns-allinone-2.28/{bin,include,lib}

after this u can run ns validation suite with cd ns-2.28; ./validate


---set path for ns2----------------------
PATH="$PATH:/home/qyang/ns-allinone-2.28/bin:/home/qyang/ns-allinone-2.28/tcl8.4
.5/unix:/home/qyang/ns-allinone-2.28/tk8.4.5/unix"

#set env LD_LIBRARY_PATH /home/ns2/ns-allinone-2.28/otcl-1.9 wrong
#set env /home/ns2/ns-allinone-2.28/lib wrong
#no command setenv
#set LD_LIBRARY_PATH=/home/qyang/ns-allinone-2.28/otcl-1.9 wrong
#set env LD_LIBRARY_PATH /home/qyang/ns-allinone-2.28/lib wrong

#export LD_LIBRARY_PATH=/home/qyang/ns-allinone-2.28/otcl-1.9
#export LD_LIBRARY_PATH=/home/qyang/ns-allinone-2.28/lib
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/qyang/ns-allinone-2.28/otcl-1.9:/home/qy
ang/ns-allinone-2.28/lib"










u user
g group
o other
a all
r read
w write (and delete)
x execute (and access directory)
+ add permission
- take away permission
% chmod go-rwx biglist
% chmod a+rw biglist

cp file1 file2 copy file1 and call it file2
mv file1 file2 move or rename file1 to file2
rm file remove a file
rmdir directory remove a directory
cat file display a file
more file display a file a page at a time
head file display the first few lines of a file
tail file display the last few lines of a file
grep 'keyword' file search a file for keywords
wc file count number of lines/words/characters in file

还可以通过使用- R选项连同子目录下的文件一起设置:
chmod -R 664 /usr/local/home/dave/*

有相当一些U N I X命令也设置了s u i d和g u i d。如果想找出这些命令,可以进入/ b i n或/ s b i n目
录,执行下面的命令:
$ ls -l | grep '^...s'
上面的命令是用来查找s u i d文件的;
$ ls -l | grep '^...s..s'

u m a s k命令来改变文件创建的缺省权限

软链接实际上就是一个指向文件的指针。你将会发现这种软链接使用起来非常方便。你可以在每一位用户的$ H O M E目录下建立一个指向该文件的链接,而不是在每个目录下拷贝一份。这样当需要更改这一文
件时,只需改变一个源文件即可

$ find . -perm 755 -print
$ find ~ -user dave -print

$ find . -newer age.awk ! -newer belts.awk -exec ls -l {} \;

$touch -t 05042140 dstamp

在当前的文件系统中查找文件(不进入其他文件系统),可以使用f i n d命令的m o u n t选项
$ find . -name "*.XC" -mount -print



% echo $history
% set | less
.cshrc or .login
% nedit ~/.cshrc
% source .cshrc
% set path = ($path ~/units174/bin) //add to variable path
% cd; units //HINT: You can run multiple commands on one line by separating them with a semicolon.



$0$1$2$3$$$?$# --014.pdf-p143 shell编程和unix命令

使用u n s e t命令清除环境变量:

















Section===============新手入门循序渐进学习LINUX之软件配置=======================


LINUX配置

  在这里,配置的对象并非内核,而是软件。至于网络的配置,主要在安装系统是已经基本完成;也可以进入GUI界面从菜单选择liloconf来配置。


  与WINDOWS一样,在LINUX系统可以从光盘、软盘安装应用软件;但不同的是,它需要用命令mount来登录光驱、软驱。而且,软件大多是经过压缩的,所以还需要懂得如何解压。最后必须配置、编译才能运行。下面分四个方面进行介绍:


  一、mount登录

  LINUX的软驱设备用特殊文件/dev/fd0,文件系统是msdos,因此用以下命令登录,读取软盘内容:

  # mount -t msdos /dev/fd0 /mnt/floppy
  # cd /mnt/floppy
  同理,键入以下命令读光盘:
  # mount -t iso9660 /dev/hdb /mnt/cdrom
  # cd /mnt/cdrom
  然后,用cp命令将所需的软件拷贝到系统中。
  退出软驱、光驱用umount命令。注意,不能在其目录中使用此命令,而应先cd到其他目录,再使用:umount /mnt/cdrom。

  
  二、安装软件

  for
LINUX的软件一般是以.gz或.tar或者.tar.gz结尾的。前者是由gzip压缩的,后者是先用tar归档,在用gzip压缩而成的。


  1、以.gz结尾的为压缩文件,用命令:gzip -d filename来解压,得到的文件在当前目录中,但已没有了.gz。

  2、以.tar结尾的为归档文件,用命令:tar -xvf filename来展开,生成的文件与源文件在同一目录中,只是少了.tar。


  3、以.tar.gz结尾的文件最常见,可直接用命令:gzip -cd filename | tar xfv -来安装。

  一般情况下,这类文件的第一项是一个目录,所以用上面的命令时会创建出这一个目录,并把所有的文件都存在此目录之下。如果是特殊情况,可先用命令:tar
-tvf filename | more 来查看文件的第一项。倘若它并不是目录,则先创建一个目录,把文件放在此目录之下,在用命令:tar
-xvf filename来安装。

  经过以上步骤,会生成README及INSTALL等文件。用vi来仔细阅读这些文件造处于LINUX有关的部分,更具体是进行配置。一般的步骤是:(1)./config,(2)make
install,(3)make。主要的变化在第一步,其后面需要参数,可见入命令来选择:./config --help。
  
  三、实践举例笔者曾配置了apache(阿帕其服务器)、php3两个软件。

  先从网上下载for LINUX的软件apache.tar.gz、php3.tar.gz。

  1、由于apache.tar.gz大于1.44M,所以笔者在center_5的MSDOS上用telnet命令登录LINUX,通过put将其上传。


  2、笔者将这两个软件放在/usr/src目录之下,用命令gzip -cd apache.tar.gz(php3.tar.gz)|
tar xfv -来安装。这样会看到两个目录:apache_1.3.6和php-3.0.7。

  3、在第一个目录之下,会看到非常重要的文件:README、INSTALL。如果此时是在GUI界面,则可以打开两个xterm,一个用于仔细阅读,一个则用于根据文件的提示进行配置。


  4、在第二个目录中,也会很快的找到文件:INSTALL、INSTALL.DSO、README.QNX。步骤与3相似。由于这两个文件相互关联,必须先配置前者。


  5、配置完后,进入/apache_1.3.6/conf/httpd.conf。在文件里面,理解其注释,删除或增加一些选项前的"#"。保存文件后,执行命令/usr/src/apache_1.3.6/bin/apachectl
start,即打开http,然后可以在Netscape Communication来浏览网页。

  心得体会在学习的一个多月来,笔者面对的是一个全新的操作系统,绝大多数操作是通过自己键入命令来实现的,从而能够深入到一定层次的了解操作系统内核。


  1、懂得了UNIX的一些基本命令;
  2、熟悉vi文本编辑;
  3、知道如何在LINUX、UNIX上编写、编译C、C++、JAVA程序;
  4、进一步了解了网络原理,动手配置了网络应用软件,从而也清楚了软件安装的一般步骤。
  5、毕竟现今for LINUX的应用软件少,而且RedHat
LINUX不支持中文,因而还不能完全脱离WINDOWS。因此,应发挥LINUX是一个非常优秀的网络服务器操作系统的优点,扬长避短。

  
=================from linuxsir bbs ==============
用dos的引导盘使用fdisk /mbr清除引导区信息!
然后用redhat的第一张光盘引导,进入linux rescue模式!
重新安装grub!

发帖时间: 05-03-31, 00:05
在GRUB中用单用户模式进去~~
然后vi /etc/shadow 找到ROOT把ROOT后一个MD5格式的字符串"干掉".保存~然后重启重新用单用户模式进入passwd root 自己输入需要的密码就好了~
--this can work by quentin, root:xxxxx:19333:....., just delete the xxx between colon. verified under red hat linux.

类似这样的,然后把键盘移动到该句,再按一下[e]键,在类似的语句后面加上 linux single。然后就按回车[enter]。然后出现另外一个界面,按一个[b]键。这样GRUB就把系统引入单用户模式了。
可能出现的是这样的。。。 just add linux single, can enter single mode, verified by quentin under red hat.


http://www.linuxsir.org/bbs/showthread.php?s=&threadid=16998 在GRUB系统引导程序下进入单用户模式的办法

http://www.linuxsir.org/bbs/showthread.php?s=&threadid=8721
http://www.linuxsir.org/bbs/showthread.php?s=&threadid=3393
发帖时间: 02-07-28, 00:48
让系统自动加载FAT32

用下面这个命令来判断我们的windows分区,这个命令能把所有硬盘上的分区都能列出来。这个命令比较强,哈。。最适合不知道自己的硬盘情况的弟兄。。。


[root@LinuxSir root]# fdisk -l

如果只列一个硬盘的可用下面这个命令,下面这两条命令,第一条是列第一个硬盘的,第二个是列第二个硬盘的,这两条命令和 fdisk -l结合起来,配合来用,效果最佳。我以我的硬盘来说。。。。也能用第一个命令。。这个比较简单,试一下就知道了
#fdisk -l /dev/hda
#fdisk -l /dev/hdb



Disk /dev/hda: 255 heads, 63 sectors, 4865 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 1147 9213246 7 HPFS/NTFS
/dev/hda2 1148 4864 29856802+ f Win95 Ext'd (LBA)
/dev/hda5 1148 2039 7164958+ 7 HPFS/NTFS
/dev/hda6 2040 2804 6144831 b Win95 FAT32
/dev/hda7 2805 3824 8193118+ b Win95 FAT32
/dev/hda8 3825 3830 48163+ 83 Linux
/dev/hda9 3831 4799 7783461 83 Linux
/dev/hda10 4800 4864 522081 82 Linux swap

从这上面,我们可以看来,/dev/hda6和/dev/hda7就是win下的fat32分区。

第二;我们加载windows的分区,是不是在linux下有个文件夹可以放下去?这样理解就对了。我们可以用下面的方法来操作。我在这个例子中,把/hda6的内容,我想放到WinE这个文件夹。另一个则是WinF,这个文件夹的命名,可以用你喜欢的。但修改/etc/fstab的内容时,也要用这个文件夹,也就是统一起来。。
#mkdir /mnt/WinE
#mkdir /mnt/WinF

注意大小写。。

或用鼠标点kde自带的浏览器在地址栏上输入:
/mnt
就能进入/mnt这个目录了。。
然后就按鼠标的右键来建目录,这个简单吧。。。哈。。

然后,我们来修改/etc目录下的fstab

/dev/hda6 /mnt/WinE vfat rw,codepage=936,iocharset=cp936 0 0
如果加E盘就是:
/dev/hda7 /mnt/WinF vfat rw,codepage=936,iocharset=cp936 0 0
然后在/mnt/下建立目录WinD和WinE
对于Redhat 8.0,应该把codepage=936去掉
然后在KDE桌面上用右键点击[新建]-》硬 盘-》然后就点几下鼠标就OK了。。。


如果手工mount分区如何做呢?
事前要建好目录,比如在/mnt目录下建一个tmp目录
#mkdir /mnt/tmp
然后就是mount了,mount也应该有个目的地吧,那我们就把目的地定为/mnt/tmp
比如我们mount /dev/hda1
如下:
#mount -o iocharset=cp936 /dev/hda1 /mnt/tmp


北南老大,我只在/etc/fstab中添加,另一个文件etc/mtab好像已经自动添加了.
是不是RH73有这个功能的?
哈哈。。兄弟,这个mtab是系统关机时umount时要用到的。。。

在mnt目录下建立你想要的分区名称如WinD,然后用下面的指令格式加载.
当然你可以在etc中修改fstab文件.这样可以自动加载
/dev/hda9 /mnt/F vfat default,codepage=936,iocharset=gb2312 0 0
******************************************************
我的fstab文件格式,参考一下
/dev/hda1 /mnt/C vfat default,codepage=936,iocharset=gb2312 0 0
/dev/hda7 /mnt/D vfat default,codepage=936,iocharset=gb2312 0 0
/dev/hda8 /mnt/E vfat default,codepage=936,iocharset=gb2312 0 0
/dev/hda9 /mnt/F vfat default,codepage=936,iocharset=gb2312 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu,codepage=936,iocharset=gb2312 0 0
这样可以显示中文的.你试一下

[root@localhost root]# fdisk -l

Disk /dev/hdc: 255 heads, 63 sectors, 4865 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 * 1 1217 9775521 c Win95 FAT32 (LBA)
/dev/hdc2 1218 4865 29302560 f Win95 Ext'd (LBA)
/dev/hdc5 1218 3046 14691411 b Win95 FAT32
/dev/hdc6 3047 3569 4200966 b Win95 FAT32
/dev/hdc7 3570 4092 4200966 b Win95 FAT32
/dev/hdc8 4093 4829 5919921 83 Linux
/dev/hdc9 4830 4865 289138+ 82 Linux swap
[root@localhost root]#
就是这个样子的 你帮我看看吧

mount -t vfat /dev/hdc5 /mnt/winD






Section==============Web Resources==============================
CN-------------www.linuxeden.com
CN-------------www.linuxforum.net
CN-------------www.linuxfans.org
CN-------------www.linuxsir.org/bbs
CN-------------http://bbs.chinaunix.net/viewthread.php?tid=746147
CN-------------http://fedora.linuxsir.org/main/?q=aggregator/sources/1
CN-------------http://linux.chinaunix.net/
CN-------------http://slack.linuxsir.org/main/?q=node/145

CN-------------http://www.math.zju.edu.cn/ligangliu/LaTeXForum/tex_edit.htm
CN-------------ftp://ftp.ctex.org/pub/tex/systems/ctex/ --download CTeX package
EN-------------ctan.tug.org/starter.html ---the comprehensive ReX Archive Network
EN-------------www.winedt.com ---winedit download
EN-------------www.tug.org/begin.html
EN-------------www.gnu.org/software/emacs/manual/---GNU Emacs Manual
EN---------http://rpmfind.net/linux/RPM 去这里找一下这几个包吧!
EN------http://grub4dos.sourceforge.net/ http://sourceforge.net/projects/grub4dos


EN-------------http://www.slackworld.net/01/tips.html


EN-------------http://gurus.com.au/JobSeeker/Default.aspx ----IT career



EN-----java--------http://forum.java.sun.com/thread.jspa?threadID=568603&messageID=2810271
EN-----java--------http://java.sun.com/j2se/1.4.2/docs/api/overview-summary.html
CN-----.Net--------http://www.chinaaspx.com/archive/Java/20906.htm China .net club/ is used for search a certain word, C-s is used for searching as well when reading info help ? to get command list for reading info

#uname //list system information, like kernel version.





#df -a -h


man: list hard disk space usage under linux.







# chown -R q.yang repos_personal/


man: change access right




#chgrp admin -R /opt/mysql/var/


man: change group


# chmod 771 -R /opt/mysql/var

man: change access right