Open main menu

CDOT Wiki β

Changes

User talk:Bossa nesta

5,010 bytes removed, 09:17, 10 March 2009
no edit summary
Mid-term Note - SPR720  ======================== File Permission =======================Agenda =
<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>
======================== BASH SCRIPTING ========================<pre>$ cal 16 2008 2>&1 >all-output.txtrun 'cal' with parameter "16 2008", err out to display/terminal, output to "all-output.txt"$ cal 16 2008 2>err.txt >all-output.txterr 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/passwd2. 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.txtcreat a note that start with year, forexample, "2007-note.txt", "2008-note.txt" $ vi $(date +%Y%m%d)-notes.txtcreat a note with current year, month, date, e.g: "20081012-note.txt' $ vi Nes$(date +%Y%m%d)-notes.txtcreat 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 $XTest = ALWAYS use double quote for value$ touch "test file"$ NAME="test file"$ rm $NAMErm: cannot remove `test': No such file or directoryrm: 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 variablesunset 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/nullls: cannot access /temp: No such file or directory$ echo $?2 $ exit 2Set exit variable to '2" $ exit 2143Set 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 TestsOperator 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 pipelinethen success-commands[elif pipeline2 else-if-commands][else alt-commands]fi======================== == CASE == echo -n "Are you sure you wish to remove '$file'?"read YNif [ "$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 pipelinedo commandsdone======================== == CASE ==num=1while [ $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 -Tdone  ========================Format of "for"========================for COLOUR in red blue greendo print "$COLOUR"done========================for ((x=0; x<=10; x++))do echo $xdone========================for FILE in /etc/*do if [ -x $FILE ] then echo "$FILE is executable" fidone======================== </pre> ======================== RPM ========================
<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>
=Notes======================= SYA710 ========================[http://www.zytrax.com/books/dns/ch6/#slave dns example]
<pre>
# Create a regular file (filled with zeros) as
the container for file system
dd if=http:/dev/zero of=fakedisk bs=1024 count=10000 www.oscommerce.info/kb/osCommerce/General_Information
# associate file "fakedisk" with http:/dev/loop0 losetup www.pumo.com.tw/devwww/loop0 fakedisk products/FAQ/teach-osc.jsp
# Now create a file system in the containerhttp: mkfs -t ext2 /dev/loop0 # Make an ext3 file system in the new partition: mkfs -t ext3 oscdox.com/devcrossx/sda4nav.html?index.php.source.html
# Mount the file system: mount </dev/loop0 /mnt1 # mount /dev/sda4 into /mnt1 mount /dev/sda4 /mnt1 # Unmount the file system umount /mnt1 pre>
# Display partition info-h, --human-readable in K,M,G form= Bookmark =
-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> <DL><p> </DL><p> <DT><H3 FOLDED>_tmp</H3> <DL><p> losetup <DT><A HREF="http://neosmart.net/wiki/display/EBCD/Mac+OS+X">Mac OS X -d NeoSmart Technologies Wiki</A> <DT><A HREF="http://www.insanelymac.com/devlofiversion/index.php/t3622.html">InsanelyMac Forum &gt; Help with adding OSX to GRUB</loop0 A> </DL><p> <DT><H3 FOLDED>LUX</H3># Inform the kernel of the change in the partition table <DL><p> partprobe <DT><H3 FOLDED>Weekly</H3> <DL><p> <DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/Fall_2008_NAD710_Weekly_Schedule# Now copy the contents of your Week_12_.28Nov_24.29_-_Project_presentations">Fall 2008 NAD710 Weekly Schedule - Open Source@Seneca</home directory to thisA> <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> new file system like this <DT><A HREF="http://cs.senecac.on.ca/~murray.saul/XWN740/notes.html">Murray Saul's Seneca Webpage</A> cp <DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/Fall_2008_SYA710_Weekly_Schedule">Fall 2008 SYA710 Weekly Schedule -a Open Source@Seneca</homeA> <DT><A HREF="http:/* /mnt1 zenit.senecac.on.ca/wiki/index.php/Fall_2008_LPT730_Weekly_Schedule">Fall 2008 LPT730 Weekly Schedule - Open Source@Seneca</A> </DL><p># make <DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/User_talk:Bossa_nesta">User talk:Bossa nesta - Open Source@Seneca</A> <DT><A HREF="http://zenit.senecac.on.ca/devwiki/sda4 as index.php/LUX_Student_2008-2009">LUX Student 2008-2009 - Open Source@Seneca</home, in A> <DT><A HREF="http:/etc/fstab filezenit.senecac.on.ca/wiki/index.php/LUX_Program">LUX Program - Open Source@Seneca</A> <DT><A HREF="http:/dev/sda4 zenit.senecac.on.ca/~chris.tyler/planet/">opensource@seneca</home ext3 defaults 1 3A> <DT><A HREF="http://de-luxer.blogspot.com/">De-Luxer</A># initialize two unused partitions to LVM <DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/Windows_Data_Migration_Tool">Windows Data Migration Tool - Open Source@Seneca</A> pvcreate <DT><A HREF="http://sites.google.com/site/devbossanesta/sda5 Home/devisaschedule">ISA_Schedule (bossa_nesta)</sda6A> <DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/Fall_2008_LUX_Grading">Fall 2008 LUX Grading - Open Source@Seneca</A># Create a volume group 'seneca' and put physical volume <DT><A HREF="https:/dev/sda5 into itwiki.ubuntu.com/MigrationAssistance">MigrationAssistance - Ubuntu Wiki</A> vgcreate seneca </devDL><p> <DT><H3 FOLDED>iPhone</sda5H3> <DL><p># label partition <DT><A HREF="http:/dev/senecatestmyiphone.com/home as "myhome>Testmyiphone.com - iPhone Speed Test</A> <DT><A HREF=" e2label http:/dev/senecawww.aptana.com/iphone">Aptana Studio: iPhone Development Plugin | Aptana</home myhomeA> </DL><p># Verify a partition label <DT><H3 FOLDED>Python</H3> e2label <DL><p> <DT><A HREF="http:/dev/senecapbe.lightbird.net/">Python-by-example</homeA> <DT><A HREF="http://docs.python.org/tutorial/">The Python Tutorial — Python v2.6 documentation</A># add physical volumes to a volume group <DT><A HREF="http://pbe.lightbird.net/">Python-by-example - best</A> vgextend seneca </devDL><p> <DT><H3 FOLDED>Nes</sda6H3> <DL><p># extend the size of a logical volume lvextend <DT><A HREF="https://www1.royalbank.com/cgi-L+1G bin/devrbaccess/senecarbunxcgi?F6=1&F7=IB&F21=IB&F22=IB&REQUEST=ClientSignin&LANGUAGE=ENGLISH">RBC Royal Bank - Sign In to Online Banking</homeA> <DT><A HREF="http://eric.bachard.free.fr/news/2008/10/fsoss-2008-saturday.html">ericb's place: FSOSS 2008 : saturday</A># ext2 <DT><A HREF="http://zenit.senecac.on.ca/wiki/index.php/Talk:IPhone_Open_Source_Project">Talk:IPhone Open Source Project - Open Source@Seneca</ext3 file system resizerA> resize2fs <DT><A HREF="http://www.stevenlevy.com/devindex.php/senecaother-books/crypto">StevenLevy.com » Crypto</homeA> </DL><p># unpack a bz2 file into a directory <DT><H3 FOLDED>Seneca</H3> tar xvjf linux<DL><p> <DT><A HREF="https://my.senecacollege.ca/webapps/portal/frameset.jsp">Blackboard Academic Suite -2My.Seneca</A> <DT><A HREF="https://learn.6senecac.26on.tarca/">My.bz2 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# decompress a gz with gzip">GamCo | Dynamic Internet Solutions</A> gzip <DT><A HREF="http://utilities.globequest.com.ph/cgi-d configbin/BandWidthMeter.gz pl?session=1221629953">Speed Test Results</A> # creates initial ramdisk images for preloading modules <DT><A HREF="http://cs.senecac.on.ca/~murray.saul/XWN740/notes.html">Murray Saul's Seneca Webpage</A> mkinitrd -k vmlinuz-2<DT><A HREF="http://zenit.6senecac.26 -i initrd-2on.6ca/wiki/index.26  php/LPT730">LPT730 - Open Source@Seneca</preA>