⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linux-basics.html

📁 Linus guide, Linus guide, Linus guide,
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><HTML><HEAD>   <TITLE>Josh's Linux Guide - Linux Basics and Tips</TITLE>   <META NAME="Description" CONTENT="Linux basics and a few tips.">   <META NAME="Keywords" CONTENT="Linux, howto, url, tips, tricks, basics"><BASE TARGET="_top"></HEAD><LINK REL="stylesheet" TYPE="text/css" HREF="default.css"><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#7F007F"><H2><A NAME="0">Linux Basics and Tips</A></H2><P>On this page, I (and many others) just wrote some stuff that did notdeserve (or need) their own section because of their simple nature. Isuggest anyone new to Linux and Unix read this section so that you willjump in with enough knowledge. You probably have a lot more to add tothis, so make sure you <A HREF="mailto:jgo@local.net">e-mail</A>it to me to help more people.</P><UL><LI><B>Free Space:</B><br>To find out how much disk space you haveleft on your hard drive or mounted floppy drive, type <B>df</B>.</LI><LI><B>Program Info:</B><br>For details about using a program you canuse the &quot;man&quot; command to access the manual page for thatparticular program. For a description of the command &quot;ls&quot;you would type <B>man ls</B>.  Some programs do not have manual pages(&quot;manpages&quot;), and there are manpages that aren't really muchhelp. However, as you get more advanced with Linux you will findmanual pages to be an invaluable resource. <AHREF="mailto:schreib1@marshall.edu">Mark Schreiber</A> wants to remindus of the <B>info</B> command as well. Use <B>info</B> when lookingfor Texinfo documentation.</LI><LI><B>Deleting Directories:</B><br>To remove an entire directorywithout being prompted if you want to delete each file, type <B>rm -rfdirectory-name</B>, where &quot;directory-name&quot; is the name ofthe directory. Be careful with this! (Also works with the <B>cp</B>(copy) command, when you overwrite old files.) In case you'rewondering, the <B>r</B> is for <I>recursive</I> (moves throughsubdirectories) and the <B>f</B> stands for <I>force</I>.</LI><LI><B>Shutting Down:</B><br>Shut down your system properly. Use thecommand <B>shutdown -h now</B> as root. If you want to reboot, type<B>reboot</B> or <B>shutdown -r now</B>. <AHREF="mailto:schreib1@marshall.edu">Mark Schreiber</A> reminds us thatthe Ctrl-Alt-Delete combination works as well, and does not require aroot login.</LI><LI><B>Pipes:</B><br>Pipes provide a way to get the output of onecommand into another command. For instance, if you want to see what'sin a very large directory, you can see a screenful at a time by pipingthe output of <b>ls</b> into <b>less</b>. To do that, just separatethe commands with the &quot;pipe&quot; symbol, which is usually<b>[Shift - Backslash]</b>. Try it by typing this: <br><b> ls |less</b><br>Here's another example that uses two pipes to sort thedirectory listing in reverse alphabetical order:<br><b> ls | sort -r |less</b><BR>(Paul Winkler, <AHREF="mailto:slinkp@angelfire.com">slinkp@angelfire.com</A>)</LI><LI><B>Redirection:</B><br>Redirection is related to the idea ofPipes. Pipes &quot;redirect&quot; the output of a command into theinput of another command, but you can also redirect output to a file(or even a device). To redirect the output of a command, use the&quot;&lt;&quot; symbol. One of the most common uses of redirection isto save a directory listing: <br><b> ls &gt; listing.txt</b><br> (PaulWinkler, <AHREF="mailto:slinkp@angelfire.com">slinkp@angelfire.com</A>)</LI><LI><B>Checking File Integrity:</B><BR>Use <B>md5sum</B> (or<B>md5</B> if you don't have that) to check whether a file is exactlythe same as where you transferred it from. Just run <B><TT>md5sumfilename</TT></B> and it should give you a string of letters andnumbers. This is useful for doing stuff across different systems whereyou have transferred a file. If the results of md5sum on the same fileare different, then the file got corrupted or modified somehow, andyou don't want that. You want them to be the same.</P><LI><B>Finding Stuff:</B><br>Find any file on your system by typing<B>find / -name &lt;name&gt;</B>. The &quot;/&quot; is telling it tostart from &quot;/&quot; and search everything under that, which iseverything on your filesystem. In place of &quot;name&quot; put thename of the file you want to look for. You can also use&quot;*name*&quot; to find anything with the string &quot;name&quot;in its filename, for example.</LI><LI><B>MOTD:</B><br>When a user logs in, you can edit <B>/etc/motd</B>to print out a message on their screen. That file must be edited whenyou are root. Just type in the plain text you want to display whensomeone logs in.</LI><LI><B>Do not IRC as root:</B><br>Do not log on to IRC as root. Evenif Nobody decides to try to penetrate your system, you are going to bebanned from a lot of the good technical help channels andservers.</LI><LI><B>Bailing Out:</B><br>If you're stuck in a program that won'trespond, try the &quot;Ctrl-c&quot; combination. In many cases eventhat won't work, so use &quot;Ctrl-z&quot; to force it to stop. It'sbest to exit the program the proper way, though.</LI><LI><B>Managing RPMs:</B><br>In any distribution that uses the Red Hatpackage manager (Red Hat, Caldera, and TurboLinux are a few) you canjust use the <B>rpm</B> command to install it from your CD. Use <B>rpm-i &lt;filename&gt;</B> to install a package; <B>rpm -U&lt;filename&gt;</B> to upgrade a package; and <B>rpm -i --force&lt;filename&gt;</B> if you installed a package, but didn't use<B>rpm</B> to remove it and want to reinstall it. The file name shouldend in &quot;*.rpm&quot;. If <B>rpm</B> doesn't work on your systemthen you don't have it installed.</LI><LI><B>Upper-case to Lower-case:</B><br>This little script renames allthe stuff in a directory to lowercase... <tt><b>for x in *; do mv $x`echo $x | tr [A-Z] [a-z]`; done</b></tt>. (code by <AHREF="mailto:blumenoww@scmb.co.za">Warren Blumenow</A>)</LI><LI><B>More Managing RPMs:</B><br>To find out if you have an RPMpackage installed, the syntax is <B>rpm -qa | grep&quot;part_of_package_name&quot;</B>.</LI><LI><B>Boot Scripts:</B><br>The startup scripts are usually located in<TT>/etc/rc.d/</TT>.  Inside that directory you may find files such as<TT>rc.local</TT>, <TT>rc.sysinit</TT>, <TT>rc.serial</TT>, and evensome subdirectories. The files contained in there may vary with eachdistribution. If you want to start a program when Linux boots, youprobably want to put it in the <TT>rc.local</TT> file.</LI><LI><B>Continuing FTP:</B><br>To continue downloading anincomplete/interrupted file in FTP, use <B>reget &lt;filename&gt;</B>after logging in to the FTP server.</LI><LI><B>Finding Text in Files:</B><br>To search for a text string, thebasic syntax is <B>grep &quot;text string&quot;/directory/you/want/to/start/searching/from</B>. If you don't want itto be case sensitive then use <B>grep -i &quot;text string&quot;/directory/to/start&quot;</B>.</LI><LI><B>Exiting <tt>vi</tt>:</B><br>To exit from <B>vi</B>, thestandard text editor, type [ESC], <B>:</B> and then <B>q</B>. Typing<B>:</B> will put you in command mode; <B>wq</B> will quit and writeany changes to the file; [ESC] <B>i</B> will put you back in insertmode so that you can type text in.</LI><LI><B>Red Hat Oopsies:</B><br>Regularly check the Red Hat Erratapages for updates to your Red Hat distribution. The URL is <AHREF="http://www.redhat.com/support/docs/errata.html">http://www.redhat.com/support/docs/errata.html</A>.</LI><LI><B>Fresh Meat:</B><br>Check for Linux software updates at <AHREF="http://freshmeat.net">FreshMeat</A>. Or, join and subscribe tothe mailing list to have the day's announcements mailed to you everynight.</LI>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -