self-study from bird Brother's book, thank Brother Bird. A. Path relative path and absolute path . Represents this level of directory ... represents the top-level directory -represents the previous working directory- represents the current user's home folder c11>~dt2131 represents the Home folder example of the user "dt2131" : absolute path:/usr/share/doc relative path:.. /man (To/usr/share/man) two. Execute file path variable $path the different user default path is different before and after $PATH directory differentiation . Path can be modified to: separate this directory. It is best not to add PATH, in case you open this directory under the same name of the horse-hanging program echo $PATH query $PATH directory three. File, add directory Censored CD (change directory) switch directory
pwd (Print Working directory) display working directory
-P Displays the true file path (converts the linked file to the true file path)
LS view files and directories ls [-parameters] Directory name - A: All files, along with hidden files and. -A: All files, along with hidden files, are not included . -D: Listing only - F: Lists results directly without sorting -F: Additional data structures based on information such as files, directories, etc. * Executable file /Directory = Socket File | FIFO file -H: Use GB,KB to display file capacity -I: List inode numbers - L: Lists Long data strings, including file properties and Permissions -N: List uid and GID -r: Reverse Sort output -R: The subdirectories are also displayed -S: Sort by capacity size -T: Sorting by Time ls [--color={never,auto,always}] Directory name --color=never: Remove color display --color=always: Display color --color=auto: The system sets itself ls [--full-time] Directory name --full-time: Display in full time mode --time={atime,ctime}: Output access time or Change permission attribute time
mkdir (make directory) creates a new directory requires target path to exist without parameters -P will progressively establish a non-existent target path - m gives permission example Mkdir-p test1/test2-m 711 rmdir (remove directory) Delete empty directory -R Delete directory regardless of NULL cp Copy file directory CP [-parameters] Source file destination file -A: equivalent to-PDR - D: If the source file is a linked file, copy the linked file - F: If the target file already exists and cannot be opened, copy after deletion -I : If the target file already exists, the overwrite will ask first -L: Hard-linked connection file creation rather than copying the file itself -P: Copying along with file attributes, not default properties - R: Recursive continuous Replication for directory replication behavior - S: Copy as Shortcut -u: Target file is updated if it is older than the source file the source file has more than two, the last destination file must be a directory rm Remove file or directory (rename can also use rename) RM [-parameters] file or directory - F: Ignore files that do not exist, do not call the police -I: Ask before deleting - R: Recursive deletion, often used for directory deletion MV moving files and directories or renaming MV [-parameters] source file target file -F: Do not ask for direct overwrite -I: ask if overwrite - u: Target file exists, source file update overwrites basename,dirname query path filename and directory name Example: basename/etc/sysconfig/network ->network dirname etc/sysconfig/network ->etc/sysconfig/ cat,tac,nl View File contents cat [-parameter] file path -A: the equivalent of-vet integration parameters, you can list some special characters, not blank -B: List as blank line number - E: Displays the ending break character $ -N: Print travel numbers, with blank lines -T: Show [Tab] as ^t - V: Lists special characters that are not displayed TAC Reverse Listing TAC File Path NL Add line number print NL [-parameters] file path -B Specifies the way the line number is specified -B A: with blank lines -B T: no blank lines - N line number position -N in- left display -N RN to the right shows, since 1 -N RZ right display, since 0 the number of digits occupied by the-W line number Example: Nl-b a-n rz-w 4/etc/issue 0001 CentOS Release 5.3 (Final) 0002 Kernel \ r on a \ n 0003