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

📄 linux.html

📁 1000 HOWTOs for various needs [WINDOWS]
💻 HTML
📖 第 1 页 / 共 3 页
字号:
  zsh</p>

<p>The most popular and powerful shell is 'bash' (borne again shell). We won't 

  go that much into shells, because you don't need to know that much about them 

  just yet.</p>

<p> <br>

  <b>5.2 - Navigating The File System</b></p>

<p>The most important thing to know when using the console is how to navigate 

  the file system without a graphical program.</p>

<p>The first thing to understand about this is that the bottom directory, the 

  directory that everything else is a subdirectory of is '/'. It's like 'C:\' 

  in Windows.</p>

<p>Ok, you start at the console and as a default you're either in your home directory 

  (every user has a home directory which contains his personal configurations 

  files). Now you want to navigate to another directory. But wait, you don't know 

  any other directories! You'll a directory listing for this, right? To do this 

  type 'ls' at the prompt. 'ls' is the equivlant to 'dir' in MS-DOS, and stands 

  for list. You'll get a list of files and folders. To make the list a bit more 

  readable, try ls -Fla. The -a shows files which start with a period (for example: 

  .Xclients-default). The -l displays file permissions and displays everything 

  in neat columns. The -F option adds a / after a directory and a * after an executable 

  file. I also<br>

  suggest using ls -Fla --color to let the system color-code different files (may 

  not be available on some systems).</p>

<p>Anyway, now that you what directories there are, you need to know how to get 

  into them. Luckily, you use the same command as you you use in MS-DOS, the 'cd' 

  (change directory) command. Let's say you're at the bottom directory, '/' and 

  you want to get to '/root'. You simply type 'cd root'. There is no need to type 

  'cd /root', because you're already in '/'. Now let's say you want to get to 

  '/root/bin'. This would be done by typing 'cd bin'. There is no need to type 

  'cd /root/bin' (the &quot;full path&quot; of the directory), since you're already 

  in '/root'. Instead, you can use a &quot;relative path&quot;, which is a path 

  that is relative to the current directory you're in. Type pwd to find out where 

  you are (pwd stands for print working directory).</p>

<p>Now let's say you're in '/root/bin' and you want to get to '/usr'. You would 

  type 'cd /usr'. This is to signify that the 'usr' directory is under '/', not 

  '/root/bin', or even '/root'. Got it? Ok, just one more thing. If you're in 

  a subdirectory, and you want to get to the top directory, just type 'cd ..'. 

  Let's say you're in '/root/bin', and you want to get to '/root'. You could<br>

  just type 'cd /root', but hey, '/root' is five characters! If you want to save 

  precious miliseconds, just type 'cd ..', since '/root' is the directory in which 

  '/root/bin' is a subdirectory of. So in other words, . is the current directory, 

  .. is one directory above, ... is two directories above etc'.</p>

<p><b>5.3 - Basic File and Directory Commands</b></p>

<p>There are lots of file and directory commands in Linux, but we'll start with 

  directory commands because they're easier. First off, you have 'mkdir'. 'mkdir' 

  stands for make directory and the context is:</p>

<p>mkdir the_directory_you_want_to_make</p>

<p>Some rulse apply. If you're '/', it will make the new directory under '/'. 

  If you're in '/usr', it will make the directory under '/usr'. Of course though, 

  if you're in '/' and you want to make a directory called 'stuff' under '/usr', 

  you would simply type '/usr/stuff'.</p>

<p>The next command is the 'rm' command. It works with files and direcotires and 

  is used to delete some, it stands for 'remove'. If you want to remove a file 

  called 'this.gif', you would go to the directory where that file is and type 

  'rm this.gif'. Or let's say again you're in '/' and 'this.gif' is in '/usr', 

  you would type 'rm /usr/this.gif'. It works the same way<br>

  with a directory.</p>

<p>Next are the 'cp' and 'mv' commands. They're both relativley simple, but we'll 

  start with 'cp'. 'cp' stands for copy, and is used to copy a file from directory 

  to another. The context is:</p>

<p>cp /directory_where_it_is/filename /directory_where_you_want_to_copy_it</p>

<p>Of course if you're already in the directory where the file is, all you need 

  to type is:</p>

<p>cp filename /directory_where_you_want_to_copy_it</p>

<p>'mv' works the exact same way, except it moves the file instead of copying 

  it. This means it deletes in from the original directory and puts it in the 

  new one.</p>

<p><b><br>

  5.4 - Finding and Viewing Commands</b></p>

<p>To find a file, oyu use the 'find' command. It then followed by the directory 

  where you want to start looking, then the '-name' arguement to say that you're 

  searching for a filename. Next you type the name of the file. Let's say you're 

  looking for the 'this.gif' in the '/usr' directory, the context would look like 

  this:</p>

<p>find /usr -name this.gif</p>

<p>The find command doesn't stop at filenames, it can also search a file for a 

  paticular string of text. It has the same context as the find file command except 

  you put quotes and asteriks around the string of text. So if you wanted to search 

  the '/usr' directory for a file containing the string 'hello', you would type</p>

<p>find /usr -name &quot;*hello*&quot;</p>

<p>Ok, once you find a file, you want to view it right? Well, you could open the 

  file with a text editor, but we haven't learned to use tetx editors yet, and 

  anyway if the file you want to view is important you might accidently change 

  it and save it using a text editor. That's what the 'cat' command is for. Let's 

  say you want to view a file called 'stuff.txt' in '/root'. You would navigate 

  to the '/root' directory and type 'cat stuff.txt'. Or from any directory, type 

  'cat /root/stuff.txt'</p>

