[ Pobierz całość w formacie PDF ]
.If you install Mtools, thereshould be manual pages available for these commands.Accessing MS-DOS files is one thing; running MS-DOS programs is another.There isan MS-DOS Emulator under development for Linux; it is widely available, and included inmost distributions.It can also be retrieved from a number of locations, including the variousLinux FTP sites listed in Appendix B.The MS-DOS Emulator is reportedly powerfulenough to run a number of applications, including WordPerfect, from Linux.However,Linux and MS-DOS are vastly different operating systems.The power of any MS-DOSemulator under UNIX is limited.In addition, a Microsoft Windows emulator that runsunder X Windows is under development.146 Linux Tutorial3.5 Summary of basic UNIX commands.This section introduces some of the most useful basic commands of a UNIX system,including those that are covered in the previous section.Note that options usually begin with - , and in most cases you can specify more thanone option with a single -.For example, rather than use the commandls -l -F, youcan usels -lF.Rather than listing every option for each command, we only present useful or importantcommands at this time.In fact, most of these commands have many options that you llnever use.You can usemanto see the manual pages for each command, which list all ofthe available options.Also note that many of these commands take as arguments a list of files or directories,denoted in this table by file1.fileN.For example, thecpcommand takes as argumentsa list of files to copy, followed by the destination file or directory.When copying more thanone file, the destination must be a directory.cd Change the current working directory.Syntax: cd directoryWhere directory is the directory which you want to change to.(.refers to the current directory, . the parent directory.If no directoryis is specified it defaults you your home directory.)Example: cd./foosets the current directory up one level, then backdown tofoo.ls Displays information about the named files and directories.Syntax: ls filesWhere files consists of the the filenames or directories to list.The mostcommonly used options are-F(to display the file type), and-l(to givea long listing including file size, owner, permissions, and so on).Example: ls -lF /home/larrydisplays the contents of the direc-tory/home/larry.cp Copies one or more file to another file or directory.Syntax: cp files destinationWhere files lists the files to copy, and destination is the destination fileor directory.Example: cp./frog joe copies the file./frog to the file orSummary of Basic UNIX Commands 147directoryjoe.mv Moves one or more file to another file or directory.This command doesthe equivalent of a copy followed by the deletion of the original file.Youcan use this to rename files, like in the MS-DOS commandRENAME.Syntax: mv files destinationWhere files lists the files to move, and destination is the destination fileor directory.Example: mv./frog joe moves the file./frog to the file ordirectoryjoe.rm Deletes files.Note that when you delete a file under UNIX, they are un-recoverable (unlike MS-DOS, where you can usually undelete the file).Syntax: rm filesWhere files describes the filenames to delete.The-ioption prompts for confirmation before deleting the file.Example: rm -i /home/larry/joe /home/larry/frogdeletes the filesjoeandfrogin/home/larry.mkdir Creates new directories.Syntax: mkdir dirsWhere dirs are the directories to create.Example: mkdir /home/larry/test creates the directory testin/home/larry.rmdir Deletes empty directories.When usingrmdir, the current working di-rectory must not be within the directory to be deleted.Syntax: rmdir dirsWhere dirs defines the directories to delete.Example: rmdir /home/larry/papers deletes the directory/home/larry/papers, if empty.man Displays the manual page for the given command or resource (that is,any system utility that isn t a command, such as a library function.)Syntax: man commandWhere command is the name of the command or resource to get help on.Example: man lsgives help on thelscommand.148 Linux Tutorialmore Displays the contents of the named files, one screenful at a time.Syntax: more filesWhere files lists the files to display.Example: more papers/history-final displays the filepapers/history-final.cat Officially used to concatenate files,catis also used to display the con-tents of a file on screen.Syntax: cat filesWhere files lists the files to display.Example: cat letters/from-mdw displays the fileletters/from-mdw.echo Displays the given arguments on the screen.Syntax: echo argsWhere args lists arguments to echo.Example: echo "Hello world" displays the string Helloworld.grep Display every line in one or more files that match the given pattern.Syntax: grep pattern filesWhere pattern is a regular expression pattern, and files lists the files tosearch.Example: grep loomer /etc/hostsdisplays every line in the file/etc/hoststhat contains the pattern loomer.3.6 Exploring the file system.A file system is the collection of files and the hierarchy of directories on a system.Thetime has now come to escort you around the file system.You now have the skills and the knowledge to understand the Linux file system, andyou have a roadmap.(Refer to diagram on page 137).First, change to the root directory (cd /), and then enter ls -F to display a listing2of its contents.You ll probably see the following directories : bin, dev, etc, home,install,lib,mnt,proc,root,tmp,user,usr, andvar.2You may see others, and you might not see all of them.Every release of Linux differs in some respects.Exploring the File System 149Now, let s take a look at each of these directories./bin /binis short for binaries , or executables, where many essential sys-tem programs reside.Use ls -F /bin to list the files here
[ Pobierz całość w formacie PDF ]