linux下的wc命令的源代码

linux下的wc命令的源代码
linux下的wc命令的源代码

/* wc - print the number of lines, words, and bytes in files

Copyright (C) 1985, 1991, 1995-2010 Free Software Foundation, Inc.

This program is free software: you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation, either version 3 of the License, or

(at your option) any later version.

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.

You should have received a copy of the GNU General Public License

along with this program. If not, see . */ /* Written by Paul Rubin, phr@https://www.360docs.net/doc/257187791.html,

and David MacKenzie, djm@https://www.360docs.net/doc/257187791.html,. */

#include

#include

#include

#include

#include

#include

#include

#include "system.h"

#include "argv-iter.h"

#include "error.h"

#include "mbchar.h"

#include "physmem.h"

#include "quote.h"

#include "quotearg.h"

#include "readtokens0.h"

#include "safe-read.h"

#include "xfreopen.h"

#if !defined iswspace && !HAVE_ISWSPACE

# define iswspace(wc) \

((wc) == to_uchar (wc) && isspace (to_uchar (wc)))

#endif

/* The official name of this program (e.g., no `g' prefix). */

#define PROGRAM_NAME "wc"

#define AUTHORS \

proper_name ("Paul Rubin"), \

proper_name ("David MacKenzie")

/* Size of atomic reads. */

#define BUFFER_SIZE (16 * 1024)

/* Cumulative number of lines, words, chars and bytes in all files so far.

max_line_length is the maximum over all files processed so far. */ static uintmax_t total_lines;

static uintmax_t total_words;

static uintmax_t total_chars;

static uintmax_t total_bytes;

static uintmax_t max_line_length;

/* Which counts to print. */

static bool print_lines, print_words, print_chars, print_bytes;

static bool print_linelength;

/* The print width of each count. */

static int number_width;

/* True if we have ever read the standard input. */

static bool have_read_stdin;

/* The result of calling fstat or stat on a file descriptor or file. */

struct fstatus

{

/* If positive, fstat or stat has not been called yet. Otherwise, this is the value returned from fstat or stat. */

int failed;

/* If FAILED is zero, this is the file's status. */

struct stat st;

};

/* For long options that have no equivalent short option, use a non-character as a pseudo short option, starting with CHAR_MAX + 1. */ enum

{

FILES0_FROM_OPTION = CHAR_MAX + 1

};

static struct option const longopts[] =

{

{"bytes", no_argument, NULL, 'c'},

{"chars", no_argument, NULL, 'm'},

{"lines", no_argument, NULL, 'l'},

{"words", no_argument, NULL, 'w'},

{"files0-from", required_argument, NULL, FILES0_FROM_OPTION}, {"max-line-length", no_argument, NULL, 'L'},

{GETOPT_HELP_OPTION_DECL},

{GETOPT_VERSION_OPTION_DECL},

{NULL, 0, NULL, 0}

};

void

usage (int status)

