您正在查看 "Linux" 分类下的文章 2009年05月25日 星期一 上午 5:32 wc
wc [options] [files]
word count. count the number of words in the specified files, print to stdin number of lines, words and bytes . if no file specified, will read from stdin, until reach EOF(crtl+D is EOF in UNIX, but ctrl+Z in windows) then do the word count.
options:
-c byte count, count the number of bytes,
-m character count,
-l line count,
-w word count
tail
tail [options]. [files]
print last 10 lines of each file, if no file is |
2009年05月25日 星期一 上午 5:12 pipe is a way of redirecting stuff from a command to another one without saving it on the disks, very handy if you want to redirect stuff in a single line:
examples:
$ du | sort -n
the vertical bar in between du(disk usage) and sort takes stdout of du, and send it to stdin of sort.
you can use as many pipes in a line as you want.
$ du | sort -rn | more
send du's output to sort, sort it numerically and reverse the order, than send it to more to display one page-full a |
2009年02月17日 星期二 下午 5:36 the ">" can send a command's output to a file,(if the file exists,it would be overwrited,else will be created)
ls /usr/bin > binaries the output of ls went in to the file binaries;
>> append the output to the end of file.
> only redirect the "stdout", but not "stderr"
&> or >& will send both stdout and stderr
2> send stderr only
commands are some executable files in some spec |
2009年02月17日 星期二 下午 5:13 pwd print working directory, takes no other option
cd [directory(full name)] go to another directory
cd 'cd' with argument return us to our home directory,if your username is abc,it will return to /home/abc
mkdir [directory name] make a new directory in the current directory.
cd [directory] go in to directory in the current directory
cd .. return to the directory just above the current one |
| | |