﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-taocheng</title><link>http://www.cppblog.com/taocheng/</link><description /><language>zh-cn</language><lastBuildDate>Tue, 14 Apr 2026 23:08:33 GMT</lastBuildDate><pubDate>Tue, 14 Apr 2026 23:08:33 GMT</pubDate><ttl>60</ttl><item><title>Shell and Shell Script for Linux</title><link>http://www.cppblog.com/taocheng/archive/2011/12/17/162284.html</link><dc:creator>CT</dc:creator><author>CT</author><pubDate>Sat, 17 Dec 2011 06:50:00 GMT</pubDate><guid>http://www.cppblog.com/taocheng/archive/2011/12/17/162284.html</guid><wfw:comment>http://www.cppblog.com/taocheng/comments/162284.html</wfw:comment><comments>http://www.cppblog.com/taocheng/archive/2011/12/17/162284.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/taocheng/comments/commentRss/162284.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/taocheng/services/trackbacks/162284.html</trackback:ping><description><![CDATA[Shell, shell script and other scripts are very important to learn and master linux.<br /><hr size="2" width="100%" /><ol><li>Fetch lines containing 'MAN' from /etc/man.config, and exclude comment lines.<br />$ cat /etc/man.config | grep 'MAN' | grep&nbsp; -v '^#'<br />$ cat /etc/man.config | grep 'MAN' | sed 's/#.*$//g' | sed '/^$/d'</li><li>Delete comment and blank lines using extended regular express.<br />$ egrep -v '^$|^#' /etc/man.config<br /></li></ol><img src ="http://www.cppblog.com/taocheng/aggbug/162284.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/taocheng/" target="_blank">CT</a> 2011-12-17 14:50 <a href="http://www.cppblog.com/taocheng/archive/2011/12/17/162284.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Create A New Swap Partition Using A Big File</title><link>http://www.cppblog.com/taocheng/archive/2011/12/15/162145.html</link><dc:creator>CT</dc:creator><author>CT</author><pubDate>Thu, 15 Dec 2011 01:49:00 GMT</pubDate><guid>http://www.cppblog.com/taocheng/archive/2011/12/15/162145.html</guid><wfw:comment>http://www.cppblog.com/taocheng/comments/162145.html</wfw:comment><comments>http://www.cppblog.com/taocheng/archive/2011/12/15/162145.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/taocheng/comments/commentRss/162145.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/taocheng/services/trackbacks/162145.html</trackback:ping><description><![CDATA[# Note: using '#' as command prompt.<br /><hr size="2" width="100%" /># dd if=/dev/zero of=/tmp/swap bs=1M count=512<br /># mkswap /tmp/swap<br /># free; swapon /tmp/swap; free<img src ="http://www.cppblog.com/taocheng/aggbug/162145.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/taocheng/" target="_blank">CT</a> 2011-12-15 09:49 <a href="http://www.cppblog.com/taocheng/archive/2011/12/15/162145.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Create A Share Directory for Linux Users</title><link>http://www.cppblog.com/taocheng/archive/2011/12/13/162026.html</link><dc:creator>CT</dc:creator><author>CT</author><pubDate>Tue, 13 Dec 2011 06:16:00 GMT</pubDate><guid>http://www.cppblog.com/taocheng/archive/2011/12/13/162026.html</guid><wfw:comment>http://www.cppblog.com/taocheng/comments/162026.html</wfw:comment><comments>http://www.cppblog.com/taocheng/archive/2011/12/13/162026.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/taocheng/comments/commentRss/162026.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/taocheng/services/trackbacks/162026.html</trackback:ping><description><![CDATA[<strong>Linux shell commands which will be used:</strong> groupadd, useradd, usermod, gpasswd, id, mkdir, ll, chgrp, chmod, su, cd, touch.<br />// Note: '#' is used as command prompt.<br /><div><hr size="2" width="100%" />1) use perl as script to handle the new users adding.<br />#!/usr/bin/perl <br /> $user=$ARGV[0]; <br /> $passwd=$ARGV[1]; <br />if (!$user || !$passwd)<br />{<br />&nbsp;&nbsp; print "Note: user name and passwd cannot be NULL.\n";<br />&nbsp;&nbsp; exit 0;<br />} <br /> @saltchars = (a..z, A..Z, 0..9); # as a whole for assignment<br />srand(time || $$); <br />$salt = $saltchars[rand($#saltchars)].$saltchars[rand($#saltchars)]; # $# is the last index of array<br /> $encrypt_passwd = crypt($passwd, $salt); <br /> $add_exec = "/usr/sbin/useradd -p ".$encrypt_passwd." ".$user; &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  <br /> print $add_exec."\n "; <br /> system($add_exec);<br />#This perl script runs well in perl v5.10.1 built for i386-linux-thread-multi using root permission.<br />#saved this file as user_add.pl and <br />#chmod u+x user_add.pl<br />#./user_add.pl Tom 123456<br />#./user_add.pl Lily 123456<br />2) groupadd project; gpasswd -a Tom project; gpasswd -a Lily project; id Tom; id Lily;<br />3) mkdir /home/workspace; chgrp project /home/workspace; chmod 2770 /home/workspace;<br />#Now, directory '/home/workspace' can be shared by Tom and Lily for working or studying together.<br />#su, cd, touch, ll and other shell commands can be used to do a testing.</div><img src ="http://www.cppblog.com/taocheng/aggbug/162026.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/taocheng/" target="_blank">CT</a> 2011-12-13 14:16 <a href="http://www.cppblog.com/taocheng/archive/2011/12/13/162026.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>