<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2526572558115279206</id><updated>2011-11-28T06:06:54.141+05:30</updated><title type='text'>Unix Question And Answer</title><subtitle type='html'>All Viewers Are Welcome Here.Any One Can Also Post Any Unix Question and answewrs Are Welcome.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://unixqa.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2526572558115279206/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://unixqa.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>expert</name><uri>http://www.blogger.com/profile/05027544102105084558</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2526572558115279206.post-3380667946510652626</id><published>2008-01-14T11:44:00.000+05:30</published><updated>2008-01-14T11:45:37.699+05:30</updated><title type='text'>Unix Question And Answers</title><content type='html'>How do I get a recursive directory listing?     &lt;br /&gt;One of the following may do what you want:         ls -R                   (not all versions of "ls" have -R)        find . -print           (should work everywhere)        du -a .                 (shows you both the name and size)       If you're looking for a wildcard pattern that will match all ".c"      files in this directory and below, you won't find one, but you      can use         % some-command `find . -name '*.c' -print`       "find" is a powerful program.  Learn about it.&lt;br /&gt;&lt;br /&gt;How do I get the current directory into my prompt?      &lt;br /&gt;It depends which shell you are using.  It's easy with some      shells, hard or impossible with others.       C Shell (csh):        Put this in your .cshrc - customize the prompt variable the        way you want.             alias setprompt 'set prompt="${cwd}% "'            setprompt           # to set the initial prompt            alias cd 'chdir \!* &amp;amp;&amp;amp; setprompt'                If you use pushd and popd, you'll also need             alias pushd 'pushd \!* &amp;amp;&amp;amp; setprompt'            alias popd  'popd  \!* &amp;amp;&amp;amp; setprompt'         Some C shells don't keep a $cwd variable - you can use        `pwd` instead.         If you just want the last component of the current directory        in your prompt ("mail% " instead of "/usr/spool/mail% ")        you can use             alias setprompt 'set prompt="$cwd:t% "'                Some older csh's get the meaning of &amp;amp;&amp;amp; and  reversed.        Try doing:             false &amp;amp;&amp;amp; echo bug         If it prints "bug", you need to switch &amp;amp;&amp;amp; and  (and get        a better version of csh.)       Bourne Shell (sh):         If you have a newer version of the Bourne Shell (SVR2 or newer)        you can use a shell function to make your own command, "xcd" say:             xcd() { cd $* ; PS1="`pwd` $ "; }         If you have an older Bourne shell, it's complicated but not        impossible.  Here's one way.  Add this to your .profile file:                 LOGIN_SHELL=$$ export LOGIN_SHELL                CMDFILE=/tmp/cd.$$ export CMDFILE                # 16 is SIGURG, pick a signal that's not likely to be used                PROMPTSIG=16 export PROMPTSIG                trap '. $CMDFILE' $PROMPTSIG         and then put this executable script (without the indentation!),        let's call it "xcd", somewhere in your PATH                 : xcd directory - change directory and set prompt                : by signalling the login shell to read a command file                cat &gt;${CMDFILE?"not set"} &lt;&lt;EOF                cd $1                PS1="\`pwd\`$ "                EOF                kill -${PROMPTSIG?"not set"} ${LOGIN_SHELL?"not set"}         Now change directories with "xcd /some/dir".       Korn Shell (ksh):         Put this in your .profile file:                PS1='$PWD $ '                If you just want the last component of the directory, use                PS1='${PWD##*/} $ '       T C shell (tcsh)         Tcsh is a popular enhanced version of csh with some extra        builtin variables (and many other features):             %~          the current directory, using ~ for $HOME            %/          the full pathname of the current directory            %c or %.    the trailing component of the current directory         so you can do             set prompt='%~ '       BASH (FSF's "Bourne Again SHell")                \w in $PS1 gives the full pathname of the current directory,        with ~ expansion for $HOME;  \W gives the basename of        the current directory.  So, in addition to the above sh and        ksh solutions, you could use             PS1='\w $ '         or            PS1='\W $ '&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2526572558115279206-3380667946510652626?l=unixqa.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unixqa.blogspot.com/feeds/3380667946510652626/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2526572558115279206&amp;postID=3380667946510652626' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2526572558115279206/posts/default/3380667946510652626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2526572558115279206/posts/default/3380667946510652626'/><link rel='alternate' type='text/html' href='http://unixqa.blogspot.com/2008/01/unix-question-and-answers_6346.html' title='Unix Question And Answers'/><author><name>expert</name><uri>http://www.blogger.com/profile/05027544102105084558</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2526572558115279206.post-5081636668880101175</id><published>2008-01-14T11:43:00.000+05:30</published><updated>2008-01-14T11:44:11.343+05:30</updated><title type='text'>Unix Question And Answers</title><content type='html'>How do I remove a file with funny characters in the filename ?      &lt;br /&gt;If the 'funny character' is a '/', skip to the last part of this      answer.  If the funny character is something else, such as a ' '      or control character or character with the 8th bit set, keep reading.       The classic answers are         rm -i some*pattern*that*matches*only*the*file*you*want         which asks you whether you want to remove each file matching        the indicated pattern;  depending on your shell, this may not        work if the filename has a character with the 8th bit set (the        shell may strip that off);       and         rm -ri .         which asks you whether to remove each file in the directory.        Answer "y" to the problem file and "n" to everything else.        Unfortunately this doesn't work with many versions of rm.  Also        unfortunately, this will walk through every subdirectory of ".",        so you might want to "chmod a-x" those directories temporarily        to make them unsearchable.         Always take a deep breath and think about what you're doing and        double check what you typed when you use rm's "-r" flag or a        wildcard on the command line;       and         find . -type f ... -ok rm '{}' \;       where "..." is a group of predicates that uniquely identify the      file.  One possibility is to figure out the inode number of the      problem file (use "ls -i .") and then use         find . -inum 12345 -ok rm '{}' \;       or        find . -inum 12345 -ok mv '{}' new-file-name \;              "-ok" is a safety check - it will prompt you for confirmation of      the command it's about to execute.  You can use "-exec" instead      to avoid the prompting, if you want to live dangerously, or if      you suspect that the filename may contain a funny character      sequence that will mess up your screen when printed.       What if the filename has a '/' in it?       These files really are special cases, and can only be created by      buggy kernel code (typically by implementations of NFS that don't      filter out illegal characters in file names from remote      machines.)  The first thing to do is to try to understand exactly      why this problem is so strange.       Recall that Unix directories are simply pairs of filenames and      inode numbers.  A directory essentially contains information      like this:         filename  inode         file1     12345        file2.c   12349        file3     12347       Theoretically, '/' and '\0' are the only two characters that      cannot appear in a filename - '/' because it's used to separate      directories and files, and '\0' because it terminates a filename.       Unfortunately some implementations of NFS will blithely create      filenames with embedded slashes in response to requests from      remote machines.  For instance, this could happen when someone on      a Mac or other non-Unix machine decides to create a remote NFS      file on your Unix machine with the date in the filename.  Your      Unix directory then has this in it:         filename  inode         91/02/07  12357       No amount of messing around with 'find' or 'rm' as described      above will delete this file, since those utilities and all other      Unix programs, are forced to interpret the '/' in the normal way.       Any ordinary program will eventually try to do      unlink("91/02/07"), which as far as the kernel is concerned means      "unlink the file 07 in the subdirectory 02 of directory 91", but      that's not what we have - we have a *FILE* named "91/02/07" in      the current directory.  This is a subtle but crucial distinction.       What can you do in this case?  The first thing to try is to      return to the Mac that created this crummy entry, and see if you      can convince it and your local NFS daemon to rename the file to      something without slashes.       If that doesn't work or isn't possible, you'll need help from      your system manager, who will have to try the one of the      following.  Use "ls -i" to find the inode number of this bogus      file, then unmount the file system and use "clri" to clear the      inode, and "fsck" the file system with your fingers crossed.      This destroys the information in the file.  If you want to keep      it, you can try:         create a new directory in the same parent directory as the one        containing the bad file name;         move everything you can (i.e. everything but the file with the        bad name) from the old directory to the new one;         do "ls -id" on the directory containing the file with the bad        name to get its inumber;         umount the file system;         "clri" the directory containing the file with the bad name;         "fsck" the file system.       Then, to find the file,         remount the file system;         rename the directory you created to have the name of the old        directory (since the old directory should have been blown away        by "fsck")         move the file out of "lost+found" into the directory with a        better name.       Alternatively, you can patch the directory the hard way by      crawling around in the raw file system.  Use "fsdb", if you      have it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2526572558115279206-5081636668880101175?l=unixqa.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unixqa.blogspot.com/feeds/5081636668880101175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2526572558115279206&amp;postID=5081636668880101175' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2526572558115279206/posts/default/5081636668880101175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2526572558115279206/posts/default/5081636668880101175'/><link rel='alternate' type='text/html' href='http://unixqa.blogspot.com/2008/01/unix-question-and-answers_9110.html' title='Unix Question And Answers'/><author><name>expert</name><uri>http://www.blogger.com/profile/05027544102105084558</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2526572558115279206.post-3967011805583981677</id><published>2008-01-14T11:41:00.000+05:30</published><updated>2008-01-14T11:43:24.384+05:30</updated><title type='text'>Unix Question And Answers</title><content type='html'>How do I remove a file whose name begins with a "-" ?      &lt;br /&gt;Figure out some way to name the file so that it doesn't begin      with a dash.  The simplest answer is to use             rm ./-filename       (assuming "-filename" is in the current directory, of course.)      This method of avoiding the interpretation of the "-" works with      other commands too.       Many commands, particularly those that have been written to use      the "getopt(3)" argument parsing routine, accept a "--" argument      which means "this is the last option, anything after this is not      an option", so your version of rm might handle "rm -- -filename".      Some versions of rm that don't use getopt() treat a single "-"      in the same way, so you can also try "rm - -filename".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2526572558115279206-3967011805583981677?l=unixqa.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unixqa.blogspot.com/feeds/3967011805583981677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2526572558115279206&amp;postID=3967011805583981677' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2526572558115279206/posts/default/3967011805583981677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2526572558115279206/posts/default/3967011805583981677'/><link rel='alternate' type='text/html' href='http://unixqa.blogspot.com/2008/01/unix-question-and-answers_14.html' title='Unix Question And Answers'/><author><name>expert</name><uri>http://www.blogger.com/profile/05027544102105084558</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2526572558115279206.post-7668895502524315253</id><published>2008-01-14T11:38:00.000+05:30</published><updated>2008-01-14T11:41:09.239+05:30</updated><title type='text'>Unix Question And Answers</title><content type='html'>What does {some strange unix command name} stand for?     &lt;br /&gt; awk = "Aho Weinberger and Kernighan"         This language was named by its authors, Al Aho, Peter        Weinberger and Brian Kernighan.       grep = "Global Regular Expression Print"         grep comes from the ed command to print all lines matching a        certain pattern                     g/re/p         where "re" is a "regular expression".       fgrep = "Fixed GREP".         fgrep searches for fixed strings only.  The "f" does not stand        for "fast" - in fact, "fgrep foobar *.c" is usually slower than        "egrep foobar *.c"  (Yes, this is kind of surprising. Try it.)         Fgrep still has its uses though, and may be useful when searching        a file for a larger number of strings than egrep can handle.       egrep = "Extended GREP"         egrep uses fancier regular expressions than grep.  Many people        use egrep all the time, since it has some more sophisticated        internal algorithms than grep or fgrep, and is usually the        fastest of the three programs.       cat = "CATenate"         catenate is an obscure word meaning "to connect in a series",        which is what the "cat" command does to one or more files.  Not        to be confused with C/A/T, the Computer Aided Typesetter.       gecos = "General Electric Comprehensive Operating Supervisor"                When GE's large systems division was sold to Honeywell,        Honeywell dropped the "E" from "GECOS".         Unix's password file has a "pw_gecos" field.  The name is a        real holdover from the early days.  Dennis Ritchie has reported:             "Sometimes we sent printer output or batch jobs             to the GCOS machine.  The gcos field in the password file             was a place to stash the information for the $IDENT card.             Not elegant."       nroff = "New ROFF"      troff = "Typesetter new ROFF"                These are descendants of "roff", which was a re-implementation        of the Multics "runoff" program (a program that you'd use to        "run off" a good copy of a document).       tee       = T         From plumbing terminology for a T-shaped pipe splitter.       bss = "Block Started by Symbol"                Dennis Ritchie says:             Actually the acronym (in the sense we took it up; it may            have other credible etymologies) is "Block Started by            Symbol." It was a pseudo-op in FAP (Fortran Assembly [-er?]            Program), an assembler for the IBM 704-709-7090-7094            machines.  It defined its label and set aside space for a            given number of words.  There was another pseudo-op, BES,            "Block Ended by Symbol" that did the same except that the            label was defined by the last assigned word + 1.  (On these            machines Fortran arrays were stored backwards in storage            and were 1-origin.)             The usage is reasonably appropriate, because just as with            standard Unix loaders, the space assigned didn't have to be            punched literally into the object deck but was represented            by a count somewhere.       biff = "BIFF"         This command, which turns on asynchronous mail notification,        was actually named after a dog at Berkeley.             I can confirm the origin of biff, if you're interested.            Biff was Heidi Stettner's dog, back when Heidi (and I, and            Bill Joy) were all grad students at U.C. Berkeley and the            early versions of BSD were being developed.   Biff was            popular among the residents of Evans Hall, and was known            for barking at the mailman, hence the name of the command.         Confirmation courtesy of Eric Cooper, Carnegie Mellon University       rc (as in ".cshrc" or "/etc/rc") = "RunCom"         "rc" derives from "runcom", from the MIT CTSS system, ca. 1965.             'There was a facility that would execute a bunch of            commands stored in a file; it was called "runcom" for "run            commands", and the file began to be called "a runcom."             "rc" in Unix is a fossil from that usage.'                Brian Kernighan &amp;amp; Dennis Ritchie, as told to Vicki Brown         "rc" is also the name of the shell from the new Plan 9        operating system.       Perl = "Practical Extraction and Report Language"      Perl = "Pathologically Eclectic Rubbish Lister"         The Perl language is Larry Wall's highly popular        freely-available completely portable text, process, and file        manipulation tool that bridges the gap between shell and C        programming (or between doing it on the command line and    pulling your hair out).  Don Libes' book "Life with Unix" contains lots more of these      tidbits.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2526572558115279206-7668895502524315253?l=unixqa.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unixqa.blogspot.com/feeds/7668895502524315253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2526572558115279206&amp;postID=7668895502524315253' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2526572558115279206/posts/default/7668895502524315253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2526572558115279206/posts/default/7668895502524315253'/><link rel='alternate' type='text/html' href='http://unixqa.blogspot.com/2008/01/unix-question-and-answers.html' title='Unix Question And Answers'/><author><name>expert</name><uri>http://www.blogger.com/profile/05027544102105084558</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2526572558115279206.post-1390432596988613200</id><published>2008-01-14T11:28:00.001+05:30</published><updated>2008-01-14T11:29:46.127+05:30</updated><title type='text'>Welcome To My Blog</title><content type='html'>Welcome To My Blog&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2526572558115279206-1390432596988613200?l=unixqa.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unixqa.blogspot.com/feeds/1390432596988613200/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2526572558115279206&amp;postID=1390432596988613200' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2526572558115279206/posts/default/1390432596988613200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2526572558115279206/posts/default/1390432596988613200'/><link rel='alternate' type='text/html' href='http://unixqa.blogspot.com/2008/01/welcome-to-my-blog.html' title='Welcome To My Blog'/><author><name>expert</name><uri>http://www.blogger.com/profile/05027544102105084558</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
