马哥教育视频笔记:01(Linux常用命令)

时间:2023-03-09 15:35:56
马哥教育视频笔记:01(Linux常用命令)

马哥教育视频笔记:01(Linux常用命令)

1、查看缓存中使用的命令和命令路径

 [wskwskwsk@localhost /]$ hash
 命中     命令
          /usr/bin/printenv
        /usr/bin/ls
          /usr/bin/clear

2、查看系统时间

 [wskwskwsk@localhost /]$ date
 2015年 07月 28日 星期二 :: CST

3、查看ls命令手册

 [wskwskwsk@localhost /]$ man ls
 LS()                                                                                            User Commands                                                                                            LS()

 NAME
        ls - list directory contents

 SYNOPSIS
        ls [OPTION]... [FILE]...

 DESCRIPTION
        List information about the FILEs (the current directory by default).  Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

        Mandatory arguments to long options are mandatory for short options too.

        -a, --all
               do not ignore entries starting with .

        -A, --almost-all
               do not list implied . and ..

        --author
               with -l, print the author of each file

        -b, --escape
               print C-style escapes for nongraphic characters

        --block-size=SIZE
               scale sizes by SIZE before printing them; e.g., ,, bytes; see SIZE format below

        -B, --ignore-backups
               do not list implied entries ending with ~

        -c     with -lt: sort by, and show, ctime (time of last modification of file status information); with -l: show ctime and sort by name; otherwise: sort by ctime, newest first

        -C     list entries by columns

        --color[=WHEN]
               colorize the output; WHEN can be 'never', 'auto', or 'always' (the default); more info below

        -d, --directory
               list directories themselves, not their contents

        -D, --dired
               generate output designed for Emacs' dired mode

        -f     do not sort, enable -aU, disable -ls --color

        -F, --classify
               append indicator (one of */=>@|) to entries

        --file-type
               likewise, except do not append '*'

        --format=WORD
               across -x, commas -m, horizontal -x, , verbose -l, vertical -C

        --full-time
               like -l --time-style=full-iso

        -g     like -l, but do not list owner

        --group-directories-first
               group directories before files;

               can be augmented with a --sort option, but any use of --sort=none (-U) disables grouping

        -G, --no-group
               in a long listing, don't print group names

4、获得命令的使用帮助。

内部命令:例如(help cd)

