Difference between revisions of "User talk:Bossa nesta"

From CDOT Wiki
Jump to: navigation, search
 
(29 intermediate revisions by the same user not shown)
Line 1: Line 1:
Mid-term Note - SPR720
+
= Agenda =
 
 
 
 
========================    File Permission    ========================
 
 
<pre>
 
<pre>
$ chmod 7777 rpm.txt ; ll rpm.txt
 
-rwsrwsrwt 1 BossaNesta BossaNesta 41310 2008-10-12 16:39 rpm.txt
 
$ chmod 7000 rpm.txt ; ll rpm.txt
 
---S--S--T 1 BossaNesta BossaNesta 41310 2008-10-12 16:39 rpm.txt
 
$ chmod 4234 rpm.txt ; ll rpm.txt
 
--wS-wxr-- 1 BossaNesta BossaNesta 41310 2008-10-12 16:39 rpm.txt
 
  
 +
TO DO:
 +
1. mNm, improvement
 +
2. prepare sem 2
 +
- NAD810
 +
- SCR821
 +
- SEC830
 +
- SRA840
 +
- SYA810
 +
- co-op
 +
3. osCommerce, Apache
 +
4. Arcade
  
> set-user-id (suid)
 
= use owner ID instead of current user ID
 
> set-group-id (sgid)
 
= inherit group ID from directory,
 
= sub-dir will automatic has same sgid
 
= even over sudo command and root ID
 
> sticky bit
 
= on old systems, file was not swapped out and stuck in memory
 
= a file in that directory can be renamed or deleted only by the
 
owner of the file/directory or the superuser.
 
 
</pre>
 
</pre>
  
========================    BASH SCRIPTING    ========================
+
= temp =
<pre>$ cal 16 2008 2>&1 >all-output.txt
 
run 'cal' with parameter "16 2008", err out to display/terminal,
 
output to "all-output.txt"
 
$ cal 16 2008 2>err.txt >all-output.txt
 
err out to "err.txt", output to file "all-output.txt"
 
 
 
grep "/bin/bash$" /etc/passwd | cut -d: -f1 |
 
          sort | mail -s "Bash users" joe@example.com
 
 
 
1. selects all BASH users from the system account file /etc/passwd
 
2. cuts out the user name ('cut -d: -f1')
 
3. sorts them into order ('sort')
 
4. e-mails them to joe@example.com with the subject line "Bash users".
 
 
 
$ vi $(date +%Y)-notes.txt
 
creat a note that start with year, forexample, "2007-note.txt", "2008-note.txt"
 
 
 
$ vi $(date +%Y%m%d)-notes.txt
 
creat a note with current year, month, date, e.g: "20081012-note.txt'
 
 
 
$ vi Nes$(date +%Y%m%d)-notes.txt
 
creat a note with the name started with "Nes" follow by current year,
 
month, date, e.g: "Nes20081012-note.txt'
 
 
 
 
 
= single quote is actual value/string, double or no quote is variable
 
 
 
$ X="Test"
 
$ echo "$X"
 
Test
 
$ echo '$X'
 
$X
 
$ echo $X
 
Test
 
 
 
= ALWAYS use double quote for value
 
$ touch "test file"
 
$ NAME="test file"
 
$ rm $NAME
 
rm: cannot remove `test': No such file or directory
 
rm: cannot remove `file': No such file or directory
 
$ rm "$NAME"
 
 
 
= 'export' to turn variables into environment variables,
 
so, all sub process can use the variable(s)
 
$ TEST="Yes"
 
$ bash -c 'echo $TEST'
 
 
 
$ export TEST
 
$ bash -c 'echo $TEST'
 
Yes
 
$
 
 
 
= destory/erase variables
 
unset Var_NAME
 
 
 
 
 
Common Environment Variables
 
 
 
Variable  ↓ Description  ↓
 
$PATH command search paths
 
$HOME Current user's home directory.
 
$MAIL Current user's mailbox.
 
$DISPLAY X window display specification.
 
