GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS GNU and Linux commands About my favourite file manager Linux for Teachers Nick Urbanik This document Licensed under GPL—see section 9 Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document 5, 6 December 2005 Outline GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Why the Command Line? GNU and Linux commands Nick Urbanik Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Isn’t that going back to the dark ages? Don’t file managers make all that obsolete? Doesn’t it take so much longer to type all those crazy commands? “Aren’t you just telling us all this crap to waste our precious time we could spend learning something useful?” I’ll tell you a secret How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Why the Command Line? GNU and Linux commands Nick Urbanik Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Isn’t that going back to the dark ages? Don’t file managers make all that obsolete? Doesn’t it take so much longer to type all those crazy commands? “Aren’t you just telling us all this crap to waste our precious time we could spend learning something useful?” I’ll tell you a secret How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Why the Command Line? GNU and Linux commands Nick Urbanik Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Isn’t that going back to the dark ages? Don’t file managers make all that obsolete? Doesn’t it take so much longer to type all those crazy commands? “Aren’t you just telling us all this crap to waste our precious time we could spend learning something useful?” I’ll tell you a secret How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Why the Command Line? GNU and Linux commands Nick Urbanik Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Isn’t that going back to the dark ages? Don’t file managers make all that obsolete? Doesn’t it take so much longer to type all those crazy commands? “Aren’t you just telling us all this crap to waste our precious time we could spend learning something useful?” I’ll tell you a secret How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Why the Command Line? GNU and Linux commands Nick Urbanik Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Isn’t that going back to the dark ages? Don’t file managers make all that obsolete? Doesn’t it take so much longer to type all those crazy commands? “Aren’t you just telling us all this crap to waste our precious time we could spend learning something useful?” I’ll tell you a secret How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document My Dirty Secret GNU and Linux commands Nick Urbanik Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? You may be better with a file manager than I am you may have had more practice than I have. . . . . . because my favourite file manager is the command line . . . keeps umbrella handy to protect against the expected shower of rotten tomatoes How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Still here? Hmm, okay, I’ll tell you why. My Dirty Secret GNU and Linux commands Nick Urbanik Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? You may be better with a file manager than I am you may have had more practice than I have. . . . . . because my favourite file manager is the command line . . . keeps umbrella handy to protect against the expected shower of rotten tomatoes How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Still here? Hmm, okay, I’ll tell you why. My Dirty Secret GNU and Linux commands Nick Urbanik Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? You may be better with a file manager than I am you may have had more practice than I have. . . . . . because my favourite file manager is the command line . . . keeps umbrella handy to protect against the expected shower of rotten tomatoes How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Still here? Hmm, okay, I’ll tell you why. My Dirty Secret GNU and Linux commands Nick Urbanik Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? You may be better with a file manager than I am you may have had more practice than I have. . . . . . because my favourite file manager is the command line . . . keeps umbrella handy to protect against the expected shower of rotten tomatoes How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Still here? Hmm, okay, I’ll tell you why. My Dirty Secret GNU and Linux commands Nick Urbanik Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? You may be better with a file manager than I am you may have had more practice than I have. . . . . . because my favourite file manager is the command line . . . keeps umbrella handy to protect against the expected shower of rotten tomatoes How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Still here? Hmm, okay, I’ll tell you why. Outline GNU and Linux commands Nick Urbanik Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Advantages of the Command Line GNU and Linux commands Nick Urbanik Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? Allows you to automate things Provides quick ways of getting at things similar to what you did before quicker than pulling down menus What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Comparing GNU commands with DOS GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document You are nearly as old as I am, so many of you are familiar with DOS commands. If you were just out of school, this comparison would be useless GNU ↔ DOS GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Action list files (short) list files (long) copy files move files rename files GNU ls ls -l cp sourcefile ... target mv sourcefile ... target mv sourcefile target DOS dir /s dir copy sourcefile target move sourcefile target ren sourcefile target Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document GNU ↔ DOS GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Action change directory make directory remove directory show current directory show content of text file GNU cd dirname mkdir dirname ... rmdir dirname ... pwd cat file DOS cd dirname md dirname rd dirname cd type file Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Doing it fast Bash shell provides command-line editing §§ §¤¤¤ ¤ § ,¦ ,¦ Home ¥ End ¥ ← ¥ → ¥ ,¦ Move: ¦ § ¤¤ §§¤ § ¤ Backspace Delete words: ¦ Esc ¥ ¥ Esc ¥ D ,¦ ¦ ¦¤ ¥ § Delete to end of line: ¦ Control-k ¥ GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document tab completion type the first few characters of a command, file, . . . and §¤ press the ¦ ¥ Tab key: the shell will complete the name A history of previous commands §¤ ¤ § ¦¥ ¥ ¦ Reverse search through history type any characters from a previous command and press § ¤ Control-R ¥ repeatedly until you see the command you want ¦ press ↑ , ↓ Outline GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Doing it even faster with loops command line editing, tab-completion and history all make the command line fast. . . . . . but the real speed comes with automation We can automate things with loops Here are the last few things I did with loops: list PDF documents I wrote, with the number of pages: $ for i in *trans.pdf;do o="$(pdfinfo $i|egrep ’^Pages:|^Author:|^Title:’)";if echo $o| egrep -q ’Author: +Nick’;then echo $i:;echo "$o";fi;done ← Set timestamp correctly in family photos: $ for i in 2005_09_11 2005_09_12 2005_09_13 2005_09_14 2005_09_15 2005_09_16 2005_09_17 2005_09_18;do pushd $i;pwd;exif-timestamp-adjust.pl *.jpg;popd;done ← View all my teaching handouts: $ for i in *slides-beamer-handout.pdf;do xpdf $i&done ← Pretty-print my C++ programs: $ for i in *.cpp;do pretty-print-cpp $i| lpr;done ← Make a hundreds table for my son: $ for ((i=1;i<=100;++i));do echo -n "$i "; if ((i % 10 == 0));then echo ’ ’;else echo -n ’& ’;fi;done > hundreds-table.tex ← GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document How can I get help with these commands? GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document A few commands are built into the bash shell; you can get help for these by typing $ help ← The other commands are in /bin, /usr/bin you can go there and have a look each one has a “man page” To read the page for ls, you can do $ man ls ← To search for word in the man page, type / word ¨ To quit, type: q © But where is the woman command? Isn’t this sexist? “man” is short for “manual” What’s the GNU, anyway? GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document GNU stands for “GNU’s Not Unix” It’s the project started by Richard Stallman Aims to provide all we need without contaminating our computers with non-free software Enables membership of the Church of Emacs. Some things to do GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Write a for loop to count up to 100: $ for ((i = 0; i <= 100; ++i));do echo $i;done ← See all the man pages for programs in /bin: $ cd /bin; for i in *;do man $i;done ← Do the same thing for the commands in /usr/bin  ¨ Note: pressing  Control-C © interrupt a loop that gets will stuck going “forever” Being the system administrator GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? You write to anything under your home directory, or in /tmp with your own account . . . but to write anywhere else, you need to be the system administrator and have root access. I highly recommend that you use sudo to become the system adminstrator. To do that you can follow the separate guide available at http://nicku.org/lpic102/lpic/ general-linux-2/lab/sudo/sudo.pdf How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document Outline GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document Getting more software GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS You can use yum to install new software You can become root by either: using sudo  . . . or by typing $ su - ← and then entering the root password  Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Then do: $ sudo yum -y update ← or # yum -y update ← To install Blender, do: $ sudo yum -y install blender ← To install Scribus, do: $ sudo yum -y install scribus ← Some Things to Read License Of This Document Resources GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Dr. Peter Salus. The Daemon, the GNU & the Penguin. Grocklaw 2005. http://www.groklaw.net/staticpages/index. php?page=20051013231901859. GNU General Public License. http://www.gnu.org/copyleft/gpl.html Topics Covered Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Topics Covered Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Topics Covered Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Topics Covered Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Topics Covered Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Topics Covered Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Topics Covered Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Topics Covered Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Topics Covered Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Topics Covered Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Topics Covered Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Topics Covered Why the Command Line? Advantages of the Command Line Comparing GNU commands with DOS Isn’t it too slow? Doing it even faster How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Getting more software Some Things to Read License Of This Document GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document License Of This Document GNU and Linux commands Nick Urbanik Why the Command Line? Comparing GNU commands with DOS Isn’t it too slow? How can I get help with these commands? What’s the GNU, anyway? Some Things to Do Being the System Administrator Some Things to Read License Of This Document Copyright © 2005 Nick Urbanik You can redistribute modified or unmodified copies of this document provided that this copyright notice and this permission notice are preserved on all copies under the terms of the GNU General Public License as published by the Free Software Foundation—either version 2 of the License or (at your option) any later version.