外部命令:例如(ls --help)

 [wskwskwsk@localhost /]$ ls --help
 用法:ls [选项]... [文件]...
 List information about the FILEs (the current directory by default).
 Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

 Mandatory arguments to long options are mandatory for short options too.
   -a, --all                     不隐藏任何以. 开始的项目
   -A, --almost-all              列出除. 及.. 以外的任何项目
       --author                  与-l 同时使用时列出每个文件的作者
   -b, --escape                  以八进制溢出序列表示不可打印的字符
       --block-size=SIZE      scale sizes by SIZE before printing them; e.g.,
                                '--block-size=M' prints sizes in units of
                                ,, bytes; see SIZE format below
   -B, --ignore-backups       do not list implied entries ending with ~
   -c                         with -lt: sort by, and show, ctime (time of last
                                modification of file status information);
                                with -l: show ctime and sort by name;
                                otherwise: sort by ctime, newest first
   -C                         list entries by columns
       --color[=WHEN]         colorize the output; WHEN can be 'never', 'auto',
                                or 'always' (the default); more info below
   -d, --directory            list directories themselves, not their contents
   -D, --dired                generate output designed for Emacs' dired mode
   -f                         do not sort, enable -aU, disable -ls --color
   -F, --classify             append indicator (one of */=>@|) to entries
       --file-type            likewise, except do not append '*'
       --format=WORD          across -x, commas -m, horizontal -x, long -l,
                                single-column -, verbose -l, vertical -C
       --full-time            like -l --time-style=full-iso
   -g                            类似-l,但不列出所有者
       --group-directories-first
                              group directories before files;
                                can be augmented with a --sort option, but any
                                use of --sort=none (-U) disables grouping
   -G, --no-group                以一个长列表的形式,不输出组名
   -h, --human-readable          与-l 一起,以易于阅读的格式输出文件大小
                                 (例如 1K 234M 2G)
       --si                      同上面类似,但是使用1000 为基底而非1024
   -H, --dereference-command-line
                              follow symbolic links listed on the command line
       --dereference-command-line-symlink-to-dir
                              follow each command line symbolic link
                                that points to a directory
       --hide=PATTERN         do not list implied entries matching shell PATTERN
                                (overridden by -a or -A)
       --indicator-style=WORD  append indicator with style WORD to entry names:
                                none (default), slash (-p),
                                file-type (--file-type), classify (-F)
   -i, --inode                print the index number of each file
   -I, --ignore=PATTERN       do not list implied entries matching shell PATTERN
   -k, --kibibytes            -byte blocks for disk usage
   -l                            使用较长格式列出信息
   -L, --dereference             当显示符号链接的文件信息时,显示符号链接所指示
                                 的对象而并非符号链接本身的信息
   -m                            所有项目以逗号分隔,并填满整行行宽
   -n, --numeric-uid-gid         类似 -l,但列出UID 及GID 号
   -N, --literal                 输出未经处理的项目名称 (如不特别处理控制字符)
   -o                            类似 -l,但不列出有关组的信息
   -p,  --indicator-style=slash  对目录加上表示符号"/"
   -q, --hide-control-chars   print ? instead of nongraphic characters
       --show-control-chars   show nongraphic characters as-is (the default,
                                unless program is 'ls' and output is a terminal)
   -Q, --quote-name           enclose entry names in double quotes
       --quoting-style=WORD   use quoting style WORD for entry names:
                                literal, locale, shell, shell-always, c, escape
   -r, --reverse                 逆序排列
   -R, --recursive               递归显示子目录
   -s, --size                    以块数形式显示每个文件分配的尺寸
   -S                         sort by file size
       --sort=WORD            sort by WORD instead of name: none (-U), size (-S),
                                time (-t), version (-v), extension (-X)
       --time=WORD            with -l, show time as WORD instead of default
                                modification time: atime or access or use (-u)
                                ctime or status (-c); also use specified time
                                as sort key if --sort=time
       --time-style=STYLE     with -l, show times using style STYLE:
                                full-iso, long-iso, iso, locale, or +FORMAT;
                                FORMAT is interpreted like in 'date'; if FORMAT
                                is FORMAT1<newline>FORMAT2, then FORMAT1 applies
                                to non-recent files and FORMAT2 to recent files;
                                if STYLE is prefixed with 'posix-', STYLE
                                takes effect only outside the POSIX locale
   -t                         sort by modification time, newest first
   -T, --tabsize=COLS         assume tab stops at each COLS instead of
   -u                         with -lt: sort by, and show, access time;
                                with -l: show access time and sort by name;
                                otherwise: sort by access time
   -U                         do not sort; list entries in directory order
   -v                         natural sort of (version) numbers within text
   -w, --width=COLS           assume screen width instead of current value
   -x                         list entries by lines instead of by columns
   -X                         sort alphabetically by entry extension
   -                         list one file per line

 SELinux options:

   --lcontext                 Display security context.   Enable -l. Lines
                              will probably be too wide for most displays.
   -Z, --context              Display security context so it fits on most
                              displays.  Displays only mode, user, group,
                              security context and file name.
   --scontext                 Display only security context and file name.
       --help            显示此帮助信息并退出
       --version         显示版本信息并退出

 SIZE **).  Units
 are K, M, G, T, P, E, Z, Y (powers of ) or KB, MB, ... (powers of ).

 使用色彩来区分文件类型的功能已被禁用,默认设置和 --color=never 同时禁用了它。
 使用 --color=auto 选项,ls 只在标准输出被连至终端时才生成颜色代码。
 LS_COLORS 环境变量可改变此设置,可使用 dircolors 命令来设置。

 退出状态:
    正常
    一般问题 (例如:无法访问子文件夹)
    严重问题 (例如:无法使用命令行参数)

 GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
 请向<http://translationproject.org/team/zh_CN.html> 报告ls 的翻译错误
 要获取完整文档,请运行:info coreutils 'ls invocation'