$TERM Current terminal type (used to analyze keypresses
 
and send special codes such as colours and effects to the terminal).
 
$SHELL Absolute pathname of the default shell for the current user.
 
$HOSTNAME Name of the host (computer) on which the shell is executing.
 
$PS1 Primary prompt, used by the shell to request a command from the user.
 
$PS2 Secondary prompt, used to request additional info from the user.
 
$PS3 3rd prompt (rarely used).
 
$PS4 4th prompt (rarely used).
 
 
 
= BASH automatically updates the value of certain special variables:
 
Variable  ↓ Description  ↓
 
$? Exit status of last pipeline
 
$$ Process ID of the current shell
 
$! Process ID of the last background pipeline
 
$RANDOM Random integer (usually in the range 0-327687).
 
 
 
 
 
Retrieving Exist Status
 
= ONLY '0' IS  successfull, the rest are error
 
$ ls /tmp >/dev/null
 
$ echo $?
 
0
 
$ ls /temp >/dev/null
 
ls: cannot access /temp: No such file or directory
 
$ echo $?
 
2
 
 
 
$ exit 2
 
Set exit variable to '2"
 
 
 
$ exit 2143
 
Set exit variable to '2143"
 
 
 
The test Command
 
 
 
= BASH has a built-in test command (similar to /bin/test)
 
which can perform basic string and integer comparisons
 
using these operators (results are returned as an exit code):
 
= return 0 or 1, where 0 is true, 1 is false
 
 
 
Operator Comparision type Comparison Example
 
-eq Integer Equal $x -eq 4
 
-ne Integer Not equal $x -ne 4
 
-gt Integer Greater than $x -gt 0
 
-lt Integer Less than $x -lt 1000
 
-ge Integer Greater/equal $x -ge $y
 
= String Equal "$x" = "Y"
 
!= String Not equal "$x" != "NEVER"
 
 
 
Unary File Tests
 
Operator Test Example
 
-e File exists [ -e /etc/passwd ]
 
-r File is readable [ -r /etc/hosts ]
 
-w File is writable [ -w /tmp ]
 
-x File is executable [ -x /usr/bin/ls ]
 
-f File is a regular file [ -f /dev/tty ]
 
-d File is a directory [ -d /dev/tty ]
 
 
 
= For example....
 
$ test 10 -gt 5
 
$ echo $?
 
0
 
 
 
$ test 10 -lt 5
 
$ echo $?
 
1
 
 
 
$ [ -w /etc/passwd ]
 
$ echo $?
 
1
 
 
 
$ a=10; [ "$a" -ge 100 -a "$a" -le 1000 ]; echo $?
 
1
 
 
 
$ [ ! "a" = "b" ]; echo $?
 
0
 
 
 
$ [ ! "a" != "b" ]; echo $?
 
1
 
 
 
======================== BASH FLOW CONTROL ========================
 
 
 
 
 
Format of 'if'
 
========================
 
if pipeline
 
then
 
  success-commands
 
[elif pipeline2
 
  else-if-commands
 
]
 
[else
 
  alt-commands
 
]
 
fi
 
========================
 
 
 
== CASE ==
 
echo -n "Are you sure you wish to remove '$file'?"
 
read YN
 
if [ "$YN" = "y" -o "$YN" = "Y" ]
 
then
 
  echo "Deleting '$file'..."
 
  rm "$file"
 
else
 
  echo "Aborted. '$file' not deleted."
 
fi
 
 
 
 
 
if [ "$(date +%Y)" -lt 2010 ]
 
then
 
  echo "Still waiting for the Whistler Olympics."
 
fi
 
 
 
 
 
Format of "while"
 
========================
 
while pipeline
 
do
 
  commands
 
done
 
========================
 
 
 
== CASE ==
 
num=1
 
while [ $num -le 5 ]
 
do
 
  echo $num
 
  num=$[ $num + 1 ]
 
done
 
 
 
== CASE ==
 
# In this case it will just print number 1 to 5
 
========================
 
while (( 1 ))
 
do
 
  eject -T
 
done
 
 
 
 
 