{

if (status != EXIT_SUCCESS)

fprintf (stderr, _("Try `%s --help' for more information.\n"),

program_name);

else

{

printf (_("\

Usage: %s [OPTION]... [FILE]...\n\

or: %s [OPTION]... --files0-from=F\n\

"),

program_name, program_name);

fputs (_("\

Print newline, word, and byte counts for each FILE, and a total line if\n\

more than one FILE is specified. With no FILE, or when FILE is -,\n\

read standard input.\n\

-c, --bytes print the byte counts\n\

-m, --chars print the character counts\n\

-l, --lines print the newline counts\n\

"), stdout);

fputs (_("\

--files0-from=F read input from the files specified by\n\

NUL-terminated names in file F;\n\

If F is - then read names from standard input\n\ -L, --max-line-length print the length of the longest line\n\

-w, --words print the word counts\n\

"), stdout);

fputs (HELP_OPTION_DESCRIPTION, stdout);

fputs (VERSION_OPTION_DESCRIPTION, stdout);

emit_ancillary_info ();

}

exit (status);

}

/* FILE is the name of the file (or NULL for standard input)

associated with the specified counters. */

static void

write_counts (uintmax_t lines,

uintmax_t words,

uintmax_t chars,

uintmax_t bytes,

uintmax_t linelength,

const char *file)

{

static char const format_sp_int[] = " %*s";

char const *format_int = format_sp_int + 1;

char buf[INT_BUFSIZE_BOUND (uintmax_t)];

if (print_lines)

{

printf (format_int, number_width, umaxtostr (lines, buf));

format_int = format_sp_int;

}

if (print_words)

{

printf (format_int, number_width, umaxtostr (words, buf));

format_int = format_sp_int;

}

if (print_chars)

{

printf (format_int, number_width, umaxtostr (chars, buf));

format_int = format_sp_int;

}

if (print_bytes)

{

printf (format_int, number_width, umaxtostr (bytes, buf));

format_int = format_sp_int;

}

if (print_linelength)

{

printf (format_int, number_width, umaxtostr (linelength, buf));

}

if (file)

printf (" %s", file);

putchar ('\n');

}

/* Count words. FILE_X is the name of the file (or NULL for standard input) that is open on descriptor FD. *FSTATUS is its status.

Return true if successful. */

static bool

wc (int fd, char const *file_x, struct fstatus *fstatus)

{

bool ok = true;

char buf[BUFFER_SIZE + 1];

size_t bytes_read;

uintmax_t lines, words, chars, bytes, linelength;

bool count_bytes, count_chars, count_complicated;

char const *file = file_x ? file_x : _("standard input");

lines = words = chars = bytes = linelength = 0;

/* If in the current locale, chars are equivalent to bytes, we prefer counting bytes, because that's easier. */

#if MB_LEN_MAX > 1

if (MB_CUR_MAX > 1)

{

count_bytes = print_bytes;

count_chars = print_chars;

}

else

#endif

{

count_bytes = print_bytes || print_chars;

count_chars = false;

}

count_complicated = print_words || print_linelength;

/* When counting only bytes, save some line- and word-counting overhead. If FD is a `regular' Unix file, using lseek is enough

to get its `size' in bytes. Otherwise, read blocks of BUFFER_SIZE

bytes at a time until EOF. Note that the `size' (number of bytes)

that wc reports is smaller than stats.st_size when the file is not

positioned at its beginning. That's why the lseek calls below are

necessary. For example the command

`(dd ibs=99k skip=1 count=0; ./wc -c) < /etc/group'

should make wc report `0' bytes. */

if (count_bytes && !count_chars && !print_lines && !count_complicated) {

off_t current_pos, end_pos;

if (0 < fstatus->failed)

fstatus->failed = fstat (fd, &fstatus->st);

if (! fstatus->failed && S_ISREG (fstatus->st.st_mode)

&& (current_pos = lseek (fd, (off_t) 0, SEEK_CUR)) != -1

&& (end_pos = lseek (fd, (off_t) 0, SEEK_END)) != -1)

{

/* Be careful here. The current position may actually be

beyond the end of the file. As in the example above. */ bytes = end_pos < current_pos ? 0 : end_pos - current_pos;

}

else

{

while ((bytes_read = safe_read (fd, buf, BUFFER_SIZE)) > 0)

{

if (bytes_read == SAFE_READ_ERROR)

{

error (0, errno, "%s", file);

ok = false;

break;

}

bytes += bytes_read;

}

}

}

else if (!count_chars && !count_complicated)

{

/* Use a separate loop when counting only lines or lines and bytes -- but not chars or words. */

while ((bytes_read = safe_read (fd, buf, BUFFER_SIZE)) > 0)

{

char *p = buf;

if (bytes_read == SAFE_READ_ERROR)

{

error (0, errno, "%s", file);

ok = false;

break;

}

while ((p = memchr (p, '\n', (buf + bytes_read) - p)))

{

++p;

++lines;

}

bytes += bytes_read;

}

}

#if MB_LEN_MAX > 1

# define SUPPORT_OLD_MBRTOWC 1

else if (MB_CUR_MAX > 1)

{

bool in_word = false;

uintmax_t linepos = 0;

DECLARE_ZEROED_AGGREGATE (mbstate_t, state);

bool in_shift = false;

# if SUPPORT_OLD_MBRTOWC

/* Back-up the state before each multibyte character conversion and move the last incomplete character of the buffer to the front

of the buffer. This is needed because we don't know whether

the `mbrtowc' function updates the state when it returns -2, -

this is the ISO C 99 and glibc-2.2 behaviour - or not - amended

ANSI C, glibc-2.1 and Solaris 5.7 behaviour. We don't have an

autoconf test for this, yet. */

size_t prev = 0; /* number of bytes carried over from previous round */ # else

const size_t prev = 0;

# endif

while ((bytes_read = safe_read (fd, buf + prev, BUFFER_SIZE - prev)) > 0)

{

const char *p;

# if SUPPORT_OLD_MBRTOWC

mbstate_t backup_state;

# endif

if (bytes_read == SAFE_READ_ERROR)

{

error (0, errno, "%s", file);

ok = false;

break;

}

bytes += bytes_read;

p = buf;

bytes_read += prev;

do

{

wchar_t wide_char;

size_t n;

if (!in_shift && is_basic (*p))

{

/* Handle most ASCII characters quickly, without calling

mbrtowc(). */

n = 1;

wide_char = *p;

}

else

{

in_shift = true;

# if SUPPORT_OLD_MBRTOWC

backup_state = state;

# endif

n = mbrtowc (&wide_char, p, bytes_read, &state);

if (n == (size_t) -2)

{

# if SUPPORT_OLD_MBRTOWC

state = backup_state;

# endif

break;

}

if (n == (size_t) -1)

{

/* Remember that we read a byte, but don't complain

about the error. Because of the decoding error,

this is a considered to be byte but not a

character (that is, chars is not incremented). */

p++;

bytes_read--;

continue;

}

if (mbsinit (&state))

in_shift = false;

if (n == 0)

{

wide_char = 0;

n = 1;

}

}

p += n;

bytes_read -= n;

chars++;

switch (wide_char)

{

case '\n':

lines++;

/* Fall through. */

case '\r':

case '\f':

if (linepos > linelength)

linelength = linepos;

linepos = 0;

goto mb_word_separator;

case '\t':

linepos += 8 - (linepos % 8);

goto mb_word_separator;

case ' ':

linepos++;

/* Fall through. */

case '\v':

mb_word_separator:

words += in_word;

in_word = false;

break;

default:

if (iswprint (wide_char))

{

int width = wcwidth (wide_char);

if (width > 0)

linepos += width;

if (iswspace (wide_char))

goto mb_word_separator;

in_word = true;

}

break;

}

}

while (bytes_read > 0);

# if SUPPORT_OLD_MBRTOWC

if (bytes_read > 0)

{

if (bytes_read == BUFFER_SIZE)

{

/* Encountered a very long redundant shift sequence. */

p++;

bytes_read--;

}

memmove (buf, p, bytes_read);

}

prev = bytes_read;

# endif

}

if (linepos > linelength)

linelength = linepos;

words += in_word;

}

#endif

else

{

bool in_word = false;

uintmax_t linepos = 0;

while ((bytes_read = safe_read (fd, buf, BUFFER_SIZE)) > 0) {

const char *p = buf;

if (bytes_read == SAFE_READ_ERROR)

{

error (0, errno, "%s", file);

ok = false;

break;

}

bytes += bytes_read;

do

{

switch (*p++)

{

case '\n':

lines++;

/* Fall through. */

case '\r':

case '\f':

if (linepos > linelength)

linelength = linepos;

linepos = 0;

goto word_separator;

case '\t':

linepos += 8 - (linepos % 8);

goto word_separator;

case ' ':

linepos++;

/* Fall through. */

case '\v':

word_separator:

words += in_word;

in_word = false;

break;

default:

if (isprint (to_uchar (p[-1])))

{

linepos++;

if (isspace (to_uchar (p[-1])))

goto word_separator;

in_word = true;

}

break;

}

}

while (--bytes_read);

}

if (linepos > linelength)

linelength = linepos;

words += in_word;

}

if (count_chars < print_chars)

chars = bytes;

write_counts (lines, words, chars, bytes, linelength, file_x); total_lines += lines;

total_words += words;

total_chars += chars;

total_bytes += bytes;

if (linelength > max_line_length)

max_line_length = linelength;

return ok;

}

static bool

wc_file (char const *file, struct fstatus *fstatus)

{

if (! file || STREQ (file, "-"))

{

have_read_stdin = true;

if (O_BINARY && ! isatty (STDIN_FILENO))

xfreopen (NULL, "rb", stdin);

return wc (STDIN_FILENO, file, fstatus);

}

else

{

int fd = open (file, O_RDONLY | O_BINARY);

if (fd == -1)

{

error (0, errno, "%s", file);

return false;

}

else

{

bool ok = wc (fd, file, fstatus);

if (close (fd) != 0)

{

error (0, errno, "%s", file);

return false;

}

return ok;

}

}

}

/* Return the file status for the NFILES files addressed by FILE.

Optimize the case where only one number is printed, for just one

file; in that case we can use a print width of 1, so we don't need

to stat the file. Handle the case of (nfiles == 0) in the same way;

that happens when we don't know how long the list of file names will be. */ static struct fstatus *

get_input_fstatus (int nfiles, char *const *file)

{

struct fstatus *fstatus = xnmalloc (nfiles ? nfiles : 1, sizeof *fstatus);

if (nfiles == 0

|| (nfiles == 1

&& ((print_lines + print_words + print_chars

+ print_bytes + print_linelength)

== 1)))

fstatus[0].failed = 1;

else

{

int i;

for (i = 0; i < nfiles; i++)

fstatus[i].failed = (! file[i] || STREQ (file[i], "-")

? fstat (STDIN_FILENO, &fstatus[i].st)

: stat (file[i], &fstatus[i].st));

}

return fstatus;

}

/* Return a print width suitable for the NFILES files whose status is recorded in FSTATUS. Optimize the same special case that

get_input_fstatus optimizes. */

static int

compute_number_width (int nfiles, struct fstatus const *fstatus) {

int width = 1;

if (0 < nfiles && fstatus[0].failed <= 0)

{

int minimum_width = 1;

uintmax_t regular_total = 0;

int i;

for (i = 0; i < nfiles; i++)

if (! fstatus[i].failed)

{

if (S_ISREG (fstatus[i].st.st_mode))

regular_total += fstatus[i].st.st_size;

else

minimum_width = 7;

}

for (; 10 <= regular_total; regular_total /= 10)

width++;

if (width < minimum_width)

width = minimum_width;

}

return width;

}

int

main (int argc, char **argv)

{

bool ok;

int optc;

int nfiles;

char **files;

char *files_from = NULL;

struct fstatus *fstatus;

struct Tokens tok;

initialize_main (&argc, &argv);

set_program_name (argv[0]);

setlocale (LC_ALL, "");

bindtextdomain (PACKAGE, LOCALEDIR);

textdomain (PACKAGE);

atexit (close_stdout);

/* Line buffer stdout to ensure lines are written atomically and immediately so that processes running in parallel do not intersperse their output. */ setvbuf (stdout, NULL, _IOLBF, 0);

print_lines = print_words = print_chars = print_bytes = false;

print_linelength = false;

total_lines = total_words = total_chars = total_bytes = max_line_length = 0; while ((optc = getopt_long (argc, argv, "clLmw", longopts, NULL)) != -1) switch (optc)

{

case 'c':

print_bytes = true;

break;

case 'm':

print_chars = true;

break;

case 'l':

print_lines = true;

break;

case 'w':

print_words = true;

break;

case 'L':

print_linelength = true;

break;

case FILES0_FROM_OPTION:

files_from = optarg;

break;

case_GETOPT_HELP_CHAR;

case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);

default:

usage (EXIT_FAILURE);

}

if (! (print_lines || print_words || print_chars || print_bytes

|| print_linelength))

print_lines = print_words = print_bytes = true;

bool read_tokens = false;

struct argv_iterator *ai;

if (files_from)

{

FILE *stream;

/* When using --files0-from=F, you may not specify any files

on the command-line. */

if (optind < argc)

{

error (0, 0, _("extra operand %s"), quote (argv[optind]));

fprintf (stderr, "%s\n",

_("file operands cannot be combined with --files0-from"));

usage (EXIT_FAILURE);

}

if (STREQ (files_from, "-"))

stream = stdin;

else

{

stream = fopen (files_from, "r");

if (stream == NULL)

error (EXIT_FAILURE, errno, _("cannot open %s for reading"),

quote (files_from));

}

/* Read the file list into RAM if we can detect its size and that

size is reasonable. Otherwise, we'll read a name at a time. */ struct stat st;

if (fstat (fileno (stream), &st) == 0

&& S_ISREG (st.st_mode)

&& st.st_size <= MIN (10 * 1024 * 1024, physmem_available () / 2))

{

read_tokens = true;

readtokens0_init (&tok);

if (! readtokens0 (stream, &tok) || fclose (stream) != 0)

error (EXIT_FAILURE, 0, _("cannot read file names from %s"),

quote (files_from));

files = tok.tok;

nfiles = tok.n_tok;

ai = argv_iter_init_argv (files);

}

else

{

files = NULL;

nfiles = 0;

ai = argv_iter_init_stream (stream);

}

}

else

{

static char *stdin_only[] = { NULL };

files = (optind < argc ? argv + optind : stdin_only);

nfiles = (optind < argc ? argc - optind : 1);

ai = argv_iter_init_argv (files);

}

fstatus = get_input_fstatus (nfiles, files);

number_width = compute_number_width (nfiles, fstatus);

int i;

ok = true;

for (i = 0; /* */; i++)

{

bool skip_file = false;

enum argv_iter_err ai_err;

char *file_name = argv_iter (ai, &ai_err);

if (ai_err == AI_ERR_EOF)

break;

if (!file_name)

{

switch (ai_err)

{

case AI_ERR_READ:

error (0, errno, _("%s: read error"), quote (files_from));

skip_file = true;

continue;

case AI_ERR_MEM:

xalloc_die ();

default:

assert (!"unexpected error code from argv_iter");

}

}

if (files_from && STREQ (files_from, "-") && STREQ (file_name, "-"))

{

/* Give a better diagnostic in an unusual case:

printf - | wc --files0-from=- */

error (0, 0, _("when reading file names from stdin, "

"no file name of %s allowed"),

quote (file_name));

skip_file = true;

}

if (!file_name[0])

{

/* Diagnose a zero-length file name. When it's one

among many, knowing the record number may help.

FIXME: currently print the record number only with

--files0-from=FILE. Maybe do it for argv, too? */

if (files_from == NULL)

error (0, 0, "%s", _("invalid zero-length file name"));

else

{

/* Using the standard `filename:line-number:' prefix here is

not totally appropriate, since NUL is the separator, not NL,

but it might be better than nothing. */

unsigned long int file_number = argv_iter_n_args (ai);

error (0, 0, "%s:%lu: %s", quotearg_colon (files_from),

file_number, _("invalid zero-length file name"));

}

skip_file = true;

}

if (skip_file)

ok = false;

else

ok &= wc_file (file_name, &fstatus[nfiles ? i : 0]);

}

/* No arguments on the command line is fine. That means read from stdin.

However, no arguments on the --files0-from input stream is an error means don't read anything. */

if (ok && !files_from && argv_iter_n_args (ai) == 0)

ok &= wc_file (NULL, &fstatus[0]);

if (read_tokens)

readtokens0_free (&tok);

if (1 < argv_iter_n_args (ai))

write_counts (total_lines, total_words, total_chars, total_bytes,

max_line_length, _("total"));

argv_iter_free (ai);

free (fstatus);

if (have_read_stdin && close (STDIN_FILENO) != 0)

error (EXIT_FAILURE, errno, "-");

exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);

}

linux常用操作命令.doc

1 linux常用操作命令 linux系统中通过命令来提高自己的操作能力,下面由小编为大家整理了linux常用操作命令的相关知识,希望大家喜欢! linux常用操作命令一、常用指令 ls 显示文件或目录 -l 列出文件详细信息l(list) -a 列出当前目录下所有文件及目录,包括隐藏的a(all) mkdir 创建目录 -p 创建目录,若无父目录,则创建p(parent) cd 切换目录 touch 创建空文件 2 echo 创建带有内容的文件。

cat 查看文件内容 cp 拷贝 mv 移动或重命名 rm 删除文件 -r 递归删除,可删除子目录及文件 -f 强制删除 find 在文件系统中搜索某文件 wc 统计文本中行数、字数、字符数 grep 在文本文件中查找某个字符串rmdir 删除空目录 3 tree 树形结构显示目录,需要安装tree包

pwd 显示当前目录 ln 创建链接文件 more、less 分页显示文本文件内容head、tail 显示文件头、尾内容 ctrl+alt+F1 命令行全屏模式 linux常用操作命令二、系统管理命令 stat 显示指定文件的详细信息,比ls更详细who 显示在线登陆用户 whoami 显示当前操作用户 hostname 显示主机名 4 uname 显示系统信息

top 动态显示当前耗费资源最多进程信息 ps 显示瞬间进程状态ps -aux du 查看目录大小du -h /home带有单位显示目录信息 df 查看磁盘大小df -h 带有单位显示磁盘信息 ifconfig 查看网络情况 ping 测试网络连通 netstat 显示网络状态信息 man 命令不会用了,找男人如:man ls clear 清屏 alias 对命令重命名如:alias showmeit="ps -aux" ,另外解除使用unaliax showmeit 5 kill 杀死进程,可以先用ps 或top命令查看进程的id,然

HTML各种命令的代码

HTML各种命令的代码 跑马灯 ...普通卷动 ...滑动 ...预设卷动 ...来回卷动...向下卷动 ...向上卷动 向右卷动 向左卷动 ...卷动次数 ...设定宽度 ...设定高度 ...设定背景颜色...设定卷动距离...设定卷动时间 字体效果

...

标题字(最大)

...
标题字(最小) ...粗体字 ...粗体字(强调) ...斜体字 ...斜体字(强调) ...斜体字(表示定义) ...底线 ...底线(表示插入文字) ...横线 ...删除线 ...删除线(表示删除) ...键盘文字 ... 打字体 ...固定宽度字体(在文件中空白、换行、定位功能有效) ...</plaintext>固定宽度字体(不执行标记符号) <listing>...</listing> 固定宽度小字体 <font color=00ff00>...</font>字体颜色 <font size=1>...</font>最小字体 <font style =font-size:100 px>...</font>无限增大 <!>区断标记</p><h2>Linux基础教程 linux scp命令的用法详解</h2><p>Linux基础教程 linuxscp命令的用法详解svn 删除所有的。svn文件 find . -name .svn -type d -exec rm -fr {} \; 名称:cp 使用权限:所有使用者 使用方式: cp [options] source dest cp [options] source... directory 说明:将一个档案拷贝至另一档案,或将数个档案拷贝至另一目录。 把计 -a 尽可能将档案状态、权限等资料都照原状予以复制。 -r 若 source 中含有目录名,则将目录下之档案亦皆依序拷贝至目的地。 -f 若目的地已经有相同档名的档案存在,则在复制前先予以删除再行复制。 范例: 将档案 aaa 复制(已存在),并命名为 bbb : cpaaabbb 将所有的C语言程式拷贝至 Finished 子目录中 : cp *.c Finished 命令:scp 不同的Linux之间copy文件常用有3种方法: 第一种就是ftp,也就是其中一台Linux安装ftp Server,这样可以另外一台使用ftp的client程序来进行文件的copy。</p><p>第二种方法就是采用samba服务,类似Windows文件copy 的方式来操作,比较简洁方便。 第三种就是利用scp命令来进行文件复制。 scp是有Security的文件copy,基于ssh登录。操作起来比较方便,比如要把当前一个文件copy到远程另外一台主机上,可以如下命令。 scp /home/daisy/full.tar.gz root@172.19.2.75:/home/root 然后会提示你输入另外那台172.19.2.75主机的root用户的登录密码,接着就开始copy了。 如果想反过来操作,把文件从远程主机copy到当前系统,也很简单。 scp root@/full.tar.gz 172.19.2.75:/home/root/full.tar.gz home/daisy/full.tar.gz linux 的 scp 命令可以在 linux 之间复制文件和目录; ================== scp 命令 ================== scp 可以在 2个 linux 主机间复制文件; 命令基本格式: scp [可选参数] file_sourcefile_target ====== 从本地复制到远程 ====== * 复制文件: * 命令格式: scplocal_fileremote_username@remote_ip:remote_folder 或者 scplocal_fileremote_username@remote_ip:remote_file 或者</p><h2>linux 基本操作命令行</h2><p>linux的命令操作 1、日常操作命令 **查看当前所在的工作目录 pwd **查看当前系统的时间 date **查看有谁在线(哪些人登陆到了服务器) who 查看当前在线 last 查看最近的登陆历史记录 2、文件系统操作 ** ls / 查看根目录下的子节点(文件夹和文件)信息 ls -al -a是显示隐藏文件 -l是以更详细的列表形式显示 **切换目录 cd /home **创建文件夹 mkdir aaa 这是相对路径的写法 mkdir -p aaa/bbb/ccc mkdir /data 这是绝对路径的写法 **删除文件夹 rmdir 可以删除空目录 rm -r aaa 可以把aaa整个文件夹及其中的所有子节点全部删除 rm -rf aaa 强制删除aaa **修改文件夹名称 mv aaa angelababy **创建文件 touch somefile.1 创建一个空文件 echo "i miss you,my baby" > somefile.2 利用重定向“>”的功能,将一条指令的输出结果写入到一个文件中,会覆盖原文件内容 echo "huangxiaoming ,gun dan" >> somefile.2 将一条指令的输出结果追加到一个文件中,不会覆盖原文件内容 用vi文本编辑器来编辑生成文件 ******最基本用法 vi somefile.4</p><p>1、首先会进入“一般模式”,此模式只接受各种快捷键,不能编辑文件内容 2、按i键,就会从一般模式进入编辑模式,此模式下,敲入的都是文件内容 3、编辑完成之后,按Esc键退出编辑模式,回到一般模式; 4、再按:,进入“底行命令模式”,输入wq命令,回车即可 ******一些常用快捷键 一些有用的快捷键(在一般模式下使用): a 在光标后一位开始插入 A 在该行的最后插入 I 在该行的最前面插入 gg 直接跳到文件的首行 G 直接跳到文件的末行 dd 删除行,如果 5dd ,则一次性删除光标后的5行 yy 复制当前行, 复制多行,则 3yy,则复制当前行附近的3行 p 粘贴 v 进入字符选择模式,选择完成后,按y复制,按p粘贴 ctrl+v 进入块选择模式,选择完成后,按y复制,按p粘贴 shift+v 进入行选择模式,选择完成后,按y复制,按p粘贴 查找并替换(在底行命令模式中输入) %s/sad/88888888888888 效果:查找文件中所有sad,替换为88888888888888 /you 效果:查找文件中出现的you,并定位到第一个找到的地方,按n可以定位到下一个匹配位置(按N定位到上一个) 3、文件权限的操作 ****linux文件权限的描述格式解读 drwxr-xr-x (也可以用二进制表示 111 101 101 --> 755) d:标识节点类型(d:文件夹 -:文件 l:链接) r:可读 w:可写 x:可执行 第一组rwx:表示这个文件的拥有者对它的权限:可读可写可执行 第二组r-x:表示这个文件的所属组对它的权限:可读,不可写,可执行 第三组r-x:表示这个文件的其他用户(相对于上面两类用户)对它的权限:可读,不可写,可执行 ****修改文件权限 chmod g-rw haha.dat 表示将haha.dat对所属组的rw权限取消 chmod o-rw haha.dat 表示将haha.dat对其他人的rw权限取消 chmod u+x haha.dat 表示将haha.dat对所属用户的权限增加x 也可以用数字的方式来修改权限 chmod 664 haha.dat 就会修改成 rw-rw-r--</p><h2>手机指令命令代码大全</h2><p>MTK平台手机指令大全 设置指令:*#66*# 中文语言:*#0086# + send 查看版本:*#8375# 软件版本:*#8882# 测试:*#87# 调试:*#8899# (?) 默认语言:*#0000#+通话键 设置英文:*#0044#+通话键 繁体中文:*#0886#+通话键 简体中文:*#0086#+通话键 串号查询:*#06# 原厂设置:*#66*# 查看版本:*#8375# 工厂指令:*#3646633# 自动测试:*#87# 软件版本:*#8882# *#035670766*001# *#035670766*002# 有一些机器开机输入*#66*#不进测试的。可以在开机瞬间,在按键灯亮和开机音乐响的时候快速按*#*#............*#就可进入测试 科达Q191(MT6228平台)有些好象不支持,可惜啊.......... 诺基亚是国际知名手机品牌,它在中国市场上一直占据着很大一部分销售份额。诺基亚手机拥有着时尚的外观和强大的功能,尤其是它出色的性能,经久耐用。是赢得很多消费者喜爱的主要原因。不少消费者在购买诺基亚手机之后,都会拿着说明书仔细阅读使用说明。然而,不管是什么牌子的手机除了说明书上的那些说明文字之外,都还有很多用户并不知晓的操作命令!而这些使用命令却能够给我们的使用上提供很大的帮助。 1 输入*#06#:显示IMEI码 2 输入*#0000#:显示软件版本(部分型号如果不起作用,可按*#型号代码#,如*#6110#) 第一行--软件版本; 第二行--软件发布日期; 第三行--手机型号 3 输入*#92702689#查询更多的手机信息。有五个选项(可用上下方向键选择): ①Serial No.:手机的IMEI码。</p><h2>Linux 用户必知:一分钟掌握14个常用Linux命令行快捷键</h2><p>Linux 用户必知:一分钟掌握14个常用Linux命令行快捷键 2018.10.29 前几天有个朋友给我发消息:“问你个问题,Linux 命令行有没有快捷键一下从行末会到行头?经常敲了很多命令发现忘加sudo 了,然后把命令删了重新敲一遍”。 正好借此机会给不知道的朋友总结一下: 首先说说历史记录个数的“HISTFILESIZE”和“HISTSIZE”的区别默认情况下HISTFILESIZE 和HISTSIZE的值都是500,表示可以记录500 条命令记录。 ·HISTFILESIZE 表示记录在文件中的命令条数 · HISTSIZE 表示记录在内存中的命令条数 当我们在 shell 命令行执行命令的时候,最近的HISTSIZE 条命令被保存在内存当中可以使用上下光标或者ctrl+p,ctrl+n 上下查找命令。 当退出shell 时HISTFILESIZE 条命令被保存到历史命令文件中,下次登录shell 时会从历史命令文件中读取命令道内存历史命令道中。 当网络中断等异常时,你会发现之前的历史命令,下次登录时用上下光标找不到上次的历史命令,所以要正常退出或者发送探测包保持shell 在线。 如果想增加历史命令保存的数量,可以在~/.bash_profile 中手动修改HISTFILESIZE 和HISTSIZE 这两个变量的值。 必须知道的Linux命令行 我想提一下一些快捷键可能依赖于你使用的Shell。Bash 是最受欢迎的shell,所以列出的快捷键集中在Bash。如果你愿意,你也可以称其为Bash 快捷键列表。 注意我在键盘快捷键中使用了大写字母,但这并不意味着你在使用快捷键时必须按下</p><h2>CAD命令、特殊符号代码大全</h2><p>常用命令: A——ARC——圆弧B——BLOCK——块定义C——CIRCLE——圆D——DIMSTYLE——标注样式E/DEL键——ERASE——删除F——FILIET——倒圆角H——BHATCH——填充L——LINE——直线 M/S——MOVE——移动O——OFFSET——偏移P——PAN——实时平移(图标为小手)X——EXPLODE——分解PO——POINT——点XL——XLINE——射线ML——MLINE——多线PL——PLINE——多段线POL——POLYGON——正多边形REC——RECTANGLE——矩形DO——DONUT——圆环EL——ELLIPSE——椭圆CO——COPY——复制MI——MIRROR——镜像AR——ARRAY——阵列RO——ROTATE——旋转TR——TRIM——修剪EX——EXTEND——延伸CHA——CHAMFER——倒角F——FILIET——倒圆角BR——BREAK——打断 尺寸标注: DLI——DIMLINEAR——直线标注DAL——DIMALIGNED——对齐标注DRA——DIMRADIUS——半径标注DDI——DIMDIAMETER——直径标注DAN——DIMANGULAR——角度标注DCE——DIMCENTER——中心标注DOR——DIMORDINATE——点标注TOL——TOLERANCE——标注形位公差LE——QLEADER——快速引出标注DBA——DIMBASELINE——基线标注DCO——DIMCONTINUE——连续标注DED——DIMEDIT——编辑标注DOV——DIMOVERRIDE——替换标注系统变量 常用CTRL快捷键: 【CTRL】+1—PROPERTIES—修改特性【CTRL】+2—ADCENTER—设计中心 【CTRL】+O——OPEN——打开文件【CTRL】+N/M——NEW——新建文件 【CTRL】+P——PRINT——打印文件【CTRL】+S——SAVE——</p><h2>Linux find命令常见用法汇总</h2><p>Linux find命令常见用法汇总 导读:Linux系统中查找文件的命令式find,find命令具有强大的功能,能够提供多种查找条件,下面小编就给大家带来Linux中find命令的常见用法汇总,一起来学习下吧。 ·find path -option [-print ][-exec -ok command ]{} \; find命令的参数; pathname:find命令所查找的目录路径。例如用。来表示当前目录,用/来表示系统根目录。 -print:find命令将匹配的文件输出到标准输出。 -exec:find命令对匹配的文件执行该参数所给出的shell命令。相应命令的形式为‘command’ { } \;,注意{ }和\;之间的空格。 -ok:和-exec的作用相同,只不过以一种更为安全的模式来执行该参数所给出的shell命令,在执行每一个命令之前,都会给出提示,让用户来确定是否执行。 #-print 将查找到的文件输出到标准输出 #-exec command {} \; —–将查到的文件执行command操作,{} 和\;之间有空格 #-ok 和-exec相同,只不过在操作前要询用户 例:find 。-name .svn | xargs rm -rf ==================================================== -name filename #查找名为filename的文件 -perm #按执行权限来查找 -user username #按文件属主来查找</p><p>-group groupname #按组来查找 -mtime -n +n #按文件更改时间来查找文件,-n指n天以内,+n指n天以前-atime -n +n #按文件访问时间来查GIN:0px“》 -ctime -n +n #按文件创建时间来查找文件,-n指n天以内,+n指n天以前-nogroup #查无有效属组的文件,即文件的属组在/etc/groups中不存在 -nouser #查无有效属主的文件,即文件的属主在/etc/passwd中不存 -newer f1 !f2 找文件,-n指n天以内,+n指n天以前 -ctime -n +n #按文件创建时间来查找文件,-n指n天以内,+n指n天以前-nogroup #查无有效属组的文件,即文件的属组在/etc/groups中不存在 -nouser #查无有效属主的文件,即文件的属主在/etc/passwd中不存 -newer f1 !f2 #查更改时间比f1新但比f2旧的文件 -type b/d/c/p/l/f #查是块设备、目录、字符设备、管道、符号链接、普通文件 -size n[c]#查长度为n块[或n字节]的文件 -depth #使查找在进入子目录前先行查找完本目录 -fstype #查更改时间比f1新但比f2旧的文件 -type b/d/c/p/l/f #查是块设备、目录、字符设备、管道、符号链接、普通文件 -size n[c]#查长度为n块[或n字节]的文件 -depth #使查找在进入子目录前先行查找完本目录 -fstype #查位于某一类型文件系统中的文件,这些文件系统类型通常可在/etc/fstab中找到 -mount #查文件时不跨越文件系统mount点 -follow #如果遇到符号链接文件,就跟踪链接所指的文件 -cpio %; #查位于某一类型文件系统中的文件,这些文件系统类型通常可在/etc/fstab中找到 -mount #查文件时不跨越文件系统mount点 -follow #如果遇到符号链接文件,就跟踪链接所指的文件 -cpio #对匹配的文件使用cpio命令,将他们备份到磁带设备中 -prune #忽略某个目录 ===================================================== $find ~ -name ”*.txt“ -print #在$HOME中查.txt文件并显示 $find 。-name ”*.txt“ -print $find 。-name ”[A-Z]*“ -print #查以大写字母开头的文件 $find /etc -name ”host*“ -print #查以host开头的文件 $find 。-name ”[a-z][a-z][0–9][0–9].txt“ -print #查以两个小写字母和两个数字开头的txt文件 $find 。-perm 755 -print $find 。-perm -007 -exec ls -l {} \; #查所有用户都可读写执行的文件同-perm 777 $find 。-type d -print $find 。!-type d -print $find 。-type l -print $find 。-size +1000000c -print #查长度大于1Mb的文件</p><h2>Linux操作命令大全——CMJ</h2><p>即用即查Linux命令行实例参考手册代码第1章Linux基本网络及文件传输命令 网络下载器——wget wget命令语法: wget [参数][URL] 实例1 下载https://www.360docs.net/doc/257187791.html,网站首页的数据。 [root@localhost local]# wget https://www.360docs.net/doc/257187791.html, 实例2 最多尝试5次下载文件https://www.360docs.net/doc/257187791.html,/ images/ac2009eu_125x12 5_bas ic.gif。 [root@localhost local]# wget –t 5 https://www.360docs.net/doc/257187791.html,/im ages/ac2009eu_125x125_ba sic.gif 实例3 在后台最多尝试5次下载文件https://www.360docs.net/doc/257187791.html,/in/Images/big/happy2 00 9. png。 [root@localhost local]# wget -t 5 -o download.log http://ww https://www.360docs.net/doc/257187791.html,/in/Images/big /happy2009.png 实例4 假定下载文件https://www.360docs.net/doc/257187791.html,/httpd/httpd-2.0.63-win 32-src.zip的工作被打断,现在需要使用断点续传的功能继续下载。 [root@localhost local]# wget –nc –r http://apache.etoak.co m/ httpd/httpd -2.0.63-win32 -src.zip 实例5 以5层(默认)递归方式建立https://www.360docs.net/doc/257187791.html,镜像,每个文件尝试一次,操作过程记录到日志文件sinamirror.log。下载后在本地重新建立链接关系。 [root@localhost local]# wget --convert-links –r http://ww https://www.360docs.net/doc/257187791.html,/ -o sinamirror.l og 文本浏览——lynx Lynx命令语法: lynx [参数][文件/目录/URL] 实例1 使用lynx浏览网站https://www.360docs.net/doc/257187791.html,。 [root@localhost local]# lynx https://www.360docs.net/doc/257187791.html, 实例2 使用lynx打开离线HTML文档spring-2-intro.html。 [root@localhost local]# lynx spring-2-intro.html 文件传输——ftp ftp命令语法: ftp [参数][主机名称/IP地址] 实例1 从Linux系统主机10.0.101.9利用登录账户root登录到基于Windows操作系统主机10.0.101.5的FTP服务器。 第1步,启动FTP服务,等待FTP客户端连接。</p><h2>Linux scp命令</h2><p>Linux scp命令用于Linux之间复制文件和目录,具体如何使用这里好好介绍一下,从本地复制到远程、从远程复制到本地是两种使用方式。这里有具体举例: ================== Linux scp 命令 ================== scp 可以在2个linux 主机间复制文件; 命令基本格式: scp [可选参数] file_source file_target ====== 从本地复制到远程 ====== * 复制文件: * 命令格式: scp local_file remote_username@remote_ip:remote_folder 或者 scp local_file remote_username@remote_ip:remote_file 或者 scp local_file remote_ip:remote_folder 或者 scp local_file remote_ip:remote_file 第1,2个指定了用户名,命令执行后需要再输入密码,第1个仅指定了远程的目录,文件名字不变,第2个指定了文件名; 第3,4个没有指定用户名,命令执行后需要输入用户名和密码,第3个仅指定了远程的目录,文件名字不变,第4个指定了文件名; * 例子: scp /home/space/music/1.mp3 root@https://www.360docs.net/doc/257187791.html,:/home/root/others/music scp /home/space/music/1.mp3 root@https://www.360docs.net/doc/257187791.html,:/home/root/others/music/001.mp3 scp /home/space/music/1.mp3 https://www.360docs.net/doc/257187791.html,:/home/root/others/music scp /home/space/music/1.mp3 https://www.360docs.net/doc/257187791.html,:/home/root/others/music/001.mp3 * 复制目录: * 命令格式: scp -r local_folder remote_username@remote_ip:remote_folder 或者 scp -r local_folder remote_ip:remote_folder</p><h2>15个极好的Linux find命令示例</h2><p>前阵子,我们审查了15件实事find命令的例子(第一部分)。查找命令可以做很多比只是在寻找基于名称的文件(第2部分)在这篇文章中,让我们来讨论15高级find命令的例子,包括-根据它访问,修改或改变的时间查找文件,查找文件相比之下,执行操作找到的文件等。 基于访问/修改/更改时间查找文件 你可以找到基于以下三个文件的时间属性的文件。 1.访问时间的文件。文件访问时,访问时间得到更新。 2.的文件的修改时间。文件内容修改时,修改时间得到更新。 3.更改文件的时间。更改时间时,被更新的inode数据的变化。 在下面的例子中,min选项之间的差异和时间选项是参数。 ?分论点将它的参数为分钟。例如,60分钟(1小时)= 60分钟。 ?时间参数,将它的参数为24小时。例如,时间2 = 2 * 24小时(2天)。 ?虽然这样做的24个小时计算,小数部分都将被忽略,所以25小时为24小时,和47小时取为24小时,仅48小时为48小时。要获得更清晰的参考atime的部分find 命令的手册页。 例1:找到在1个小时内被更改的文件 想要通过文件修改时间找出文件,可以使用参数-mmin -mtime。下面是man手册中有关mmin和mtime的定义。 ?-mmin n文件最后一次修改是在n分钟之内 ?-mtime n文件最后一次修改是在n*24小时之内(译者注:也就是n天了呗)执行下面例子中的命令,将会找到当前目录以及其子目录下,最近一次修改时间在1个小时(60分钟)之内的文件或目录 1 # find . -mmin -60</p><p>同样的方式,执行下面例子中的命令,将会找到24小时(1天)内修改了的文件(文件系统根目录/ 下) 1 # find / -mtime -1 例2:找到1个小时内被访问过的文件 想要通过文件访问时间找出文件,可以使用参数-amin -atime。下面是man手册中有关amin和atime的定义。 ?-amin n文件最后一次访问是在n分钟之内 ?-atime n文件最后一次访问是在n*24小时之内 执行下面例子中的命令,将会找到当前目录以及其子目录下,最近一次访问时间在1个小时(60分钟)之内的文件或目录 1 # find . -amin -60 同样的方式,执行下面例子中的命令,将会找到24小时(1天)内被访问了的文件(文件系统根目录/ 下) 1 # find / -atime -1 例3:查找一个小时内状态被改变的文件 (译者注:这里的改变更第1个例子的更改文件内容时间是不同概念,这里是更改的是文件inode的数据,比如文件的权限,所属人等等信息) 要查找文件的inode的更改时间,使用-cmin和-ctime选项 ?-cmin n文件的状态在n分钟内被改变 ?-ctime n文件状态在n*24小时内(也就是n天内)被改变 (译者注:如果上面的n为-n形式,则表示n分钟/天之内,n为+n则表示n分钟/天之前) 下面的例子在当前目录和其子目录下面查找一个小时内文件状态改变的文件(也就是60分钟内): 1 # find . -cmin -60 同样的道理,下面的例子在根目录/及其子目录下一天内(24小时内)文件状态被改变的文件列表: 1 # find / -ctime -1 例4:搜索仅仅限定于文件,不显示文件夹</p><h2>Linux SSH远程文件目录传输命令scp</h2><p>Linux SSH远程文件/目录传输命令scp 相信各位VPSer在使用VPS时会经常在不同VPS间互相备份数据或者转移数据,大部分情况下VPS上都已经安装了Nginx或者类似的web server,直接将要传输的文件放到web server的目录,然后在目标机器上执行:wget https://www.360docs.net/doc/257187791.html,/testfile.zip 就行了。当VPS上没有安装web server 和ftp server的时候会感觉上面的方法比较麻烦,那么用scp命令就会排上用场。 一、scp是什么? scp是secure copy的简写,用于在Linux下进行远程拷贝文件的命令,和它类似的命令有cp,不过cp只是在本机进行拷贝不能跨服务器,而且scp可以跨服务器并且传输是加密的。可能会稍微影响一下速度。 二、scp有什么用? 1、我们需要获得远程服务器上的某个文件,远程服务器既没有配置ftp服务器,没有开启web服务器,也没有做共享,无法通过常规途径获得文件时,只需要通过scp命令便可轻松的达到目的。 2、我们需要将本机上的文件上传到远程服务器上,远程服务器没有开启ftp服务器或共享,无法通过常规途径上传是,只需要通过scp命令便可以轻松的达到目的。 三、scp使用方法 1、获取远程服务器上的文件 scp -P 2222 root@https://www.360docs.net/doc/257187791.html,:/root/lnmp0.4.tar.gz /home/lnmp0.4.tar.gz 上端口大写P 为参数,2222 表示更改SSH端口后的端口,如果没有更改SSH端口可以不用添加该参数。root@https://www.360docs.net/doc/257187791.html, 表示使用root用户登录远程服务器https://www.360docs.net/doc/257187791.html,,:/root/lnmp0.4.tar.gz 表示远程服务器上的文件,最后面的/home/lnmp0.4.tar.gz表示保存在本地上的路径和文件名。 2、获取远程服务器上的目录</p><h2>Linux命令大全(设备管理)</h2><p>设备管理-setleds 名称:setleds 使用权限:一般使用者 使用方式: setleds [-v] [-L] [-D] [-F] [{+|-}num] [{+|-}caps] [{+|-}scroll]说明: 用来设定键盘上方三个LED 的状态。在Linux 中,每一个虚拟主控台都有独立的设定。 参数: -F 预设的选项,设定虚拟主控台的状态。 -D 除了改变虚拟主控台的状态外,还改变预设的状态。 -L 不改变虚拟主控台的状态,但直接改变LED 显示的状态。这会使得LDE 显示和目前虚拟主控台的状态不符合。我们可以在稍后用-L 且不含其它选项的setleds 命令回复正常状态。 -num +num 将数字键打开或关闭。 -caps +caps 把大小写键打开或关闭。 -scroll +scroll 把选项键打开或关闭。 范例: 将数字键打开,其馀二个灯关闭。 # setleds +num -caps -scroll 设备管理-loadkeys 名称: loadkeys 使用权限: 所有使用者</p><p>使用方式: loadkeys [ -d --default ] [ -h --help ] [ -q --quiet ] [ -v --verbose [ -v --verbose ]...] [ -m --mktable ] [ -c --clearcompose ] [ -s --clearstrings ] [ filename... ] 使用说明: 这个命令可以根据一个键盘定义表改变linux 键盘驱动程序转译键盘输入过程。详细的说明请参考dumpkeys。 选项: -v --verbose 印出详细的资料,你可以重复以增加详细度。 -q --quiet 不要显示任何讯息。 -c --clearcompose 清除所有composite 定义。 -s --clearstrings 将定串定义表清除。 相关命令: dumpkeys 设备管理-rdev 名称:rdev 使用权限:所有使用者 使用方式:使用这个指令的基本方式是:rdev [-rsvh ] [-o offset ] [ image [value [ offset ] ] ] 但是随著使用者想要设定的参数的不同,底下的方式也是一样: rdev [ -o offset ] [ image [ root_device [ offset ] ] ] swapdev [ -o offset ] [ image [ swap_device [ offset ] ] ] ramsize [ -o offset ] [ image [ size [ offset ] ] ] videomode [ -o offset ] [ image [ mode [ offset ] ] ] rootflags [ -o offset ] [ image [ flags [ offset ] ] ]</p><h2>FIND命令大全</h2><p>Linux Find命令精通指南 作者:Sheryl Calish 简单介绍这一无处不在的命令的强大的方面以及混乱的方面。 2008年7月发布 Linux find命令是所有Linux命令中最有用的一个,同时也是最混乱的一个。它很难,因为它的语法与其他Linux命令的标准语法不同。但是,它很强大,因为它允许您按文件名、文件类型、用户甚至是时间戳查找文件。使用find命令,您不但可以找到具这些属性任意组合的文件,还可以对它找到的文件执行操作。 本文的目的是,通过概述find命令的用途和潜能,简化该命令的学习和使用。同时,它将针对find命令的某些最强大但最混乱的方面提供一个基本的指南和参考。 [注意:本文使用的find版本是GNU版本,因此,某些细节可能与其他版本的find有所不同。] 基本格式 开始之前,我们先来看一下find命令的基本结构: find start_directory test options criteria_to_match action_to_perform_on_results 在以下命令中,find将开始在当前目录(用“.”表示)中查找任何扩展名为“java”的文件:find.-name"*.java" 下面是该命令所找到的命令的缩略清单: find.-name"*.java" ./REGEXPvalidate/src/oracle/otnsamples/plsql/ConnectionManager.java ./REGEXPvalidate/src/oracle/otnsamples/plsql/DBManager.java .. [注意:如果您从本文剪切并粘贴来运行该find命令,您可能需要使用自己的键盘替换双引号(“”)才能得出正确的结果。] 以下命令将执行相同的操作。在这两种情况下,您都需要对通配符进行转义以确保它传递到find命令并且不由shell解释。因此,请将您的搜索字符串放到引号里,或者在它前面加上反斜线:</p><h2>Linux命令操作小技巧</h2><p>1、关于arp协议: 关于arp命令,注意其中的Flags,如果是C,表示是动态的,但是如果使用arp -s 来绑定的话则是显示M,是静态 所以后边每个侦都需要加入填充字符以达到以太网的最小长度要求60字节。 大多数的bsd实现把完成tcp连接请求的时间限制设置为75秒。 1byte=8bit 2、关于tcpdump 想输出点分十进制:tcpdump -n *** 想输出mac地址:tcpdump -e *** 抓到目标为A的包:tcpdump dst A 问题:如何使用Tcpdump显示抓到的包的长度,因为以太网包的最小长度为60,用packetyzer抓到48 3、Linux的路由重定向 /proc/sys/net/ipv4/conf/uall/send_redirects /proc/sys/net/ipv4/conf/default/send_redirects /proc/sys/net/ipv4/conf/eth0/send_redirects 4、如何修改Linux网卡的mtu (1) ifconfig eth0 mtu 1400 (使用系统都带的ifconfig) (2) ip link set eth0 mtu 1400 (使用系统都带的ip) 5、以Tomcat用户来启动tomcat #su - tomcat -c "/usr/local/tomcat" 但是难道这样不需要输入密码吗? 6、修改网卡MAC地址: #ifconfig eth0 down #ifconfig eth0 hw ether 00:AA:BB:CCD:EE #ifconfig eth0 up 7、在Linux上释放所有arp: #arp -d -a</p><h2>我世界-指令大全</h2><p>首先/manuadd xx gm? 如果要使用这个命令,需要自己先有权限 在控制台输入manuadd xx admin 然后添加sethome权限 manselect 世界名字(默认world) 输入mangaddp essentials.sethome default(应该是这个格式不行的话就试试mangaddp default essentials.sethome) 这样就添加完sethome权限了 另外你启动完成之后输入plugins命令看看插件,把插件截图发出来 默认拥有全部权限的是admin 【单机】 ascend - 把自己提升到上一个平台 bind <命令> {命令关键字} - 设置一键命令 clear - 清空控制台 damage - 关闭或者开启伤害即无敌 descend - 把自己移动到下面一个的平台 destroy [all] - 破坏当前的东西(背包) defuse [all] - 拆弹(拆除已经点燃了的TNT炸药) diff - X difficulty - 设置游戏难度 dropstore - 在身边创建一个储物柜 *drops - 开关物品掉落,关闭的话采矿打怪不掉东西。 dupe [all] - 复制东西 duplicate [all] - 复制手上的东西并丢出来</p><p>explode [范围] - 设置一个地方爆炸(在自家慎用) extinguish [all] - 熄灭周围所有的火 ext [all] - 一样是熄灭火 falldamage - 开关高空落下伤害 firedamage - 开关火的伤害 fly - 飞行模式 *freeze - 冻结怪物 give <物品> [数量] - 给一样物品 goto <名字> - 去一个地方 grow [all] - 让立即小麦成长 h [COMMAND] - 命令列表/帮助 heal - 补指定的血 health - 设置生命值 help [COMMAND] - 命令列表/帮助 home 回到出生点 i <物品代码> [数量] - 刷东西 instantmine - 开关即时采矿(采矿无延迟) item <物品代码|物品名称> [数量] [费用] 给玩家物品, 如果不指定则是最大的数量itemname - 显示当前手上的物品名称 itemstack <物品代码> [数量] - 给玩家指定数量的物品 kill 自杀不解释 jump - 瞬移到鼠标所指的地方 killnpc [all] - 杀死周围全部NPC 或者叫杀了附近所有除自己外的活体生物 l - X</p><h2>linux查找文件命令find</h2><p>linux查找文件命令find 每一种操作系统都是由成千上万个不同种类的文件所组成的。其中有系统本身自带的文件,用户自己的文件,还有共享文件等等。我们有时候经常忘记某份文件放在硬盘中的哪个地方。在微软的WINDOWS操作系统中要查找一份文件是相当简单的事情,只要在桌面上点击“开始”-“搜索”中就能按照各种方式在本地硬盘上,局域网络,甚至在INTERNET上查找各种文件,文档。 可是使用Linux的用户就没有那么幸运了,在Linux上查找某个文件确实是一件比较麻烦的事情。毕竟在Linux中需要我们使用专用的“查找”命令来寻找在硬盘上的文件。Linux下的文件表达格式非常复杂,不象WINDOWS,DOS下都是统一的AAAAAAA.BBB 格式那么方便查找,在WINDOWS中,只要知道要查找的文件的文件名或者后缀就非常容易查找到。Linux中查找文件的命令通常为“find”命令,“find”命令能帮助我们在使用,管理Linux的日常事务中方便的查找出我们需要的文件。对于Linux新手来说,“find”命令也是了解和学习Linux文件特点的方法。因为Linux发行版本繁多,版本升级很快,在Linux 书籍上往往写明某个配置文件的所在位置,往往Linux新手按图索骥还是不能找到。比如说REDHAT Linux 7.O和REDHAT Linux 7.1中有些重要的配置文件所在的硬盘位置和文件目录就有了很大的改变,如果不学会使用“find”命令,那么在成千上万的Linux文件中要找到其中的一个配置文件是相当困难的,笔者在没有精通“find”命令之前就吃过这样的苦头。好,下面就详细为大家介绍强大的“find”命令的全部使用方法和用途。 通过文件名查找法: 这个方法说起来就和在WINDOWS下查找文件一样容易理解了。如果你把这个文件放在单个的文件夹里面,只要使用常见的“ls"命令就能方便的查找出来,那么使用“find”命令来查找它就不能给你留下深刻的印象,毕竟“find”命令的强大功能不止这个。如果知道了某个文件的文件名,而不知道这个文件放到哪个文件夹,甚至是层层套嵌的文件夹里。举例说明,假设你忘记了httpd.conf这个文件在系统的哪个目录下,甚至在系统的某个地方也不知道,则这是可以使用如下命令: find / -name httpd.conf 这个命令语法看起来很容易就明白了,就是直接在find后面写上-name,表明要求系统按照文件名查找,最后写上httpd.conf这个目标文件名即可。稍等一会系统会在计算机</p></div> <div class="rtopicdocs"> <div class="coltitle">相关主题</div> <div class="relatedtopic"> <div id="tabs-section" class="tabs"> <ul class="tab-head"> <li id="12443336"><a href="/topic/12443336/" target="_blank">linux下scp命令整理</a></li> <li id="11657642"><a href="/topic/11657642/" target="_blank">linux下find命令详解</a></li> <li id="12801415"><a href="/topic/12801415/" target="_blank">linux命令行</a></li> <li id="4043058"><a href="/topic/4043058/" target="_blank">命令代码大全</a></li> </ul> </div> </div> </div> </div> <div id="rightcol" class="viewcol"> <div class="coltitle">相关文档</div> <ul class="lista"> <li><a href="/doc/9916098658.html" target="_blank">Linux企业运维人员最常用150个命令汇总</a></li> <li><a href="/doc/cd8818018.html" target="_blank">Linux系统巡检常用命令</a></li> <li><a href="/doc/1b5057844.html" target="_blank">linux常用10个指令</a></li> <li><a href="/doc/3710222027.html" target="_blank">Linux之间文件远程复制</a></li> <li><a href="/doc/7218097714.html" target="_blank">工作中常用的linux命令总结(80个左右)</a></li> <li><a href="/doc/a517403523.html" target="_blank">linux scp命令 (复制远程主机上的文件到本地)</a></li> <li><a href="/doc/e417649443.html" target="_blank">linux利用scp实现自动远程备份</a></li> <li><a href="/doc/1e17874488.html" target="_blank">Linux SSH远程文件目录传输命令scp</a></li> <li><a href="/doc/499264266.html" target="_blank">linux系统中scp命令的用法(Permission denied排错二例)</a></li> <li><a href="/doc/9a11205172.html" target="_blank">Linux常用操作命令</a></li> <li><a href="/doc/b619027497.html" target="_blank">linux下 scp命令不需要输入用户密码</a></li> <li><a href="/doc/f713504498.html" target="_blank">linux 文件传输 sshscp命令</a></li> <li><a href="/doc/1a348895.html" target="_blank">Linux基础教程 linux scp命令的用法详解</a></li> <li><a href="/doc/348004170.html" target="_blank">linux下scp命令详解--主机之间拷贝</a></li> <li><a href="/doc/55881288.html" target="_blank">Linux所有命令大全</a></li> <li><a href="/doc/aa15423250.html" target="_blank">linux系统命令大全()</a></li> <li><a href="/doc/ee10063374.html" target="_blank">Linux SSH远程文件目录传输命令scp</a></li> <li><a href="/doc/1b9752789.html" target="_blank">Linux scp命令</a></li> <li><a href="/doc/3816069155.html" target="_blank">命令大全</a></li> <li><a href="/doc/963828844.html" target="_blank">linux常用命令大全(精心整理,收藏了)</a></li> </ul> <div class="coltitle">最新文档</div> <ul class="lista"> <li><a href="/doc/0f19509601.html" target="_blank">幼儿园小班科学《小动物过冬》PPT课件教案</a></li> <li><a href="/doc/0119509602.html" target="_blank">2021年春新青岛版(五四制)科学四年级下册 20.《露和霜》教学课件</a></li> <li><a href="/doc/9b19184372.html" target="_blank">自然教育课件</a></li> <li><a href="/doc/3019258759.html" target="_blank">小学语文优质课火烧云教材分析及课件</a></li> <li><a href="/doc/d819211938.html" target="_blank">(超详)高中语文知识点归纳汇总</a></li> <li><a href="/doc/a419240639.html" target="_blank">高中语文基础知识点总结(5篇)</a></li> <li><a href="/doc/9d19184371.html" target="_blank">高中语文基础知识点总结(最新)</a></li> <li><a href="/doc/8a19195909.html" target="_blank">高中语文知识点整理总结</a></li> <li><a href="/doc/8519195910.html" target="_blank">高中语文知识点归纳</a></li> <li><a href="/doc/7f19336998.html" target="_blank">高中语文基础知识点总结大全</a></li> <li><a href="/doc/7119336999.html" target="_blank">超详细的高中语文知识点归纳</a></li> <li><a href="/doc/6619035160.html" target="_blank">高考语文知识点总结高中</a></li> <li><a href="/doc/6719035161.html" target="_blank">高中语文知识点总结归纳</a></li> <li><a href="/doc/4a19232289.html" target="_blank">高中语文知识点整理总结</a></li> <li><a href="/doc/3b19258758.html" target="_blank">高中语文知识点归纳</a></li> <li><a href="/doc/2619396978.html" target="_blank">高中语文知识点归纳(大全)</a></li> <li><a href="/doc/2b19396979.html" target="_blank">高中语文知识点总结归纳(汇总8篇)</a></li> <li><a href="/doc/1419338136.html" target="_blank">高中语文基础知识点整理</a></li> <li><a href="/doc/ed19066069.html" target="_blank">化工厂应急预案</a></li> <li><a href="/doc/bd19159069.html" target="_blank">化工消防应急预案(精选8篇)</a></li> </ul> </div> </div> <script> var sdocid = "25f0e65777232f60ddcca19a"; </script> <div class="clearfloat"></div> <div id="footer"> <div class="ft_info"> <a href="https://beian.miit.gov.cn">闽ICP备16038512号-3</a>&nbsp;<a href="/tousu.html" target="_blank">侵权投诉</a> &nbsp;&copy;2013-2023 360文档中心,www.360docs.net | <a target="_blank" href="/sitemap.html">站点地图</a><br /> 本站资源均为网友上传分享,本站仅负责收集和整理,有任何问题请在对应网页下方投诉通道反馈 </div> <script type="text/javascript">foot()</script> </div> </body> </html>