查看当前命令的第几节

 [wskwskwsk@localhost /]$ man  read
 READ()                                                                                    Linux Programmer's Manual                                                                                    READ(2)

 NAME
        read - read from a file descriptor

 SYNOPSIS
        #include <unistd.h>

        ssize_t read(int fd, void *buf, size_t count);

 DESCRIPTION
        read() attempts to read up to count bytes from file descriptor fd into the buffer starting at buf.

        On  files  that  support seeking, the read operation commences at the current file offset, and the file offset is incremented by the number of bytes read.  If the current file offset is at or past the
        end of file, no bytes are read, and read() returns zero.

        If count  returns zero and has no other effects.

        If count is greater than SSIZE_MAX, the result is unspecified.

 RETURN VALUE
        On success, the number of bytes read is returned (zero indicates end of file), and the file position is advanced by this number.  It is not an error if this number is smaller than the number of  bytes
        requested;  this may happen for example because fewer bytes are actually available right now (maybe because we were close to end-of-file, or because we are reading from a pipe, or from a terminal), or
        because read() was interrupted by a signal.  On error, - is returned, and errno is set appropriately.  In this case it is left unspecified whether the file position (if any) changes.

 ERRORS
        EAGAIN The file descriptor fd refers to a file other than a socket and has been marked nonblocking (O_NONBLOCK), and the read would block.

        EAGAIN or EWOULDBLOCK
               The file descriptor fd refers to a socket and has been marked nonblocking (O_NONBLOCK), and the read would block.  POSIX.- allows either error to be returned for this case,  and  does  not
               require these constants to have the same value, so a portable application should check for both possibilities.

        EBADF  fd is not a valid file descriptor or is not open for reading.

        EFAULT buf is outside your accessible address space.

        EINTR  The call was interrupted by a signal before any data was read; see signal().

        EINVAL fd is attached to an object which is unsuitable for reading; or the file was opened with the O_DIRECT flag, and either the address specified in buf, the value specified in count, or the current
               file offset is not suitably aligned.

        EINVAL fd was created via a call to timerfd_create() and the wrong size buffer was given to read(); see timerfd_create() for further information.

        EIO    I/O error.  This will happen for example when the process is in a background process group, tries to read from its controlling terminal, and either it is ignoring or  blocking  SIGTTIN  or  its
               process group is orphaned.  It may also occur when there is a low-level I/O error while reading from a disk or tape.

        EISDIR fd refers to a directory.

        Other  errors  may  occur, depending on the  (with errno set to EINTR) or to return the number of
        bytes already read.

 CONFORMING TO
        SVr4, .3BSD, POSIX.-.

 NOTES
        On NFS file systems, reading small amounts of data will update the timestamp only the first time, subsequent calls may not do so.  This is caused by client side attribute caching, because most if  not
        all  NFS  clients  leave  st_atime  (last  file access time) updates to the server and client side reads satisfied from the client's cache will not cause st_atime updates on the server as there are no
        server side reads.  UNIX semantics can be obtained by disabling client side attribute caching, but in most situations this will substantially increase server load and decrease performance.

 SEE ALSO
        close(), fcntl(), ioctl(), lseek(), open(), pread(), readdir(), readlink(), readv(), ), write(), fread()

 COLOPHON
        This page is part of release 3.53 of the Linux man-pages project.  A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.

 Linux                                                                                              --             

5、光标快速定位快捷键

马哥教育视频笔记:01(Linux常用命令)

6、给命令起一个别名,快速执行简单命令

马哥教育视频笔记:01(Linux常用命令)

马哥教育视频笔记:01(Linux常用命令)马哥教育视频笔记:01(Linux常用命令)

马哥教育视频笔记:01(Linux常用命令)

1