========================
 
Format of "for"
 
========================
 
for COLOUR in red blue green
 
do
 
  print "$COLOUR"
 
done
 
========================
 
for ((x=0; x<=10; x++))
 
do
 
  echo $x
 
done
 
========================
 
for FILE in /etc/*
 
do
 
  if [ -x $FILE ]
 
  then
 
      echo "$FILE is executable"
 
  fi
 
done
 
========================
 
 
 
</pre>
 
 
 
========================   RPM          ========================
 
 
<pre>
 
<pre>
RPM file names normally have the following format:
 
<name>-<version>-<release>.<arch>.rpm
 
 
== Query / Verify commands
 
  1. Getting detailed information:
 
      $ rpm -qi wget
 
  2. Determining which package installed /usr/bin/wget:
 
      $ rpm -qf /usr/bin/wget
 
  3. Showing all the files installed by the package wget:
 
      $ rpm -ql wget
 
  4. Viewing the documentation files for the command wget:
 
      $ rpm -qd wget
 
  5. Listing all files included in the not yet installed package wget
 
          by entering the following:
 
      $ rpm -qpl /mnt/iso/suse/i586/wget-1.10.2-78.i586.rpm
 
  6. Listing all files included in the installed package wget:
 
      $ rpm -ql wget
 
  7. Verifying that a package is no longer installed by entering:
 
      $ rpm -qa | grep wget
 
  8. Seeing what has changed in the files on your hard drive since the
 
wget RPM was originally installed by entering the following:
 
      $ rpm -V wget
 
  9. Checking package to ensure its integrity and origin: (NOTE: gpg or
 
pgp software must be installed on your system before you use this command)
 
      $ rpm -K /mnt/iso/suse/i586/wget-1.10.2-78.i586.rpm
 
  
== Install / Uninstall / Upgrade commands
 
  1. Installing the package wget:
 
      $ rpm -ivh /mnt/iso/suse/i586/wget-1.10.2-78.i586.rpm
 
  2. Uninstalling the package wget:
 
      $ rpm -e wget
 
  3. Upgrading the package wget: (NOTE: if the package is not installed
 
it will install it for You, like option "-ivh")
 
      $ rpm -Uvh /mnt/iso/suse/i586/wget-1.10.2-78.i586.rpm
 
  4. Extracting RPM file using rpm2cpio and cpio command: (NOTE: RPM content
 
will be extracted the current directory)
 
      $ rpm2cpio wget-1.10.2-78.i586.rpm | cpio -idmv
 
 
</pre>
 
</pre>
  
========================   SYA710          ========================
+
=Notes=
 +
[http://www.zytrax.com/books/dns/ch6/#slave dns example]
  
 
<pre>
 
<pre>
# Create a regular file (filled with zeros) as
 
the container for file system
 
  
      dd if=/dev/zero of=fakedisk bs=1024 count=10000
+
http://www.oscommerce.info/kb/osCommerce/General_Information
  
# associate file "fakedisk" with /dev/loop0
+
http://www.pumo.com.tw/www/products/FAQ/teach-osc.jsp
      losetup /dev/loop0 fakedisk
 
  
# Now create a file system in the container:
+
http://oscdox.com/crossx/nav.html?index.php.source.html
      mkfs -t ext2 /dev/loop0
 
# Make an ext3 file system in the new partition:
 
      mkfs -t ext3 /dev/sda4
 
  
# Mount the file system:
+
</pre>
      mount /dev/loop0 /mnt1
 
# mount /dev/sda4 into /mnt1
 
      mount /dev/sda4 /mnt1
 
# Unmount the file system
 
      umount /mnt1
 
  
# Display partition info
+
= Bookmark =
-h, --human-readable in K,M,G form
 
  
-i, --inodes print inodes instaed of block usage
 
-T, --print-type print file system type
 
      df -Thi /dev/loop0
 
  
# Delete the loop device
+
<DT><H3 FOLDED>Bookmarks Menu</H3>
      losetup -d /dev/loop0
+
<DL><p>
 
+
</DL><p>
# Inform the kernel of the change in the partition table
+
<DT><H3 FOLDED>_tmp</H3>
      partprobe
+
<DL><p>
 
+
<DT><A HREF="http://neosmart.net/wiki/display/EBCD/Mac+OS+X">Mac OS X - NeoSmart Technologies Wiki</A>
# Now copy the contents of your /home directory to this
+
<DT><A HREF="http://www.insanelymac.com/lofiversion/index.php/t3622.html">InsanelyMac Forum &gt; Help with adding OSX to GRUB</A>
new file system like this:
+
</DL><p>
      cp -a /home/* /mnt1
+
<DT><H3 FOLDED>LUX</H3>
 
+
<DL><p>
# make /dev/sda4 as /home, in  /etc/fstab file...
+
<DT><H3 FOLDED>Weekly</H3>
      /dev/sda4 /home ext3 defaults 1 3
+
<DL><p>
 
+
<DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/Fall_2008_NAD710_Weekly_Schedule#Week_12_.28Nov_24.29_-_Project_presentations">Fall 2008 NAD710 Weekly Schedule - Open Source@Seneca</A>
# initialize two unused partitions to LVM.
+
<DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/Fall_2008_SPR720_Weekly_Schedule">Fall 2008 SPR720 Weekly Schedule - Open Source@Seneca</A>
pvcreate /dev/sda5 /dev/sda6
+
<DT><A HREF="http://cs.senecac.on.ca/~murray.saul/XWN740/notes.html">Murray Saul's Seneca Webpage</A>
 
+
<DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/Fall_2008_SYA710_Weekly_Schedule">Fall 2008 SYA710 Weekly Schedule - Open Source@Seneca</A>
# Create a volume group 'seneca' and put physical volume /dev/sda5 into it.
+
<DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/Fall_2008_LPT730_Weekly_Schedule">Fall 2008 LPT730 Weekly Schedule - Open Source@Seneca</A>
vgcreate seneca /dev/sda5
+
</DL><p>
 
+
<DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/User_talk:Bossa_nesta">User talk:Bossa nesta - Open Source@Seneca</A>
# label partition /dev/seneca/home as "myhome"
+
<DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/LUX_Student_2008-2009">LUX Student 2008-2009 - Open Source@Seneca</A>
e2label /dev/seneca/home myhome
+
<DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/LUX_Program">LUX Program - Open Source@Seneca</A>
 
+
<DT><A HREF="http://zenit.senecac.on.ca/~chris.tyler/planet/">opensource@seneca</A>
# Verify a partition label
+
<DT><A HREF="http://de-luxer.blogspot.com/">De-Luxer</A>
e2label /dev/seneca/home
+
<DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/Windows_Data_Migration_Tool">Windows Data Migration Tool - Open Source@Seneca</A>
 
+
<DT><A HREF="http://sites.google.com/site/bossanesta/Home/isaschedule">ISA_Schedule (bossa_nesta)</A>
# add physical volumes to a volume group
+
<DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/Fall_2008_LUX_Grading">Fall 2008 LUX Grading - Open Source@Seneca</A>
vgextend seneca /dev/sda6
+
<DT><A HREF="https://wiki.ubuntu.com/MigrationAssistance">MigrationAssistance - Ubuntu Wiki</A>
 
+
</DL><p>
# extend the size of a logical volume
+
<DT><H3 FOLDED>iPhone</H3>
lvextend -L+1G /dev/seneca/home
+
<DL><p>
 
+
<DT><A HREF="http://testmyiphone.com/">Testmyiphone.com - iPhone Speed Test</A>
# ext2/ext3 file system resizer
+
<DT><A HREF="http://www.aptana.com/iphone">Aptana Studio: iPhone Development Plugin | Aptana</A>
resize2fs /dev/seneca/home
+
</DL><p>
 
+
<DT><H3 FOLDED>Python</H3>
# unpack a bz2 file into a directory
+
<DL><p>
tar xvjf linux-2.6.26.tar.bz2
+
<DT><A HREF="http://pbe.lightbird.net/">Python-by-example</A>
 
+
<DT><A HREF="http://docs.python.org/tutorial/">The Python Tutorial — Python v2.6 documentation</A>
# decompress a gz with gzip
+
<DT><A HREF="http://pbe.lightbird.net/">Python-by-example - best</A>
gzip -d config.gz
+
</DL><p>
 
+
<DT><H3 FOLDED>Nes</H3>
# creates initial ramdisk images for preloading modules 
+
<DL><p>
mkinitrd -k vmlinuz-2.6.26 -i initrd-2.6.26
+
<DT><A HREF="https://www1.royalbank.com/cgi-bin/rbaccess/rbunxcgi?F6=1&F7=IB&F21=IB&F22=IB&REQUEST=ClientSignin&LANGUAGE=ENGLISH">RBC Royal Bank - Sign In to Online Banking</A>
 
+
<DT><A HREF="http://eric.bachard.free.fr/news/2008/10/fsoss-2008-saturday.html">ericb's place: FSOSS 2008 : saturday</A>
</pre>
+
<DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/Talk:IPhone_Open_Source_Project">Talk:IPhone Open Source Project - Open Source@Seneca</A>
 +
<DT><A HREF="http://www.stevenlevy.com/index.php/other-books/crypto">StevenLevy.com » Crypto</A>
 +
</DL><p>
 +
<DT><H3 FOLDED>Seneca</H3>
 +
<DL><p>
 +
<DT><A HREF="https://my.senecacollege.ca/webapps/portal/frameset.jsp">Blackboard Academic Suite - My.Seneca</A>
 +
<DT><A HREF="https://learn.senecac.on.ca/">My.Seneca Student WEBmail</A>
 +
<DT><A HREF="http://fsoss.senecac.on.ca/2008/?q=node/39">Schedule | FSOSS 08</A>
 +
</DL><p>
 +
<DT><A HREF="http://www.gam.co.za/connectivity/bandwidth.php#">GamCo | Dynamic Internet Solutions</A>
 +
<DT><A HREF="http://utilities.globequest.com.ph/cgi-bin/BandWidthMeter.pl?session=1221629953">Speed Test Results</A>
 +
<DT><A HREF="http://cs.senecac.on.ca/~murray.saul/XWN740/notes.html">Murray Saul's Seneca Webpage</A>
 +
<DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/LPT730">LPT730 - Open Source@Seneca</A>

Latest revision as of 09:17, 10 March 2009

Agenda


TO DO:
1. mNm, improvement
2. prepare sem 2
 - NAD810
 - SCR821
 - SEC830
 - SRA840
 - SYA810
 - co-op
3. osCommerce, Apache
4. Arcade

temp


Notes

dns example


http://www.oscommerce.info/kb/osCommerce/General_Information

http://www.pumo.com.tw/www/products/FAQ/teach-osc.jsp

http://oscdox.com/crossx/nav.html?index.php.source.html

Bookmark

Bookmarks Menu

</DL><p>

_tmp

<p>
<A HREF="http://neosmart.net/wiki/display/EBCD/Mac+OS+X">Mac OS X - NeoSmart Technologies Wiki</A>
<A HREF="http://www.insanelymac.com/lofiversion/index.php/t3622.html">InsanelyMac Forum > Help with adding OSX to GRUB</A>
<p>

LUX

<p>

Weekly

<p>
<A HREF="http://zenit.senecac.on.ca/wiki/index.php/Fall_2008_NAD710_Weekly_Schedule#Week_12_.28Nov_24.29_-_Project_presentations">Fall 2008 NAD710 Weekly Schedule - Open Source@Seneca</A>
<A HREF="http://zenit.senecac.on.ca/wiki/index.php/Fall_2008_SPR720_Weekly_Schedule">Fall 2008 SPR720 Weekly Schedule - Open Source@Seneca</A>
<A HREF="http://cs.senecac.on.ca/~murray.saul/XWN740/notes.html">Murray Saul's Seneca Webpage</A>
<A HREF="http://zenit.senecac.on.ca/wiki/index.php/Fall_2008_SYA710_Weekly_Schedule">Fall 2008 SYA710 Weekly Schedule - Open Source@Seneca</A>
<A HREF="http://zenit.senecac.on.ca/wiki/index.php/Fall_2008_LPT730_Weekly_Schedule">Fall 2008 LPT730 Weekly Schedule - Open Source@Seneca</A>
<p>

<A HREF="http://zenit.senecac.on.ca/wiki/index.php/User_talk:Bossa_nesta">User talk:Bossa nesta - Open Source@Seneca</A>
<A HREF="http://zenit.senecac.on.ca/wiki/index.php/LUX_Student_2008-2009">LUX Student 2008-2009 - Open Source@Seneca</A>
<A HREF="http://zenit.senecac.on.ca/wiki/index.php/LUX_Program">LUX Program - Open Source@Seneca</A>
<A HREF="http://zenit.senecac.on.ca/~chris.tyler/planet/">opensource@seneca</A>
<A HREF="http://de-luxer.blogspot.com/">De-Luxer</A>
<A HREF="http://zenit.senecac.on.ca/wiki/index.php/Windows_Data_Migration_Tool">Windows Data Migration Tool - Open Source@Seneca</A>
<A HREF="http://sites.google.com/site/bossanesta/Home/isaschedule">ISA_Schedule (bossa_nesta)</A>
<A HREF="http://zenit.senecac.on.ca/wiki/index.php/Fall_2008_LUX_Grading">Fall 2008 LUX Grading - Open Source@Seneca</A>
<A HREF="https://wiki.ubuntu.com/MigrationAssistance">MigrationAssistance - Ubuntu Wiki</A>

<p>

iPhone

<p>
<A HREF="http://testmyiphone.com/">Testmyiphone.com - iPhone Speed Test</A>
<A HREF="http://www.aptana.com/iphone">Aptana Studio: iPhone Development Plugin | Aptana</A>
<p>

Python

<p>
<A HREF="http://pbe.lightbird.net/">Python-by-example</A>
<A HREF="http://docs.python.org/tutorial/">The Python Tutorial — Python v2.6 documentation</A>
<A HREF="http://pbe.lightbird.net/">Python-by-example - best</A>
<p>

Nes

<p>
<A HREF="https://www1.royalbank.com/cgi-bin/rbaccess/rbunxcgi?F6=1&F7=IB&F21=IB&F22=IB&REQUEST=ClientSignin&LANGUAGE=ENGLISH">RBC Royal Bank - Sign In to Online Banking</A>
<A HREF="http://eric.bachard.free.fr/news/2008/10/fsoss-2008-saturday.html">ericb's place: FSOSS 2008 : saturday</A>
<A HREF="http://zenit.senecac.on.ca/wiki/index.php/Talk:IPhone_Open_Source_Project">Talk:IPhone Open Source Project - Open Source@Seneca</A>
<A HREF="http://www.stevenlevy.com/index.php/other-books/crypto">StevenLevy.com » Crypto</A>
<p>

Seneca

<p>
<A HREF="https://my.senecacollege.ca/webapps/portal/frameset.jsp">Blackboard Academic Suite - My.Seneca</A>
<A HREF="https://learn.senecac.on.ca/">My.Seneca Student WEBmail</A>
<A HREF="http://fsoss.senecac.on.ca/2008/?q=node/39">Schedule | FSOSS 08</A>
<p>

<A HREF="http://www.gam.co.za/connectivity/bandwidth.php#">GamCo | Dynamic Internet Solutions</A>
<A HREF="http://utilities.globequest.com.ph/cgi-bin/BandWidthMeter.pl?session=1221629953">Speed Test Results</A>
<A HREF="http://cs.senecac.on.ca/~murray.saul/XWN740/notes.html">Murray Saul's Seneca Webpage</A>
<A HREF="http://zenit.senecac.on.ca/wiki/index.php/LPT730">LPT730 - Open Source@Seneca</A>