1. 程式人生 > >Chap3:檔案系統中跳轉[The Linux Command Line]

Chap3:檔案系統中跳轉[The Linux Command Line]

1 introduce the following commands

  pwd - Print name of current working directory

  cd-Change directory

  ls-List directory contents

2 understand the file system tree

  Unix-like systems such as Linux always have a single file system tree, regardless of how many drives or storage devices are attached to the computer.Storage devices are attached(or morer correctly,mounted) at various points on the tree according to the whims of the system administrator, the person(or persons) reponsible for the maintenance of the system.

the current working directory

  Imagine that the file system is a  maze shaped like an upside-down tree and we are able to stand in the middle of it. At any given time ,we are inside a single directory and we can see the files contained in the directory and the pathway to the directory above us(called the parent directory

) and any subdirectories below us.The directory we are standing in is called the current working directory.To display the current working directory,we use the pwd(print working directory) command.

4 home directory

  When we first log in to our system(or start a terminal emulator session) our current working directory is set to our home directorty

. Each user account is given its own home directory and when operating as a regulat user, the home directory is the only place the user is allowed to write files.

5 list the files and directories

  we use the ls command.

6 change working directory

  we use the cd command. To do this , type cd followed by the pathname of the desired working directory.A pathname is the route we take along the branches of the tree to get to the directory we want. Pathnames can be specified in one of two different ways;as absolute pathnames or as relative pathnames.

  6.1 absolute pathname

    begins with  the root directory and follow the tree branch by branch until the path to the desired directory or file is completed.

  6.2 relative pathname

    starts from the working directory.(we can use the one that requies the least typing)

7 Importance Facts About Filenames

  (1)Filenames that begin with a period character are  hidden.This only means that ls will not list them unless you say ls-a.

  (2)Filenames and commands in Linux,like Unix, are case sensitive.

  (3)Linux has no concept of a "file extension" like some other operating system.

  (4)Though Linux suports long filenames which may contain embedded spaces and punctuation characters,limit the punctuation characters in the names of files you create to period(.),dash(-),and underscore(_).