Author: Ye Weibin MSN: fritz_yea@hotmail.comCopyright (C) Free Software Library, Org (http://yea.xiloo.com) in accordance with article GNU Free Document Lience released, anyone can copy this article intact, reprint But please keep this statement. The author is not responsible for any result caused by this article.
Fourth, the basic operation under Linux - LS, MKDIR, CD, CP, MV, RM, Touch, LN, TAR, MAN, SU, MOUNT, Umount, Shutdown After several tossing, we can finally work . For most people, Linux is a completely unfamiliar system. When we log in, what should I do next? Let us start from the simplest start. The following command is all based on the console, as for graphics operation, please explore yourself, very simple. First, look at what we have under our home directory. $ LSTESTDIR LS is an abbreviation of List, which is equivalent to DIR under DOS, which is one of the most common commands under Linux. Ls have many parameters, which are commonly used: Ls -l long list files, equivalent to DIR. Ls -a View hidden files, equivalent to DIR / A. Multiple parameters can be used together, such as LS -LA, view all files in the current directory in a list form (including hidden files). It should be noted that all UNIX commands must have a space between commands and parameters when the parameters are connected. Therefore, LS -A is correct, LS-A error. This is different from MS-DOS. The LS does not have parameters, it is equivalent to DIR / W. When the files in the directory are too much, it shows that it is too fast to see, what should I do? Don't tighten, we can use the following command $ ls | more file: // or ls | Less Note Space Here We use the concept of "Pipe". Simply put, it is to use the pipeline operator |, the output of the previous command as the input of the latter command. The output of the LS is used as an input of more. At this time, the screen will display a screen at a time, then the user presses the key to the next line (LESS is similar to more, but you can use the up and down keys to scroll, it is more natural) , Press q with exit. In a newer version of the Linux release, the default output result of the LS command is colored. The blue represents a directory, green represents an executable, white represents a normal file. This way we can clearly identify various files. Next, we create a directory. $ mkdir let_us_make_a_new_directoy file: // I deliberately dominated such a long name, purpose. $ lslet_us_make_a_new_directoy testdir $ cd newdir file: // Enter the newdir mkdir command "People as a name", there is nothing to say; the CD command and the MS-DOS are also very like, but pay attention to spaces. The naming principle under Linux is that other characters can be used as a file name in addition to special meaning ASCII characters; the file name is case sensitive, unlimited. So there is a metamorphosis like I have. But there is an advantage under Linux, that is, there is a "command complement" function. You only need to enter the first half, then press the two tab keys, the system will automatically make up the second half. Users will be prompted when there is multiple choices. This is a must-have skill that is skilled in using the UNIX system. (Here you even need to enter CD L, then Tab it will be done. Because there is no file name starting with other L in the current directory.) We are now let_us_make_a_new_directoy This metamorphosis directory, let us copy file from TestDir to Here. $ CP ../testdir/afile. File: // Copy the Afile file in the TestDir directory to the current directory, that is, the let_us_make_a_new_directoy directory. Refers to the previous directory.
The relative path is used here, and an absolute path can also be used. To copy the entire directory, you can use the following command: $ cp -fr ../testdir. File: // Copy TestDir to the current directory parameter R tells the CP target to be a directory, F enforcement. Otherwise a warning such as TestDir Is A Directory will be received. MV (Move) commands mobile files, which also has a "cut & paste" which is to use it to change the file name - MV OldName NewName To delete files, use the RM (REMOVE) command. $ cd .. file: // From Let_us_make_a_new_directoy, $ RM -FR Let_US_MAKE_A_NEW_DIRECTOY FILE: / / Delete this metamorphosis directory Please pay special attention to the user's permission issues. The authority system is strictly implemented in UNIX, and the user is given different permissions, and the file is also set. For example, the following file $ ls -l text.txt-rw-rw-r - 1 Yea Yea 30 June 28 22:55 TEXT.TXT file text.txt owner is YEA (that is, me), the user group is Yea, size 30 bytes, creating time is 22:55 on June 28, whose authority is -rw-rw-r-rw This tag can be understood this way: - | rw- | rw- | r - "," User group users "and" other users ", R is reading, W is written, X is running, no power is used - represented. Therefore, the above documents have read and write power for me and my other users, they are read-only for other users. Understand the permissions, you must know that in addition to root, all people must do things by authority. Without written permissions, you cannot perform commands such as MKDIR, MV, CP, and RM. To create a new file, we have built an empty file newfile using Touch $ TOUCH NewFile. Give it a link. $ ln -s newfile newfile_link $ ls -l newfile * -rw-rw-r - 1 Yea Yea 0 June 29 19:33 Newfilelrwxrwrwx 1 Yea Yea 7 June 29 19:35 Newfile_Link -> Newfile Link Command ln We are in When the system is configured, it has been exposed to it, it is easy to master. I will not repeat this here. There is also a TAR command, a little review. Usually we have encountered * .tar.gz files, this is a compressed file, we only need to decompress the archive directly with TAR VXZF FileName. If it is * .tar.bz2, it is TAR VXJF FileName. Both files are only different compressed methods, and one is pressed with Gzip, and one is pressed with BZIP. Finally, introduce you to learning Linux's most direct and most authoritative methods - using the system's man page man and info. If you don't understand or want to know the parameters of a command, "man command" or "info command". Usually, we use the system with a normal user. However, sometimes we need to edit some system files, or install software, system configuration, then we are more than the administrator.
And UNIX is a multi-user, multi-process operating system, so we don't have to quit or restart the machine, but use the su command directly. $ su file: // Upgrade to rootpassword: file: // root password # file: // You are already root using SU can also become other people, it is "SU UserName", then enter the corresponding password. After completing the work, use exit to exit. / / You can try Ctrl-D We still have a lot under Windows partition, so sometimes the Windows partition is used to use it on the system. Hang up the hard drive, partition, use the mount command. #mount -vfat / dev / hda5 / fat-d file: // puts my D disk into the / FAT-D directory. vfat refers to the FAT32 system format, / dev / hda5 is the hard disk partition location of my D disk. Where HDA refers to the first IDE hard disk, 1 to 4 is the primary partition, 5 will be logical partitions. If you want to hook USB devices, then #mount -vfat / dev / sda1 / mnt / usbdisk is used to uninstall and uninstall usage UMOUNT. Special attention, not unmount, the result of the word word is Command Not found # umount / mnt / usbdisk You can remove the USB device from your computer, otherwise the Linux file system will be damaged. //! ! ! Specially emphasized that for floppy disks; and CD, if you don't unload, the light driver can't open! ! ! In general, installing unloading devices require root privileges. However, we can modify the / etc / fstab file, allowing normal users to install uninstall devices. This is no longer repeated. Finally talk about the problem of shutdown. Any system cannot directly pull the power supply, this is no exception to Windows. When we end work, when you want to shut down, you should use the following command: $ shutdown -h now file: // immediately shut down, turn off the power. Or $ halt -p file: // Effects with the same restart machine is $ shutdown -r now or $ Reboot can also use the "Three Temple" - Ctrl-alt-delete to exit the current user, and other users are $ logout File: // Ctrl-D learned here, we will not get lost in the Linux world. Due to the machine, look for this book :) [GNU / Linux actual combat notveral use], this is here, the next article [GNU / Linux actual combat notes Emacs] will show you how to get Emacs, how to Using the shell under Emacs, install a variety of software, how to listen to music, while write the program (Bash programming), and debug the program. Stay tuned.