<p>-= For more commands, buy a good basic Unix book =-</p>

<p><b>5.5 - linuxconf</b></p>

<p>There are lots of commands in Linux for configuring everything to user passwords, 

  networks, and the message that comes up when you start Linux. With so many things 

  to configure, luckily there is one program that does it all. <br>

  Just type 'linuxconf' at the command prompt, and you'll be brought to the Linux 

  Configuration program.</p>

<p><b><br>

  5.6 - Mounting</b></p>

<p><b>5.61 - Mounting Drives</b></p>

<p>In Linux, drives not only have to be physically mounted to the computer, but 

  mounted in software too. In the KDE and GNOME GUIs, you can easily mount a CD-ROM 

  or disk drive by clicking on the 'CD-ROM' or 'Disk Drive' icons on the desktop.</p>

<p><b>5.62 - How to mount</b></p>

<p>Remember earlier in this tutorial when we went over how a hard drive partition 

  is almost like a separate hard drive? Well, just like a separate drive, partitions 

  also have to be mounted. The main use in this is being able to<br>

  mount Windows partition and access Windows files in Linux. Obviously, Windows 

  software will not run under Linux but there is still a use for accessing Windows 

  files in Linux.</p>

<p>Let's say you can't use the internet in Linux. You ISP only allows to dialup 

  with software and they don't make it for Linux, you're not used to Linux yet 

  so you don't want to use the net in it yet. This is a down point, but it doesn't 

  mean you can't download Linux files to use. All you have to do is download the 

  files in Windows and access them in Linux.</p>

<p>To mount a windows partition in Linux, yhe first thing you must do is create 

  a directory in Linux where you will mount the windows partition to reside. Go 

  into file manager (it should be under utilities no matter what distribution 

  you're using) and create a new directory under '/'. Call anything, I suggest 

  calling it 'windows'. Now exit file manager and go<br>

  into 'terminal' (should also be under utilities). Terminal will give you a command 

  prompt just like MS-DOS. This is what you would have to do everything from if 

  there were no X Windows GUI. The command to use is simply enough- 'mount'. But 

  don't type it just yet, you need to give the system more info. The full command 

  is</p>

<p>mount -t vfat /dev/xxxx /yyyyyyy (yes there is a space between 'xxxx' and '/')</p>

<p>Or mount -t vfat32 /dev/xxxx /yyyyyyy in case this is a FAT32 partition.</p>

<p>Where 'yyyyyyy' is the directory you just created, and 'xxxx' is the device 

  name of the partition where Windows resides. It is usually hda1 or something.</p>

<p>There, now just go into file manager and click on the directory you created 

  and you will have all the files that are on your windows partition.</p>

<p>When you're done, don't forget to unmount the drive by typing:</p>

<p>umount /dev/xxxx /yyyyyyy </p>

<p>Each time you want to access your windows files, just mount the partition (unless 

  they're set for automount. Edit /etc/fstab, find the line that represents your 

  Windows partition and look for a place with says noauto. If you find the word 

  noauto, change it into defaults. If you don't, your Windows partition will probably 

  get automounted whenever you boot-up Linux). When you're done with them, just 

  unmount the partition.</p>

<p><b><br>

  5.7 - Runlevels</b></p>

<p>While Windows is booting, have you ever pressed the F8 key? Well, if you have, 

  you're probably familiar with a screen that pops up giving you a list of ways 

  you can load Windows. There's safe mode, command prompt, step-by-step confirmation, 

  etc. Linux has something just like that, and they're called 'runlevels'. There 

  are six runlevels in all, and some are pretty much the same. A runlevel is a 

  list of commands to load-up as soon as you start up Linux (there's a mini-tutorial 

  about runlevels at blacksun.box.sk/byteme.html). Your default runlevel is probably 

  5. If you configured the GUI to start up when you boot the system, and if your 

  default runlevel is 5, then that is the runlevel configured to boot the GUI 

  when it starts up...simple, right?</p>

<p>Well anyway, if you use linuxconf to change your default runlevel to 2 or 3 

  or something, then you change it so that the GUI won't start as soon as the 

  system boots....all without touching the actual runlevel. When you want to change 

  it back, just use linuxconf to set the default runlevel back to 5.</p>

<p>Now let's say you only want to load it without the GUI coming up once. Instead 

  of having to change the configuration in linuxconf, and then changing it back, 

  you can load Linux into another runlevel. Suppose You want to load runlevel 

  2...not for any paticular reason, just because it's not configured to load the 

  GUI when it boots up, and well, you like the<br>

  number 2. To do this, as soon LILO comes up (whether it's on your computer, 

  or your boot disk), you have the option to type something next to 'boot:'. Just 

  type 'linux x'. 'x' refers to the number of the runlevel, in this case the number 

  2, so you type 'linux 2', and press enter. This will load Linux without loading 

  the GUI. When you restart Linux, it will load the default runlevel again.</p>

<p>For an interesting runlevels-related local hack, read the Byte-Me mini-tutorial 

  about runlevels at blacksun.box.sk/byteme.html.</p>

<p><br>

  You are now officially a Linux user. Check out www.linuxlinks.com for links 

  to some great Linux sites. The best way to learn about Linux is by messing around 

  with it. In an hour of playing with Linux you can learn a lot. If you want more 

  interesting yet simple and easy-to-understand tutorials, check out <a href="http://blacksun.box.sk" target="_blank">http://blacksun.box.sk</a>.</p>

</body>

</html>

⌨️ 快捷键说明

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