📄 linux-basics.html
字号:
<LI><B>Filename Completion:</B><br>Tab filename completion allows youto type in portions of a filename or program, and then press [TAB],and it will complete the filename for you. If there's more than onefile or program that starts with what you already typed in, it willbeep, and then when you press [TAB] again it lists all the files thatstart with what you initially type. Play around with it a little bitto see what its limits are, how it can work for what you do, etc.</LI><LI><B><tt>ifconfig</tt>:</B><br>You can check to see what yourcurrent IP addresses are using the <B>ifconfig</B> command.</LI><LI><B>HOWTO-reading HOWTO:</B><br>When looking through a Linux HOWTO,try to read only what you think you'll need. If you're still confused,then try additional portions of the HOWTO that you think will behelpful. This is useful if you've figured out part of the problem andwant to know how to do the rest.</LI><LI><B>How big is it, anyway?:</B><br>To find out how much space adirectory and its contents take up, use the command <B>du -b--total</B> to give you the output in bytes. There's a lot more youcan do with this command, just read the manpage using <B>mandu</B>. Another good trick is to do <B>du -b | sort +0n -r >foo-du.txt</B>, then use <B>less</B> to look for really bigfiles.</LI><LI><B>Development packages:</B><br>In case you decided to skipinstalling development packages during the installation of yourdistribution, and now can't compile source into binaries that you canuse ("command not found" when you're following the guides onthis page), install the following packages: autoconf, automake, make,gcc, egcs, glibc, glibc-devel, kernel-headers, libstdc++,XFree86-devel, and binutils. This will probably vary depending on yourdistribution, but they're basically what you'll need. (Based onexperiments performed on <A HREF="mailto:paco@meadco.com">ParkerMead</A>)</LI><LI><B>Long Filenames:</B><br>Linux can handle long filenames--withspaces, too! However, it's not a good idea to use spaces in filenames,as it creates problems for many programs. To refer to them you'll haveto use quotation marks. So if I have a file called <TT>That report Iwas working on</TT> then I'll have to edit it using <TT><B>pico"That report I was working on"</B></TT>.</LI><LI><B>^D:</B><br>Pressing ^D (Ctrl-D) on an empty line will closethat shell, either with the <B>exit</B> or <B>logout</B> command,whichever is appropriate. When you've already typed something, andthen you press ^D, you'll see a list of filenames that start with thething you typed! (<A HREF="mailto:sstuvel@wins.uva.nl">SybrenStuvel</A>)</LI><LI><B>How Do I...?:</B><br>When you know what you want to do but notwhat command you need, try typing <B>apropos <I>subject</I></B>. Thiswill print out a list of all the man pages having to do with<I>subject</I>. (<A HREF="mailto:slinkp@angelfire.com">PaulWinkler</A>)</LI><LI><B>Instant Replay:</B><br>Another nice bash feature: typing<B>!<I>string</I></B> will execute the most recent command that beganwith <I>string</I>. (<A HREF="mailto:slinkp@angelfire.com">PaulWinkler</A>) If you type <B>!?<I>string</I></B> then it will redo thelast command with <string>> anywhere in the command. I thinkthis is a more useful version as it makes it easier to make the lastcommand lookup search pattern more unique. (<AHREF="mailto:rmdenison@hotmail.com">Rob Denison</A>)</LI><LI><B>^Z:</B><br>^Z (Control-z) stops a job. After stopping a job,you can do two things with it - start it again in the foreground orstart it again in background. To start the job in foreground again,use <B>fg n</B>; to start the job in background use <B>bg n</B>, wheren is the job number. <B>jobs</B> will list all the jobs (along withnumbers) you currently have running. Note that "all the jobs youcurrently have running" is only on the current tty - if you'relogged in as <B>joe</B> on tty1 and tty2, and you stop a job on tty2,you can't do anything to it from tty1 (play with the <B>jobs</B>,<B>bg</B> and <B>fg</B> commands - you'll see what I mean). Also notethat job numbers are not the same as process id (PID) numbers, soDON'T TRY "kill 2" WHEN 2 IS THE JOB NUMBER FORANYTHING. (Instead, try <B>kill %2</B>. Thanks to <AHREF="mailto:schreib1@marshall.edu">Mark Schreiber</A> for this one.)If you have many jobs running background and make the simple mistakeof killing a job number instead of a PID, you risk having some largenasty problems. Trust me on that one. Why? Because a lot of veryimportant processes are loaded with very low PIDs, and it's a bad ideato be signalling them without a good reason. (<AHREF="mailto:jbm@intertek.net">jbm</a>) </LI><LI><B>No more root Logins:</B><br>To never have to log on as rootagain (having to log on as root is generally looked down upon as a badpractice), try two very useful utilities: <B>su</B> and <B>sudo</B>."su" allows users to become the superuser if they know thesuperuser password. Simply type <B>su -</B> at the prompt (the"-" is so that it will discard the PATH variable by the useryou're using to become the superuser; this means it is almost exactlylike having a root login), and the program will ask for thepassword. Enter it in, and poof - your $ is now a #. Type <B>exit</B>to get back to being a normal user. (Note: you can also use <B>su -username</B>; "su" will prompt you for"username"'s password. If you are a superuser, you can justdo <B>su - username</B> and it won't prompt for a password. Use"exit" to get back to being your usual self). This is veryuseful for installing system-wide programs, or moving thingsaround. (<A HREF="mailto:jbm@intertek.net">jbm</a>)</LI><li><b>Less is More:</B><br>Most of the new Linux distributions comewith a version of <b>less</b> that will automagically handle gzip'dand zip'd files. This means you can just do <b><tt>lessmy-big-gzipped-text-file.gz</tt></b> and it will act just like normal<b>less</b>! (Otherwise, try <B>zless</B>.) Also, <b>less</b> can readthe directory structure of tar files - gzip'd ones, too. So to makesure that new package you got actually creates its own directory, do<b><tt>less foobar-1.0.tar.gz</tt></b> to see where all it putsthings; it'll spit out a listing somewhat like <b><tt>ls-l</tt></b>. (<a href="mailto:jbm@intertek.net">jbm</a>)</LI><li><B>Screenshots:</B><br>To grab a screenshot in X, use<b>xv</b>. Open up <b>xv</b> and click "grab". Set the delay to 5seconds and check "Hide XV windows". Click Grab and then click on theroot window (your desktop) and leave the mouse cursor over the desktop(not over a window). The edge of your screen will blink and yourcomputer will beep to tell you it's grabbed the screenshot. Move the<b>xv</B> window a little bit, and suddenly your whole screen will befilled with the screenshot image. Right-click on that to bring up thecontrol window, and save the image. (<ahref="mailto:jbm@intertek.net">jbm</a>) You can also use the<b>import</b> command from the ImageMagick package. Just type this inan xterm: <b>import foobar.jpeg</b> and then click on the window youwant to grab. You can do other formats than jpeg, too. To grab thewhole screen, just do <b>import -window root wholescreen.jpg</b>. Youcan do a lot of other tricks, like leaving out window borders,delaying a number of seconds, grabbing a sequence of images to make ananimated GIF, etc. See <b>man import</b>. (Paul Winkler, <AHREF="mailto:slinkp@angelfire.com">slinkp@angelfire.com</A>.</P></LI></UL><HR><P>Got any tips of your own to add? <AHREF="mailto:jgo@local.net">Let me know</A> and your name anda link to your e-mail address or website will be included.</P><HR><P><B><FONT SIZE="-1">Copyright © 1997-1999 <AHREF="mailto:jgo@local.net">Joshua Go (jgo@local.net)</A>. Allrights reserved. Permission to use, distribute, and copy this document ishereby granted. You may modify this document as long as credit to me isgiven.</FONT></B></P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -